GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix fs realpath.native test by devsnek · Pull Request #20954 · nodejs/node

Conversation

@devsnek

@devsnek devsnek commented May 25, 2018

Copy link
Copy Markdown
Member

If you're on a mac with a case sensitive filesystem this test fails.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to Node.js core tests and test infrastructure. label May 25, 2018
@devsnek
devsnek requested a review from bnoordhuis May 25, 2018 00:34
lpinca
lpinca approved these changes May 25, 2018
View reviewed changes
@Trott

Trott commented May 26, 2018

Copy link
Copy Markdown
Member

/ping @bnoordhuis who originally added the test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR

BridgeAR commented May 28, 2018

Copy link
Copy Markdown
Member

@bnoordhuis PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented May 28, 2018

Copy link
Copy Markdown
Member

Just curious, what kind of Mac is that? The test should work assuming you're using HFS+ in its default case-preserving mode, unless you deleted /Users and recreated it as /users (and who does that anyway?)

Losing the test would be a bit of a shame because it's the only coverage for this specific condition that we have.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented May 28, 2018

Copy link
Copy Markdown
Member Author

@bnoordhuis i just updated my mac to sierra and while doing so decided it was about time i switched on case sensitivity (which has been great except for steam not working and this bug)

anyone on HFS+ (Case-sensitive) and APFS (Case-Sensitive) filesystems will experience this.

would this test also work with symlinks? i'd be happy to rewrite it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung

joyeecheung commented May 28, 2018

Copy link
Copy Markdown
Member

Maybe we can keep the test if we detect the file system type with diskutil info / in the test?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented May 28, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I suspect you're in for a lot of pain, a lot of mac apps don't deal with case sensitivity well. That aside, does this patch work for you?

Details
diff --git a/test/parallel/test-fs-realpath-native.js b/test/parallel/test-fs-realpath-native.js
index 93b5a278cf..4e9987fa8e 100644
--- a/test/parallel/test-fs-realpath-native.js
+++ b/test/parallel/test-fs-realpath-native.js
@@ -1,13 +1,18 @@
 'use strict';
 const common = require('../common');
 const assert = require('assert');
 const fs = require('fs');
 
-if (!common.isOSX) common.skip('MacOS-only test.');
+const filename = __filename.toUpperCase();
+try {
+  fs.accessSync(filename);
+} catch {
+  common.skip('not a case-insensitive fs');
+}
 
