add PR243 reproducer

This commit is contained in:
Satadru Pramanik
2021-05-20 17:10:38 -04:00
parent 4efbce410d
commit 8f94e116f3
2 changed files with 13 additions and 16 deletions

13
tests/PR243-reproducer.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -ex
# PR243-reproducer.sh
curl -OLf https://github.com/NixOS/patchelf/files/6501509/ld-linux-x86-64.so.2.tar.gz
curl -OLf https://github.com/NixOS/patchelf/files/6501457/repro.tar.gz
tar fx repro.tar.gz
tar fx ld-linux-x86-64.so.2.tar.gz
chmod +x repro
cp repro repro.orig
../src/patchelf --set-interpreter ./ld-linux-x86-64.so.2 ./repro
patchelf --print-interpreter repro.orig
readelf -a repro > /dev/null
./repro

View File

@@ -1,16 +0,0 @@
#!/bin/sh
set -ex
cat << EOF > hello.c
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
EOF
gcc hello.c -o hello -no-pie
interpreter=$(../src/patchelf --print-interpreter ./hello)
cp ./hello ./hello.orig
../src/patchelf --set-interpreter $interpreter ./hello
../src/patchelf --replace-needed libc.so.6 $interpreter ./hello
./hello.orig
./hello