kisslinux / kiss

KISS Linux - Package Manager
https://kisslinux.github.io
MIT License
464 stars 62 forks source link

pkg_strip messing with installed libs #252

Closed git-bruh closed 3 years ago

git-bruh commented 3 years ago

Description

On rebuilding glibc (not installing), the pkg_strip function seems to make /usr/lib/libdl-2.33.so an empty file, it also breaks other files like libc.so if libdl is made read-only for testing. KISS shouldn't be touching already installed libs, and I'm not sure what is even happening here since KISS is just running strip on the libs (Running strip manually on them doesn't make them empty). I've no idea why this happens with glibc in specific, say i build openssl and don't install it, /usr/lib/libcrypto*.so is left intact. This will ofcourse only happen if the user is building as root. In my case im using a bubblewrap script to rootlessly test in chroots, so the chroot is full rw by regular users.

If i replace the dummy libdl in the package with a real shared library, it is kept intact in the tarball aswell and not made empty.

/tmp/glibc $ ldd /usr/bin/openssl 
/usr/bin/openssl:
linux-vdso.so.1 (0x00007ffc10d80000)
libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f903708b000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f9036d8f000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f9036d8a000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f9036d69000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f9036b88000)
/lib/ld-linux-x86-64.so.2 => /usr/lib/ld-linux-x86-64.so.2 (0x00007f90371e4000)
/tmp/glibc $ openssl 
OpenSSL> exit
/tmp/glibc $ kiss owns /usr/lib/libdl.so.2 
glibc
/tmp/glibc $ sha256sum /usr/lib/libdl.so.2
f52b4e355f591f31fcd96c0ef85d185710b9f240f5cc591d9ed3b911b6d3eb8d  /usr/lib/libdl.so.2
/tmp/glibc $ cat build 
#!/bin/sh -e

: | install -Dm755 /dev/stdin "$1/usr/lib/libdl-2.33.so"
/tmp/glibc $ sh -x /tmp/kiss b > /tmp/log 2>&1 # KISS_PROMPT != 0, pkg is not installed.
^C/tmp/glibc $ openssl
openssl: error while loading shared libraries: /usr/lib/libdl.so.2: file too short
/tmp/glibc $ ????
/tmp/glibc $ sha256sum /usr/lib/libdl-2.33.so 
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  /usr/lib/libdl-2.33.so

� Log https://termbin.com/0yvjh

dylanaraps commented 3 years ago

I have also made these changes: https://github.com/kisslinux/kiss/commit/c22649263ec7e3efeee0db21586fb5f0e8aea5f7

Which will prevent issues like this from occurring again. Let me know if there are still any issues.

dylanaraps commented 3 years ago

Also PS, the log file you sent is with stripping disabled?

git-bruh commented 3 years ago

Thanks, it works fine now. I'm pretty sure stripping was turned on, since the issue only happened when stripping was enabled (KISS_STRIP=0 worked around the issue), I guess there weren't many lines related to stripping in the log since there was nothing to strip in the package, only 1 dummy file.