Figure out what circumstances lead to nix~case~hack~1 getting into a NAR #726

Closed
opened 2025-03-11 22:45:14 +00:00 by jade · 11 comments
Owner
error: NAR contains invalid file name 'pod~nix~case~hack~1'
error: builder for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' failed with exit code 1

I was building a NixOS configuration on macOS at work with this command:

nix build -L --builders @$HOME/.config/nix/machines .#nixosConfigurations.redacted.config.system.build.toplevel

It reproduces with the following command from a Mac once you do have that drv file on your machine (and the package exists on cache.nixos.org):

nb --max-jobs 0 --builders @$HOME/.config/nix/machines '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' --debug

Salient debug output:

building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: trying to build
locking path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env'
lock acquired on '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env.lock'
removing invalid path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env'
starting build hook '/nix/store/jwlpchd4c701hrkqlinhcbsixwh861nh-lix-2.93.0-dev-pre20250311-a60a362/bin/nix __build-remote'
got 2 remote builders
considering building on remote machine 'ssh-ng://nix-remote-build@thinnix'
considering building on remote machine 'ssh-ng://nix-remote-build@nucury'
connecting to 'ssh-ng://nix-remote-build@nucury'...
Running 'ssh' '-O' 'check' 'nix-remote-build@nucury' '-i' '/Users/jade/.ssh/id_remotebuild' '-oPermitLocalCommand=yes' '-oLocalCo
mmand=echo started'
hook reply is 'accept'
building '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' on 'ssh-ng://nix-remote-build@nucury'...
waiting for the upload lock to 'ssh-ng://nix-remote-build@nucury'...
copying dependencies to 'ssh-ng://nix-remote-build@nucury'...
copying 0 paths...
copying outputs from 'ssh-ng://nix-remote-build@nucury'...
copying 1 paths...
copying path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env' from 'ssh-ng://nix-remote-build@nucury'...
acquired write lock on '/nix/var/nix/temproots/12302'
case collision between 'Pod' and 'pod'
killing process 12304
error: NAR contains invalid file name 'pod~nix~case~hack~1'
building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: build done
killing process 12302
builder process for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' finished
lock released on '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env.lock'
building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: done
building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: goal destroyed
error: builder for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' failed with exit code 1

I am wondering if use-case-hack got sent to the remote which then generated a garbage NAR???! I have no god damn idea.

Remote is 2.93.0-dev-pre20250228-99bc686, local is 2.93.0-dev-pre20250311-a60a362.

Package contents:

nucury$ tree /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env
/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env
├── bin
│   ├── corelist
SNIP
│   └── zipdetails
├── lib
│   └── perl5
│       ├── 5.40.0
│       │   ├── AnyDBM_File.pm -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/AnyDBM_File.pm
SNIP

HERE

│       │   ├── pod -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/pod
│       │   ├── Pod -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/Pod
``` error: NAR contains invalid file name 'pod~nix~case~hack~1' error: builder for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' failed with exit code 1 ``` I was building a NixOS configuration on macOS at work with this command: ``` nix build -L --builders @$HOME/.config/nix/machines .#nixosConfigurations.redacted.config.system.build.toplevel ``` It reproduces with the following command from a Mac once you do have that drv file on your machine (and the package exists on cache.nixos.org): ``` nb --max-jobs 0 --builders @$HOME/.config/nix/machines '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' --debug ``` Salient debug output: ``` building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: trying to build locking path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env' lock acquired on '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env.lock' removing invalid path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env' starting build hook '/nix/store/jwlpchd4c701hrkqlinhcbsixwh861nh-lix-2.93.0-dev-pre20250311-a60a362/bin/nix __build-remote' got 2 remote builders considering building on remote machine 'ssh-ng://nix-remote-build@thinnix' considering building on remote machine 'ssh-ng://nix-remote-build@nucury' connecting to 'ssh-ng://nix-remote-build@nucury'... Running 'ssh' '-O' 'check' 'nix-remote-build@nucury' '-i' '/Users/jade/.ssh/id_remotebuild' '-oPermitLocalCommand=yes' '-oLocalCo mmand=echo started' hook reply is 'accept' building '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' on 'ssh-ng://nix-remote-build@nucury'... waiting for the upload lock to 'ssh-ng://nix-remote-build@nucury'... copying dependencies to 'ssh-ng://nix-remote-build@nucury'... copying 0 paths... copying outputs from 'ssh-ng://nix-remote-build@nucury'... copying 1 paths... copying path '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env' from 'ssh-ng://nix-remote-build@nucury'... acquired write lock on '/nix/var/nix/temproots/12302' case collision between 'Pod' and 'pod' killing process 12304 error: NAR contains invalid file name 'pod~nix~case~hack~1' building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: build done killing process 12302 builder process for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' finished lock released on '/nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env.lock' building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: done building of '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv^*' from .drv file: goal destroyed error: builder for '/nix/store/vwy0kr2da1q0g0f31ry2v14wdrlshyi4-perl-5.40.0-env.drv' failed with exit code 1 ``` I am wondering if `use-case-hack` got sent to the remote which then generated a garbage NAR???! I have no god damn idea. Remote is 2.93.0-dev-pre20250228-99bc686, local is 2.93.0-dev-pre20250311-a60a362. Package contents: ``` nucury$ tree /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env ├── bin │   ├── corelist SNIP │   └── zipdetails ├── lib │   └── perl5 │   ├── 5.40.0 │   │   ├── AnyDBM_File.pm -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/AnyDBM_File.pm SNIP HERE │   │   ├── pod -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/pod │   │   ├── Pod -> /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0/lib/perl5/5.40.0/Pod ```
Author
Owner

Okay I have verified on remote:

nix-store --use-case-hack --export /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env > foo

does NOT contain any case hacks.

Okay I have verified on remote: ``` nix-store --use-case-hack --export /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env > foo ``` does NOT contain any case hacks.
Author
Owner

Hypothesis: somehow the case hacked filename ban applies too late?

Hypothesis: somehow the case hacked filename ban applies too late?
Author
Owner

Shorter reproducer:

nix copy --from ssh-ng://linux-box /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env --to $PWD/store
Shorter reproducer: ``` nix copy --from ssh-ng://linux-box /nix/store/jw8wr2cdqmnwrgk7kfa46w8mmrn94qyq-perl-5.40.0-env --to $PWD/store ```
Author
Owner

Okay, the case hack is being applied locally, but why is it getting into a NAR?

Stack trace at the debug("case collision between '%1%' and '%2%'", i->first, name);:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 7.1
  * frame #0: 0x0000000100d3c9dc liblixutil.dylib`nix::nar::(anonymous namespace)::Parser::parse(this=<unavailable>, completed=<unavailabl
e>)::'lambda'(bool&)::operator()(bool&) const at archive.cc:459:29 [opt]
    frame #1: 0x0000000100d3e6ec liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni
x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc
ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace):
:Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>)
 [inlined] std::__1::coroutine_handle<void>::resume[abi:v160006](this=0x000000012c805c50) const at coroutine_handle.h:79:9 [opt]
    frame #2: 0x0000000100d3e6dc liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni
x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc
ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace):
:Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>)
 at generator.hh:151:27 [opt]
    frame #3: 0x0000000100d3e6d4 liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni
x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc
ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace):
:Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>)
 [inlined] nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char
, std::__1::char_traits<char>, std::__1::allocator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser
::FileHeader, nix::nar::(anonymous namespace)::Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous n
amespace)::Parser::WantBytes>, void>>>, void>::next(this=0x000000012c805c50) at generator.hh:267:21 [opt]
    frame #4: 0x0000000100d3e6d4 liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(this=<unavailable>, stream=nix::nar
::(anonymous namespace)::Parser::Directory::Stream @ 0x000000012c805f10) at archive.cc:541:32 [opt]
    frame #5: 0x0000000100d36cfc liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) [inlined] std::__1::coroutine_handle<void>::resume[
abi:v160006](this=0x000000012c805dd0) const at coroutine_handle.h:79:9 [opt]
    frame #6: 0x0000000100d36cec liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) at generator.hh:151:27 [opt]
    frame #7: 0x0000000100d36ce4 liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) [inlined] nix::Generator<std::__1::pair<std::__1::b
asic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::variant<nix::nar::File, nix::nar::Symlink, nix
::nar::Directory>>, void>::next(this=0x000000012c805dd0) at generator.hh:267:21 [opt]
    frame #8: 0x0000000100d36ce4 liblixutil.dylib`nix::dumpSingle(d=Directory @ 0x0000600002ed8390) at archive.cc:88:32 [opt]
    frame #9: 0x00000001018139cc liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) [inlined] std::__1::coroutine_handle<v
oid>::resume[abi:v160006](this=0x0000600001fce8f0) const at coroutine_handle.h:79:9 [opt]
    frame #10: 0x00000001018139bc liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) at generator.hh:151:27 [opt]
    frame #11: 0x00000001018139b4 liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) [inlined] nix::Generator<std::__1::sp
an<char const, 18446744073709551615ul>, void>::next(this=<unavailable>) at generator.hh:267:21 [opt]
    frame #12: 0x00000001018139b4 liblixstore.dylib`nix::GeneratorSource::read(this=0x0000600001fce8e0, data="", len=8) at serialise.hh:33
7:31 [opt]
    frame #13: 0x0000000100d590c4 liblixutil.dylib`nix::AsyncSourceInputStream::read(this=0x00006000011fecc0, buffer=0x0000600001fd40f0, s
ize=8) at async-io.cc:28:30 [opt]
    frame #14: 0x0000000101a444c0 liblixstore.dylib`nix::(anonymous namespace)::CopyPathStream::read(this=0x00006000032d72f0, data=<unavai
lable>, len=<unavailable>) at store-api.cc:1108:23 [opt]
    frame #15: 0x0000000100d59494 liblixutil.dylib`nix::AsyncTeeInputStream::read(this=0x000000012d00fc98, buffer=0x0000600001fd40f0, size
=<unavailable>) at async-io.cc:50:16 [opt]
    frame #16: 0x0000000100d318cc liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::read(this=<unavailable>, buffer="", n=8) 
at archive.cc:684:24 [opt]
    frame #17: 0x0000000100d40664 liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::parse(nix::Generator<std::__1::variant<ni
x::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace)::Parser::Symlink, nix::nar::(anonymous namespace)::Pars
er::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>&, nix::NARParseVisitor&, std::__1::basic_string<char, std::__1::
char_traits<char>, std::__1::allocator<char>> const&) [inlined] nix::nar::(anonymous namespace)::AsyncParser::feed(this=0x000000012d0101d0
, n=8) at archive.cc:700:16 [opt]
    frame #18: 0x0000000100d40634 liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::parse(this=<unavailable>, stream=<unavail
able>, target=<unavailable>, name=<unavailable>) at archive.cc:726:25 [opt]
Okay, the case hack is being applied locally, but why is it getting *into* a NAR? Stack trace at the `debug("case collision between '%1%' and '%2%'", i->first, name);`: ``` (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 7.1 * frame #0: 0x0000000100d3c9dc liblixutil.dylib`nix::nar::(anonymous namespace)::Parser::parse(this=<unavailable>, completed=<unavailabl e>)::'lambda'(bool&)::operator()(bool&) const at archive.cc:459:29 [opt] frame #1: 0x0000000100d3e6ec liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace): :Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>) [inlined] std::__1::coroutine_handle<void>::resume[abi:v160006](this=0x000000012c805c50) const at coroutine_handle.h:79:9 [opt] frame #2: 0x0000000100d3e6dc liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace): :Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>) at generator.hh:151:27 [opt] frame #3: 0x0000000100d3e6d4 liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(nix::Generator<std::__1::variant<ni x::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc ator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace): :Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>>>, void>) [inlined] nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser::WantBytes, std::__1::pair<std::__1::basic_string<char , std::__1::char_traits<char>, std::__1::allocator<char>> const&, nix::Generator<std::__1::variant<nix::nar::(anonymous namespace)::Parser ::FileHeader, nix::nar::(anonymous namespace)::Parser::Symlink, nix::nar::(anonymous namespace)::Parser::Directory, nix::nar::(anonymous n amespace)::Parser::WantBytes>, void>>>, void>::next(this=0x000000012c805c50) at generator.hh:267:21 [opt] frame #4: 0x0000000100d3e6d4 liblixutil.dylib`nix::nar::(anonymous namespace)::SyncParser::readDir(this=<unavailable>, stream=nix::nar ::(anonymous namespace)::Parser::Directory::Stream @ 0x000000012c805f10) at archive.cc:541:32 [opt] frame #5: 0x0000000100d36cfc liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) [inlined] std::__1::coroutine_handle<void>::resume[ abi:v160006](this=0x000000012c805dd0) const at coroutine_handle.h:79:9 [opt] frame #6: 0x0000000100d36cec liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) at generator.hh:151:27 [opt] frame #7: 0x0000000100d36ce4 liblixutil.dylib`nix::dumpSingle(nix::nar::Directory) [inlined] nix::Generator<std::__1::pair<std::__1::b asic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::variant<nix::nar::File, nix::nar::Symlink, nix ::nar::Directory>>, void>::next(this=0x000000012c805dd0) at generator.hh:267:21 [opt] frame #8: 0x0000000100d36ce4 liblixutil.dylib`nix::dumpSingle(d=Directory @ 0x0000600002ed8390) at archive.cc:88:32 [opt] frame #9: 0x00000001018139cc liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) [inlined] std::__1::coroutine_handle<v oid>::resume[abi:v160006](this=0x0000600001fce8f0) const at coroutine_handle.h:79:9 [opt] frame #10: 0x00000001018139bc liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) at generator.hh:151:27 [opt] frame #11: 0x00000001018139b4 liblixstore.dylib`nix::GeneratorSource::read(char*, unsigned long) [inlined] nix::Generator<std::__1::sp an<char const, 18446744073709551615ul>, void>::next(this=<unavailable>) at generator.hh:267:21 [opt] frame #12: 0x00000001018139b4 liblixstore.dylib`nix::GeneratorSource::read(this=0x0000600001fce8e0, data="", len=8) at serialise.hh:33 7:31 [opt] frame #13: 0x0000000100d590c4 liblixutil.dylib`nix::AsyncSourceInputStream::read(this=0x00006000011fecc0, buffer=0x0000600001fd40f0, s ize=8) at async-io.cc:28:30 [opt] frame #14: 0x0000000101a444c0 liblixstore.dylib`nix::(anonymous namespace)::CopyPathStream::read(this=0x00006000032d72f0, data=<unavai lable>, len=<unavailable>) at store-api.cc:1108:23 [opt] frame #15: 0x0000000100d59494 liblixutil.dylib`nix::AsyncTeeInputStream::read(this=0x000000012d00fc98, buffer=0x0000600001fd40f0, size =<unavailable>) at async-io.cc:50:16 [opt] frame #16: 0x0000000100d318cc liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::read(this=<unavailable>, buffer="", n=8) at archive.cc:684:24 [opt] frame #17: 0x0000000100d40664 liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::parse(nix::Generator<std::__1::variant<ni x::nar::(anonymous namespace)::Parser::FileHeader, nix::nar::(anonymous namespace)::Parser::Symlink, nix::nar::(anonymous namespace)::Pars er::Directory, nix::nar::(anonymous namespace)::Parser::WantBytes>, void>&, nix::NARParseVisitor&, std::__1::basic_string<char, std::__1:: char_traits<char>, std::__1::allocator<char>> const&) [inlined] nix::nar::(anonymous namespace)::AsyncParser::feed(this=0x000000012d0101d0 , n=8) at archive.cc:700:16 [opt] frame #18: 0x0000000100d40634 liblixutil.dylib`nix::nar::(anonymous namespace)::AsyncParser::parse(this=<unavailable>, stream=<unavail able>, target=<unavailable>, name=<unavailable>) at archive.cc:726:25 [opt] ```
Author
Owner

