lib.fileset: Fix tests on Darwin, more POSIX#291933
Merged
roberth merged 1 commit intoNixOS:masterfrom Feb 28, 2024
Merged
Conversation
This was found when trying to run the fileset tests on Darwin (NixOS/nix#9546 (comment)), which mysteriously fail on Darwin: test case at lib/fileset/tests.sh:342 failed: toSource { root = "/nix/store/foobar"; fileset = ./.; } should have errored with this regex pattern: lib.fileset.toSource: `root` \(/nix/store/foobar\) is a string-like value, but it should be a path instead. \s*Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. but this was the actual error: error: lib.fileset.toSource: `root` (/nix/store/foobar) is a string-like value, but it should be a path instead. Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. After dissecting this, I find out that apparently \s works on Linux, but not on Darwin for some reason! From the bash source code, it looks like <regex.h> with `REG_EXTENDED` is used for all platforms the same, so there's nothing odd there. It's almost impossible to know where <regex.h> comes from, but it looks to be a POSIX thing. So after digging through the almost impossible to find POSIX specifications (https://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html#tag_007_003_005), I can indeed confirm that there's no mention of \s or the like! _However_, there is a mention of `[[:blank:]]`, so we'll use that instead.
13 tasks
Member
|
Please also review #291936 |
Contributor
|
Successfully created backport PR for |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes
This was found when trying to run the fileset tests on Darwin, which mysteriously fail:
After dissecting this, I find out that apparently
\sworks on Linux, but not on Darwin for some reason!From the bash source code, it looks like
<regex.h>withREG_EXTENDEDis used for all platforms the same, so there's nothing odd there. It's almost impossible to know where<regex.h>comes from, but it looks to be a POSIX thing.So after digging through the almost impossible to find POSIX specifications, I can indeed confirm that there's no mention of
\sor the like!However, there is a mention of
[[:blank:]], which indeed does work on Darwin too! So we'll use that instead.Things done
This work is sponsored by Antithesis ✨
Add a 👍 reaction to pull requests you find important.