forked from lix-project/lix
Fix performance of builtins.substring for empty substrings
(cherry picked from commit b2deff1947c2fe57fdbf1a472eb9003eb407f8d3)
Change-Id: I4ddfc8d26a4781c9520fff9807849a073ee7bed8
12 lines
270 B
Nix
12 lines
270 B
Nix
with builtins;
|
|
|
|
let
|
|
|
|
s = "${builtins.derivation { name = "test"; builder = "/bin/sh"; system = "x86_64-linux"; }}";
|
|
|
|
in
|
|
|
|
if getContext s == getContext "${substring 0 0 s + unsafeDiscardStringContext s}"
|
|
then "okay"
|
|
else throw "empty substring should preserve context"
|