CAUGHT IT IN THE ACT:

nix store dump-path --store ssh-ng://linuxbox /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0 > foo.nar
CAUGHT IT IN THE ACT: ``` nix store dump-path --store ssh-ng://linuxbox /nix/store/ygz7vmxcmm3p9md71ck883qdlkfi7c62-perl-5.40.0 > foo.nar ```
Author
Owner

Bug does not repro with --no-use-case-hack on the store dump-path command above. Need to confirm whether that is making it to the remote daemon or what is the deal with that.

Bug does not repro with `--no-use-case-hack` on the `store dump-path` command above. Need to confirm whether that is making it to the remote daemon or what is the deal with that.
Owner

oh, i see what's happening. it's copyNAR, because all copies of nars must parse the nar. and if the thing doing the parsing has case hacking turned on it'll hack the stream

oh, i see what's happening. it's copyNAR, because all copies of nars must parse the nar. and if the thing doing the parsing has case hacking turned on it'll hack the stream
Author
Owner

Okay. It is not related to settings on remote, the corruption is happening on the local machine, not the remote. I confirmed this by patching out the case-hack adding from the local nix. I don't know what lix is doing that leads to the NAR visitor of parsing one NAR being used to construct a NAR, but it is definitely the pattern I put that filename check in to ensure it doesn't happen as defense in depth.

Okay. It is not related to settings on remote, the corruption is happening on the local machine, not the remote. I confirmed this by patching out the case-hack adding from the local `nix`. I don't know what lix is doing that leads to the NAR visitor of parsing one NAR being used to construct a NAR, but it is definitely the pattern I put that filename check in to ensure it doesn't happen as defense in depth.
Owner

Bug does not repro with --no-use-case-hack on the store dump-path command above. Need to confirm whether that is making it to the remote daemon or what is the deal with that.

this is purely local to your machine. the nar lister unhacks files, but the dumper does not, so if the parser hacks a nar stream copyNAR will spit it out all fucked-up-like. check out 45be1e8d66

> Bug does not repro with --no-use-case-hack on the store dump-path command above. Need to confirm whether that is making it to the remote daemon or what is the deal with that. this is purely local to your machine. the nar *lister* unhacks files, but the *dumper* does not, so if the parser hacks a nar stream copyNAR will spit it out all fucked-up-like. check out 45be1e8d668a56c2e2c9b9d6ec47e40d4c97f165
Author
Owner

The design of the case hack setting is so fucking sketchy and definitely made it much easier for this bug to happen; we should hoist it (or maybe move the entire case hacking into the FS visitor). I can work on a CL to move the case hacking code to the FS side to hopefully make this much less likely in the future.

See also: #633

The design of the case hack setting is so fucking sketchy and definitely made it much easier for this bug to happen; we should hoist it (or maybe move the entire case hacking into the FS visitor). I can work on a CL to move the case hacking code to the FS side to hopefully make this much less likely in the future. See also: https://git.lix.systems/lix-project/lix/issues/633
jade self-assigned this 2025-03-12 17:41:59 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2794 ("libstore: move case hacking to the FS interaction code")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2794", "number": 2794, "kind": "commit message"}], "cl_meta": {"2794": {"change_title": "libstore: move case hacking to the FS interaction code"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2794](https://gerrit.lix.systems/c/lix/+/2794) ("libstore: move case hacking to the FS interaction code")
Sign in to join this conversation.
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#726
No description provided.