Skip to content

installing symlinks fail #1402

@teto

Description

@teto

Please fill out the following:

  • Platform: nixos

  • LuaRocks version:

    • luarocks --version 21c84da (master from 6 march)
  • LuaRocks output from when the issue occurred:
    I've added some print statements (and removed the luarocks checks that triggered the error since otherwise the whole folder was removed by nix (and made troubleshooting too hard):

strip is /nix/store/jz10kjr0lnhynwxnrzv4kcwbjs5s0ri8-gcc-wrapper-10.3.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/p33s4fqi35g8akp6divdllngkjxk2lcl-luarocks-3.2.1/bin 
patching script interpreter paths in /nix/store/p33s4fqi35g8akp6divdllngkjxk2lcl-luarocks-3.2.1
checking for references to /build/ in /nix/store/p33s4fqi35g8akp6divdllngkjxk2lcl-luarocks-3.2.1...
building '/nix/store/57105nfkpnfr4xna581y5ddy6bpy3cav-lua5.2-luv-1.43.0-0.drv'...
unpacking sources
unpacking source archive /nix/store/ajf96bi4gp1547gdm0vkdmh609jld5mq-luv
source root is luv
patching sources
configuring
building
installing

luv 1.43.0-0 depends on lua >= 5.1 (5.2-1 provided by VM)
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /nix/store/jz10kjr0lnhynwxnrzv4kcwbjs5s0ri8-gcc-wrapper-10.3.0/bin/gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/jz10kjr0lnhynwxnrzv4kcwbjs5s0ri8-gcc-wrapper-10.3.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at /nix/store/402kzpjg6064dpj0kmdw84hjbxfdzh62-cmake-3.22.2/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (LIBUV) does
  not match the name of the calling package (Libuv).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindLibuv.cmake:33 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:68 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found LIBUV: /nix/store/4w0ysj8wnhryiwvkw7bvfzli4y3daasr-libuv-1.43.0/lib/libuv.so  
-- Lua: using information from luarocks
-- LUA_LIBDIR: /nix/store/445zn4chzyh6fhnybawb1xg292yzcz3j-lua-5.2.4/lib
-- LUA_LIBFILE: liblua.a
-- LUA_INCDIR: /nix/store/445zn4chzyh6fhnybawb1xg292yzcz3j-lua-5.2.4/include
-- LUA: /nix/store/445zn4chzyh6fhnybawb1xg292yzcz3j-lua-5.2.4/bin/lua
-- Lua library: /nix/store/445zn4chzyh6fhnybawb1xg292yzcz3j-lua-5.2.4/lib/liblua.a
-- Configuring done
-- Generating done
-- Build files have been written to: /build/luv/luv-1.43.0-0-rocks/luv/1.43.0-0/lib
[ 50%] Building C object CMakeFiles/libluv.dir/src/luv.c.o
[100%] Linking C shared library libluv.so
[100%] Built target libluv
Consolidate compiler generated dependencies of target libluv
[100%] Built target libluv
Install the project...
-- Install configuration: ""
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1.43.0
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/pkgconfig/libluv.pc
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/include/luv/luv.h
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/include/luv/util.h
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/include/luv/lhandle.h
-- Installing: /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/include/luv/lreq.h
tools.copy
tools.copy
tools.copy
tools.copy
move lib from /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1.43.0 to /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so.1.43.0
tools.copy
move lib from /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1 to /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so.1
tools.copy
cp: cannot stat '/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1': No such file or directory
move lib from /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/pkgconfig/libluv.pc to /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/pkgconfig/libluv.pc
tools.copy
# THIS IS WHERE IT FAILS
move lib from /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so to /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so
tools.copy
cp: cannot stat '/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so': No such file or directory
failed deploying files. The following files were not installed:
/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so.1
/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so
No existing manifest. Attempting to rebuild...
luv 1.43.0-0 is now installed in /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0 (license: Apache 2.0)

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0
shrinking /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so.1.43.0
strip is /nix/store/jz10kjr0lnhynwxnrzv4kcwbjs5s0ri8-gcc-wrapper-10.3.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib 
patching script interpreter paths in /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0
checking for references to /build/ in /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0...
running install tests
no Makefile or custom installCheckPhase, doing nothing
/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0

so luarocks fails at this step move lib from /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1 to /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so.1 but the file exists:

ls -l /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/           
total 0
lrwxrwxrwx 1 root root 11 1970-01-01  libluv.so -> libluv.so.1
lrwxrwxrwx 1 root root 16 1970-01-01  libluv.so.1 -> libluv.so.1.43.0

it is just a symlink that points to a now inexisting file since luarocks moved libluv.so.1 and libluv.so.1.43.0 before. If I run the same command as luarocks, I obtain the same error too:

 cp /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1 /tmp/toto
cp: cannot stat '/nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1': No such file or directory

If I run cp with its -d option (https://askubuntu.com/questions/214562/cannot-transfer-file-due-to-filesystem-does-not-support-symbolic-links-error) then it works.

cp -d /nix/store/lx4gliv2r1r73dv790649rpcjr5s7c65-lua5.2-luv-1.43.0-0/luv-1.43.0-0-rocks/luv/1.43.0-0/lib/libluv.so.1 /tmp/toto

works fine for instance.

I've tried the following patch:

diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua
index d36d407d..87dae12a 100644
--- a/src/luarocks/fs/unix/tools.lua
+++ b/src/luarocks/fs/unix/tools.lua
@@ -57,7 +57,7 @@ end
 -- plus an error message.
 function tools.copy(src, dest, perm)
    assert(src and dest)
-   if fs.execute(vars.CP, src, dest) then
+   if fs.execute(vars.CP, "-d", src, dest) then
       if perm then
          if fs.is_dir(dest) then
             dest = dir.path(dest, dir.base_name(src))

but then I ended up with
> chmod: cannot operate on dangling symlink '/nix/store/1hq6cw4zb1vpx22h054jpwyb9bnbxgak-lua5.2-luv-1.43.0-0/lib/lua/5.2/libluv.so'
I was not sure what to do then hence this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions