libexpr: Don't use nix::dirOf in prim_dirOf (fix 2.23 regression)#14515
libexpr: Don't use nix::dirOf in prim_dirOf (fix 2.23 regression)#14515Ericson2314 merged 2 commits intomasterfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
ef70c59 to
e697509
Compare
04d95d5 to
a6cf6fe
Compare
These will change in the next commit to fix the silent regression from 2.23 in the handling of multiple subsequent path separators.
This gets us back to pre-2.23 behavior of this primop. Done by inlining the code of `nix::dirOf` from 2.2-maintenance.
a6cf6fe to
a33fccf
Compare
|
Should we backport, @xokdvium? |
|
Also, we might want to add a test for |
Since this is a bug that is somewhat recent it seems prudent to backport to all supported versions while we still can. |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
Did anybody observe this "regression" in the real world? I'm not sure we should revert to worse behavior if nobody was affected by this... Bug-for-bug compatibility should really only apply if people were actually depending on the buggy behaviour. Since nobody complained in almost a year since 2.23, that's good evidence that nobody was affected by this. |
Yes, that does mean that we can fix the behavior in the future, but using std::filesystem was definitely an accident. Because of it e.g. |
|
I agree with @xokdvium and also that that I would be comfortable changing this intentionally in the future, because I also don't believe in bug-for-bug compat. But yes this was neither intentional, not a clear net-improvement (and using |
You have more important things to achieve than risking making a mess of this builtin, when changes like this eventually boomerang back to you. If you want a clean language, I'd suggest making a new one that's data-model-interoperable through some small interface (JSON + string context + function calls). |
## Bug fixes (crashes) - Fix segfaults from `toView()` when compiled with newer nixpkgs (NixOS/nix#14154) - Fix use-after-move in `DerivationGoal::repairClosure` and `SampleStack` (NixOS/nix#14086) - Fix assertion failure on partially valid derivation outputs (NixOS/nix#14137) - Fix `RestrictedStore::addDependency` recursion causing crashes (NixOS/nix#14729) - Fix crash on flakerefs containing newlines (NixOS/nix#14450) ## Bug fixes (functionality) - Fix fakeSSH check breaking SSH copies with `user@host` format (NixOS/nix#14150) - Fix `builtins.dirOf` regression from Nix 2.23 (NixOS/nix#14515) - Restore missing `isAllowed` check in `ChrootLinuxDerivationBuilder` (NixOS/nix#14531) - Fix curl with c-ares failing to resolve DNS in sandbox on macOS (NixOS/nix#14792) - Fix tarball percent decoding for `file://` URIs (NixOS/nix#14729) - `exportReferencesGraph`: Handle heterogeneous arrays (NixOS/nix#13861) - Fix filesystem ops in store optimization (NixOS/nix#14676) ## Bug fixes (output) - Fix double-quoting of paths in logs (NixOS/nix#14210) - Include path in world-writable error messages (NixOS/nix#14785) ## Improvements - Better git refnames validation (NixOS/nix#14253) - Use pure/restricted eval for help pages (NixOS/nix#14156) - Improve store-reference compatibility with IPv6 ZoneId literals (NixOS/nix#14134) - Correct `build-dir` error in manual (NixOS/nix#14745) ## Build system - Add mdbook 0.5 support (NixOS/nix#14690) - Drop legacy Apple SDK pattern (NixOS/nix#13976) https://github.com/NixOS/nix/releases/tag/2.31.3
Changelog of fixes: ## Bug fixes (crashes) - Fix segfaults from `toView()` when compiled with newer nixpkgs (NixOS/nix#14154) - Fix use-after-move in `DerivationGoal::repairClosure` and `SampleStack` (NixOS/nix#14086) - Fix assertion failure on partially valid derivation outputs (NixOS/nix#14137) - Fix `RestrictedStore::addDependency` recursion causing crashes (NixOS/nix#14729) - Fix crash on flakerefs containing newlines (NixOS/nix#14450) ## Bug fixes (functionality) - Fix fakeSSH check breaking SSH copies with `user@host` format (NixOS/nix#14150) - Fix `builtins.dirOf` regression from Nix 2.23 (NixOS/nix#14515) - Restore missing `isAllowed` check in `ChrootLinuxDerivationBuilder` (NixOS/nix#14531) - Fix curl with c-ares failing to resolve DNS in sandbox on macOS (NixOS/nix#14792) - Fix tarball percent decoding for `file://` URIs (NixOS/nix#14729) - `exportReferencesGraph`: Handle heterogeneous arrays (NixOS/nix#13861) - Fix filesystem ops in store optimization (NixOS/nix#14676) ## Bug fixes (output) - Fix double-quoting of paths in logs (NixOS/nix#14210) - Include path in world-writable error messages (NixOS/nix#14785) ## Improvements - Better git refnames validation (NixOS/nix#14253) - Use pure/restricted eval for help pages (NixOS/nix#14156) - Improve store-reference compatibility with IPv6 ZoneId literals (NixOS/nix#14134) - Correct `build-dir` error in manual (NixOS/nix#14745) ## Build system - Add mdbook 0.5 support (NixOS/nix#14690) - Drop legacy Apple SDK pattern (NixOS/nix#13976) https://github.com/NixOS/nix/releases/tag/2.31.3
Changelog of fixes: ## Bug fixes (crashes) - Fix segfaults from `toView()` when compiled with newer nixpkgs (NixOS/nix#14154) - Fix use-after-move in `DerivationGoal::repairClosure` and `SampleStack` (NixOS/nix#14086) - Fix assertion failure on partially valid derivation outputs (NixOS/nix#14137) - Fix `RestrictedStore::addDependency` recursion causing crashes (NixOS/nix#14729) - Fix crash on flakerefs containing newlines (NixOS/nix#14450) ## Bug fixes (functionality) - Fix fakeSSH check breaking SSH copies with `user@host` format (NixOS/nix#14150) - Fix `builtins.dirOf` regression from Nix 2.23 (NixOS/nix#14515) - Restore missing `isAllowed` check in `ChrootLinuxDerivationBuilder` (NixOS/nix#14531) - Fix curl with c-ares failing to resolve DNS in sandbox on macOS (NixOS/nix#14792) - Fix tarball percent decoding for `file://` URIs (NixOS/nix#14729) - `exportReferencesGraph`: Handle heterogeneous arrays (NixOS/nix#13861) - Fix filesystem ops in store optimization (NixOS/nix#14676) ## Bug fixes (output) - Fix double-quoting of paths in logs (NixOS/nix#14210) - Include path in world-writable error messages (NixOS/nix#14785) ## Improvements - Better git refnames validation (NixOS/nix#14253) - Use pure/restricted eval for help pages (NixOS/nix#14156) - Improve store-reference compatibility with IPv6 ZoneId literals (NixOS/nix#14134) - Correct `build-dir` error in manual (NixOS/nix#14745) ## Build system - Add mdbook 0.5 support (NixOS/nix#14690) - Drop legacy Apple SDK pattern (NixOS/nix#13976) https://github.com/NixOS/nix/releases/tag/2.31.3
Motivation
Fixes #14513 and adds tests. A lot of
builtins.dirOfbehavior on strings is cursed, but there's no changing that now. Best we can do is stay bug-for-bug compatible with prior nix versions. This should get backported as far as possible.Context
The first commit adds tests but doesn't change the regressed behavior. The second fixes it and updates the test.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.