twogood / unshield

Tool and library to extract CAB files from InstallShield installers
MIT License
348 stars 75 forks source link

issue with run-tests: failures in older linux distros? #122

Closed wdlkmpx closed 3 years ago

wdlkmpx commented 3 years ago

seeing the build logs of several pull requests, the only part that seems to make a difference is zlib but the compiler might be configured in a different way

# ./rebuild.sh
# ./run-tests.sh 
Running test ./test/v0/the-feeble-files-spanish.sh...succeeded
Running test ./test/v0/baldurs_gate_patch_v1_1_4315_international.sh...succeeded
Running test ./test/v0/avigomanager.sh...succeeded
Running test ./test/v0/wireplay.sh...succeeded
Running test ./test/v5/CVE-2015-1386/CVE-2015-1386.sh...succeeded
wdlkmpx commented 3 years ago

The commands were ran in a clean source tree (git clean -dfx), using the master branch, with a shared library linked to openssl and zlib.

I don't understand why debian stretch is using 1.2.8... I think 1.2.11 was already available back then https://packages.debian.org/stretch/zlib1g

The evidence potentially shows that only the latest stable zlib version should be used, perhaps it should be integrated into unshield for consistency

twogood commented 3 years ago

That is very interesting.

wdlkmpx commented 3 years ago

It's definitely zlib, I locally reimplemented autotools support. I compiled a static zlib 1.2.11 that is linked to a static libunshield

# ./rebuild.sh autotools
# ./run-tests.sh 
Running test ./test/v0/the-feeble-files-spanish.sh...succeeded
Running test ./test/v0/baldurs_gate_patch_v1_1_4315_international.sh...succeeded
Running test ./test/v0/avigomanager.sh...succeeded
Running test ./test/v0/wireplay.sh...succeeded
Running test ./test/v5/CVE-2015-1386/CVE-2015-1386.sh...succeeded

modified rebuild.sh

if test -z "$1" ; then
    export CFLAGS="-Wall -Werror -ggdb3"
    mkdir -p build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX:PATH=/var/tmp/unshield .. && make && make install
else
    # param = autotools
    if test -f zlib/libz.a ; then
        # zlib/libz.a
        # zlib/conf.h
        # zlib/zlib.h
        export ZLIB_LIBS="-L$(pwd)/zlib -lz"
        export ZLIB_CFLAGS="-L$(pwd)/zlib"
    fi
    if ! test -f configure ; then
        ./autogen.sh
    fi
    ./configure --prefix=/var/tmp/unshield --enable-static --disable-shared && \
    make clean && \
    make install
fi
wdlkmpx commented 3 years ago

No, something was wrong. If there is a system libunshield, unshield will load /usr/lib/liblibunshield.so instead of /var/tmp/unshield/lib/liblibunshield.so, this makes some tests fail.

That's why rebuild.sh must create a static libunshield: cmake -DBUILD_STATIC=ON ....

twogood commented 3 years ago

Ahh damn :)

wdlkmpx commented 3 years ago

How to fix this:

rebuild.sh must create a static libunshield: cmake -DBUILD_STATIC=ON ....

This and other random changes I happen to make will be in my repo, it takes too much time to test, explain and 'sell' this stuff. I'm accumulating too many changes, which will require too many branches and PR's, and this will confuse me a lot. stuff can be cherry-picked afterwards.