Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: raco pkg install can't handle dangling symlinks #101

Open
clacke opened this issue Mar 31, 2018 · 4 comments
Open

Problem: raco pkg install can't handle dangling symlinks #101

clacke opened this issue Mar 31, 2018 · 4 comments

Comments

@clacke
Copy link
Member

clacke commented Mar 31, 2018

$ ln -s asdfasdfasdf nix/asdf
$ make
copy-directory/files: encountered path that is neither file nor directory                   [18/1069]
  path: ./nix/asdf
  context...:
   /nix/store/pv5fnjv97wprb5p913xrcnqyrbb993m1-racket-minimal-6.12/share/racket/collects/racket/file.
rkt:90:21
   /nix/store/pv5fnjv97wprb5p913xrcnqyrbb993m1-racket-minimal-6.12/share/racket/collects/racket/file.
rkt:76:2: loop
   /nix/store/pv5fnjv97wprb5p913xrcnqyrbb993m1-racket-minimal-6.12/share/racket/collects/pkg/private/
stage.rkt:107:0: stage-package/info46
   /nix/store/pv5fnjv97wprb5p913xrcnqyrbb993m1-racket-minimal-6.12/share/racket/collects/pkg/private/
install.rkt:659:4: for-loop

A concrete, non-contrived example would be the result links that nix-build leaves lying around, and which are dangling when in the build sandbox.

Solution: Remove all dangling symlinks in postUnpack.

@sjmackenzie
Copy link
Member

Alternatively one could check using the -L bash feature to check for symlinks.

@clacke
Copy link
Member Author

clacke commented Mar 31, 2018

We need to allow symlinks, people might use those. It's only dangling symlinks that install gets upset about.

To check for dangling symlinks with bash [] or [[]], one would use -e for existence. But it's probably best to outsource the traversing of the directory to find with the right parameters.

@clacke
Copy link
Member Author

clacke commented Mar 31, 2018

This, but replace -print with -delete, should do it:

$ tree
.
├── asdf -> asdffff
├── asdffff
└── qwer -> xzcv
$ find . -type l -exec test '!' -e {} ';' -print
./qwer

@clacke
Copy link
Member Author

clacke commented Mar 31, 2018

Just add a dangling symlink in nix/test/dangling-symlink -> road-to-nowhere to test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants