3 ms·
I'm sure there are reasons for it, but it still sucks. It ought to be possible to use binary caches and still swap out the path. (Modifying a string in an ELF
by foldr 6y ago
I'm sure there are reasons for it, but it still sucks.
It ought to be possible to use binary caches and still swap out the path. (Modifying a string in an ELF executable isn't that hard.)
- bennofs 6y agoModifying a string in ELF is hard. As long as the string has the same length as the original one, it has a good chance to work (but still fails for compressed data). But if you want an arbitrary directory, you need to replace it with a different length path, and that will probably break a lot of things.
- foldr 6y agoIt's not that hard if you leave some spare space for string constants in the .rodata section. Nix already patches ELF executables as things stand.
- takeda 6y agoThe nix author created utility called patchelf which is used by nix all the time during the build (to rewrite library paths). As far as I know it creates a new elf each time it is called (it doesn't modify a file on place) so the length of library name is not an issue.
- ris 6y agoThe problem is how it affects all the hashes, which aren't recalculable in such an easy way.
- foldr 6y agoCould you not check the hashes before doing the substitution?
- catern 6y agoIt's not just ELF executables that hardcode the path. There's a ton of different ways to run software which all use hardcoded paths. Which is good! That's the entire value proposition of Nix, in a way, that it's now safe to use hardcoded paths. But you can't edit all those different hardcoded paths in all those different filetypes.