Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out what to do with our uses of builtins.match before Nix 1.12 is released #28718

Closed
copumpkin opened this issue Aug 29, 2017 · 5 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@copumpkin
Copy link
Member

copumpkin commented Aug 29, 2017

A quick git grep against a recent HEAD reveals that we use builtins.match fairly extensively:

$ git grep builtins.match
lib/filesystem.nix:                          (map (builtins.match pattern) files);
lib/sources.nix:    in lib.any (re: builtins.match re relPath != null) regexes) src;
nixos/modules/services/misc/geoip-updater.nix:          (x: builtins.match ".*\.(gz|xz)$" x == null) cfg.databases) == [];
nixos/modules/services/misc/geoip-updater.nix:          ${toString (builtins.filter (x: builtins.match ".*\.(gz|xz)$" x == null) cfg.databases)};
pkgs/build-support/fetchgit/default.nix:    matched = builtins.match "(.*).git" base;
pkgs/build-support/fetchgit/default.nix:    appendShort = if (builtins.match "[a-f0-9]*" rev) != null
pkgs/build-support/fetchurl/boot.nix:    let m = builtins.match "mirror://([a-z]+)/(.*)" url; in
pkgs/development/idris-modules/default.nix:      m = builtins.match "(.*)\.nix" name;
pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/default.nix:  match = builtins.match "(.*)\\.patch" name;
pkgs/top-level/impure.nix:            (builtins.filter (n: builtins.match ".*\.nix" n != null || pathExists (path + ("/" + n + "/default.nix")))

We need to figure out which regexes will be affected by the change (if any) and fix them.

Also, many of them already behave differently between Linux and Darwin (see NixOS/nix#1537), so we should probably do something about those even before 1.12 😄

@mpickering
Copy link
Contributor

I can look at the idris usage of builtins.match but how has it changed in version 1.12?

Eventually I think I will refactor that code anyway to not rely on match at all.

@copumpkin
Copy link
Member Author

It now uses std::regex in C++ which I think has slightly different syntax and behavior from before.

@dezgeg
Copy link
Contributor

dezgeg commented Nov 3, 2017

Here's one difference which I noticed with non-matching capture groups:

$ nix-build -A nix
/nix/store/6lgqkk4cpcsi3bl2xnk5q0ylsn2vdmvj-nix-1.11.15
$ ./result/bin/nix-instantiate --eval -E 'builtins.match "(x)?(y)?" ""' 
[ ]
$ nix-build -A nixUnstable
/nix/store/h2zl1b3297gwixk26lpvzhmlcdzyl1j9-nix-1.12pre5663_c7af84ce
$ ./result/bin/nix-instantiate --eval -E 'builtins.match "(x)?(y)?" ""' 
[ null null ]

@stale
Copy link

stale bot commented Jun 5, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 5, 2020
@pennae
Copy link
Contributor

pennae commented Feb 4, 2023

it's been five years. any issues that were likely to ever be discovered probably have been, and if there's anything left this issue probably won't even be remembered by whoever finds it.

@pennae pennae closed this as completed Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

4 participants