Skip to content

Comments

[Backport release-23.11] lib.fileset: Fix tests on Darwin, more POSIX#291954

Merged
roberth merged 1 commit intorelease-23.11from
backport-291933-to-release-23.11
Feb 28, 2024
Merged

[Backport release-23.11] lib.fileset: Fix tests on Darwin, more POSIX#291954
roberth merged 1 commit intorelease-23.11from
backport-291933-to-release-23.11

Conversation

@github-actions
Copy link
Contributor

Bot-based backport to release-23.11, triggered by a label in #291933.

  • Before merging, ensure that this backport is acceptable for the release.
    • Even as a non-commiter, if you find that it is not acceptable, leave a comment.

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.

(cherry picked from commit 3429594)
@github-actions github-actions bot requested a review from infinisil as a code owner February 28, 2024 00:59
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Feb 28, 2024
@roberth roberth closed this Feb 28, 2024
@roberth roberth reopened this Feb 28, 2024
@github-actions github-actions bot added the 6.topic: lib The Nixpkgs function library label Feb 28, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 28, 2024
@roberth roberth merged commit b550fe4 into release-23.11 Feb 28, 2024
@infinisil infinisil deleted the backport-291933-to-release-23.11 branch February 28, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants