[Nix-dev] nix store: hardlink vs symlink

shea at shealevy.com shea at shealevy.com
Sat Sep 24 17:03:03 CEST 2011


It seems like the problem here is with Python, not nix. Isn't there a way
to set some env var or command line flag to set sys.prefix manually? Then
you can create a wrapper script to call the "real" Python with the right
value. Or patch Python not to follow symlinks like that.

> On Sat, 24 Sep 2011 16:41:07 +0200, Peter Simons <simons at cryp.to> wrote:
>> Hi Florian,
>>
>>  > Why is nix using symlinks to link files in the nix store?
>>  > Would switching to hardlinks break something?
>>
>> why do you think that hardlinks would be preferable?
>
> Two profiles:
> /tmp/cfl/bad: more than one derivation provides ./bin content,
> ./bin/python is a symlink
>
> /tmp/cfl/good1: only python provides ./bin content, ./bin/python is not
> a symlink.
>
> If ./bin/python is a symlink, python will resolve it to find its home
> and set sys.prefix accordingly. It ends with the python derivation being
> the home (bad):
> readlink("/tmp/cfl/bad/bin/python",
> "/nix/store/vzpvrymynp4n93bznxha6hadj0ww68vx-python-2.7.1/bin/python",
> 4096) = 67
> readlink("/nix/store/vzpvrymynp4n93bznxha6hadj0ww68vx-python-2.7.1/bin/python",
> 0x7fff5ec0fa60, 4096) = -1 EINVAL (Invalid argument)
>
>
> If ./bin/python is not a symlink, the profile python is installed to
> becomes the home and therefore sys.prefix (good):
> readlink("/tmp/cfl/good1/bin/python", 0x7fff013ffc10, 4096) = -1 EINVAL
> (Invalid argument)
>
>
> I think the profile should be the home in both cases.
>
> Making ./bin/python (and ./bin/pythonX.Y) a real file would solve the
> problem.
>
>> It is easy to determine where a symlink points to, but it's expensive to
>> determine that for a hardlink. That information is oftentimes relevant,
>> though, i.e. when analyzing run-time dependencies between store paths.
>
> As python links in many more files than only ./bin/python and
> ./bin/pythonX.Y, would it be ok, to not symlink these two files, but
> simply copy them or is there some other nix-conformant way to avoid the
> symlinks for these two files?
>
> --
> Florian Friesdorf <flo at chaoflow.net>
>   GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
> Jabber/XMPP: flo at chaoflow.net
> IRC: chaoflow on freenode,ircnet,blafasel,OFTC
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>




More information about the nix-dev mailing list