-assert.strictEqual(fs.realpathSync.native('/users'), '/Users');
-fs.realpath.native('/users', common.mustCall(function(err, res) {
+assert.strictEqual(fs.realpathSync.native(filename), __filename);
+fs.realpath.native(filename, common.mustCall(function(err, res) {
   assert.ifError(err);
-  assert.strictEqual(res, '/Users');
+  assert.strictEqual(res, __filename);
   assert.strictEqual(this, undefined);
 }));
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from 47dd96b to b1b596d Compare May 29, 2018 02:45
@devsnek

devsnek commented May 29, 2018

Copy link
Copy Markdown
Member Author

CI https://ci.nodejs.org/job/node-test-pull-request/15142/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR approved these changes May 29, 2018
View reviewed changes
Comment thread test/parallel/test-fs-realpath-native.js Outdated

@BridgeAR BridgeAR May 29, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to keep the assert.ifError since it provides a much better error message in case of an error.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott, trivikr, and addaleax reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@BridgeAR BridgeAR added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label May 29, 2018
@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from b1b596d to 792e7cf Compare June 13, 2018 02:28
@devsnek

devsnek commented Jun 18, 2018

Copy link
Copy Markdown
Member Author

CI https://ci.nodejs.org/job/node-test-pull-request/15506/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jun 18, 2018

Copy link
Copy Markdown
Member

Windows failures sure seem relevant:

not ok 158 parallel/test-fs-realpath-native
  ---
  duration_ms: 0.133
  severity: fail
  exitcode: 1
  stack: |-
    assert.js:80
      throw new AssertionError(obj);
      ^
    
    AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
    + expected - actual
    
    - 'C:\\workspace\\node-test-binary-windows\\test\\parallel\\test-fs-realpath-native.js'
    + 'c:\\workspace\\node-test-binary-windows\\test\\parallel\\test-fs-realpath-native.js'
        at Object.<anonymous> (c:\workspace\node-test-binary-windows\test\parallel\test-fs-realpath-native.js:13:8)
        at Module._compile (internal/modules/cjs/loader.js:702:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
        at Module.load (internal/modules/cjs/loader.js:612:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
        at Function.Module._load (internal/modules/cjs/loader.js:543:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
        at startup (internal/bootstrap/node.js:241:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:565:3)
  ...
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jun 19, 2018

Copy link
Copy Markdown
Member

Ah, Windows... I guess that could be worked around by comparing the drive volume case-insensitively.

Aside, the test won't work right as long as it still has this in it:

assert.strictEqual(fs.realpathSync.native('/users'), '/Users');
jasnell reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jun 19, 2018

Copy link
Copy Markdown
Member

Since the test was previously skipped everywhere but macOS, it would still be an improvement if it was skipped only on Windows now. So that could be a simple workaround here.

On the other hand, since this really tests underlying OS functionality more than Node.js functionality, I wonder if it would be acceptable to get rid of the string comparisons entirely and just have it resolve . and .. type stuff.

Or (a bit more brittle but arguably more thorough), have it monkey-patch process.binding('fs').realpath and have the monkey-patched function confirm that it receives the expected arguments from the calls to fs.realpathSync.native() and fs.realpath.native()?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented Jun 21, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

i don't have a windows machine and i don't know anything about the quirks of window's filesystem so someone who can actually test that will need to get me a patch for it.

on the other hand it seems like its really fiddly to try and detect the proper operation of case sensitive filesystems, is there another way we can test realpath? it must have some use besides resolving case.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from 792e7cf to d57049c Compare June 21, 2018 22:41
@apapirovski

apapirovski commented Jun 25, 2018

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/15593/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented Jun 27, 2018

Copy link
Copy Markdown
Member Author

this still needs to be fixed on windows and i still don't have a windows machine

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jun 28, 2018

Copy link
Copy Markdown
Member

@devsnek Would it help if you had Remote Desktop access to a Windows machine? Or would you still likely need someone else to assist?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Jun 29, 2018
View reviewed changes
@Trott Trott added wip Issues and PRs that are still a work in progress. and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Jun 29, 2018
@Trott

Trott commented Jun 29, 2018

Copy link
Copy Markdown
Member

Added in progress label and removed author ready so that no one tries to land this before the Windows issue is sorted.

jasnell reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented Jul 1, 2018

Copy link
Copy Markdown
Member Author

@Trott is there another way to test realpath besides case sensitivity stuff? will it resolve symlinks? relative paths?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 1, 2018

Copy link
Copy Markdown
Member

@Trott is there another way to test realpath besides case sensitivity stuff? will it resolve symlinks? relative paths?

http://man7.org/linux/man-pages/man3/realpath.3.html

Resolves symlinks, ., .., extra /.

I haven't tried to figure out why the test was added in the first place, but if removing it is not an option, maybe we can alter it to confirm that fs.realpathSync.native() invokes process.binding('fs').realpath(), confirm that there's no error, and that it gets back something that resembles a path, but don't worry too much about the details beyond that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from d57049c to fc70224 Compare July 1, 2018 04:01
@Trott

Trott commented Jul 9, 2018

Copy link
Copy Markdown
Member

/ping @nodejs/fs

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented Jul 13, 2018

Copy link
Copy Markdown
Member Author

@nodejs/fs again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek devsnek changed the title test: remove faulty fs test test: fix fs realpath.native test Jul 13, 2018
@Trott

Trott commented Jul 13, 2018

Copy link
Copy Markdown
Member

@nodejs/platform-windows maybe?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bzoz

bzoz commented Jul 14, 2018

Copy link
Copy Markdown
Contributor

On Windows the __filename will be equal to the argv[1]. Whatever filename capitalization test runner uses to spawn the test, it will be used. IMHO the test comparison should be made case insensitive on Windows.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek

devsnek commented Jul 18, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

CI https://ci.nodejs.org/job/node-test-pull-request/15923/

OSX Rebuild: https://ci.nodejs.org/job/node-test-commit-osx/19888/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek devsnek mentioned this pull request Jul 18, 2018
provision macos test runner with case sensitive filesystem nodejs/build#1403
Closed
@devsnek

devsnek commented Jul 18, 2018

Copy link
Copy Markdown
Member Author

all tests passing... landing tomorrow morning

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek devsnek added author ready PRs with CI started, the required approvals, and no outstanding review comments. fs Issues and PRs related to file-system APIs and the fs module. and removed wip Issues and PRs that are still a work in progress. labels Jul 18, 2018
@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from ddfa979 to bacfa87 Compare July 18, 2018 15:46
@devsnek
test: fix faulty relpath test
9cd932f
PR-URL: nodejs#20954
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@devsnek
devsnek force-pushed the fix/osx-sometimes-has-case-sensitive-filesystems branch from bacfa87 to 9cd932f Compare July 18, 2018 15:48
@devsnek devsnek closed this Jul 18, 2018
@devsnek
devsnek deleted the fix/osx-sometimes-has-case-sensitive-filesystems branch July 18, 2018 15:48
@devsnek
devsnek merged commit 9cd932f into nodejs:master Jul 18, 2018
@devsnek

devsnek commented Jul 18, 2018

Copy link
Copy Markdown
Member Author

landed in 9cd932f

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek
devsnek restored the fix/osx-sometimes-has-case-sensitive-filesystems branch July 18, 2018 15:48
@devsnek
devsnek deleted the fix/osx-sometimes-has-case-sensitive-filesystems branch July 18, 2018 15:49
@gibfahn

gibfahn commented Jul 19, 2018

Copy link
Copy Markdown
Member

I suspect you're in for a lot of pain, a lot of mac apps don't deal with case sensitivity well. That aside, does this patch work for you?

@bnoordhuis FWIW I used a case sensitive FS on macOS for the last two years without running into any issues.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devsnek devsnek removed the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jul 19, 2018
targos pushed a commit that referenced this pull request Jul 19, 2018
@devsnek @targos
test: fix faulty relpath test
292aa42
PR-URL: #20954
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@targos targos mentioned this pull request Jul 31, 2018
v10.8.0 proposal #22040
Merged
This was referenced Aug 1, 2018
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-nodejs#212
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#223
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#224
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#225
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#226
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#227
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@lpinca lpinca lpinca approved these changes
@BridgeAR BridgeAR BridgeAR approved these changes
@bnoordhuis bnoordhuis Awaiting requested review from bnoordhuis

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

fs Issues and PRs related to file-system APIs and the fs module. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@devsnek @Trott @BridgeAR @bnoordhuis @joyeecheung @apapirovski @bzoz @gibfahn @jasnell @lpinca @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.