Hallo!
Ich habe einen ZIEMLICH seltsamen Bug im Betriebssystem gefunden.
Und zwar werden Programme gekillt, wenn sie auf .app enden.
ABER NICHT, wenn es symlinks sind.
Zur Illustration habe ich dort unten ein Shellscript geschrieben.
Wenn irgendwer von Euch dumm^H^H^H^Hmutig genug waere das auszufuehren, waere ich ihm/ihr sehr dankbar.
Wenn ihr auch ganz viel "Killed:9" auf der Konsole seht, heisst es, dass der Bug bei Euch auch auftritt.
Thomas
Ich habe einen ZIEMLICH seltsamen Bug im Betriebssystem gefunden.
Und zwar werden Programme gekillt, wenn sie auf .app enden.
ABER NICHT, wenn es symlinks sind.
Zur Illustration habe ich dort unten ein Shellscript geschrieben.
Wenn irgendwer von Euch dumm^H^H^H^Hmutig genug waere das auszufuehren, waere ich ihm/ihr sehr dankbar.
Wenn ihr auch ganz viel "Killed:9" auf der Konsole seht, heisst es, dass der Bug bei Euch auch auftritt.
Code:
#/bin/zsh
echo "
Hello!
Thank you for taking a look at this problem.
So, to trigger it, you need to
1. open a new terminal window
2. copy and paste the code below into the new window
3. press CTRL+D in that window
4. press CTRL+D in this window
"
echo "-----------------------------[OPEN A NEW TERMINAL WINDOW, COPY THIS TEXT]---"
echo "cd "`pwd`
echo "cat >one.app
#!/bin/zsh
echo works
"
echo "---[DO NOT FORGET THE LAST LINE, AND TO PRESS CTRL+D IN THE OTHER WINDOW]---"
cat >/dev/null
echo "You just created a script, and the name of the script ends with '.app'"
echo "Now, calling this script causes it to be killed IMMEDIATELY!"
chmod 755 one.app
echo "calling one.app"
./one.app
echo
echo "See? And now look what happens when somebody copies it, and changes the"
echo "name so that it ends in two.exe"
cp one.app two.exe
echo "calling two.exe"
./two.exe
echo
echo "So, one.app and two.exe are IDENTICAL, yet, the OS treats them differently."
echo "Seems strange? Wait till you see what happens with Hard Links!"
ln two.exe three.app
echo "calling three.app"
./three.app
echo
echo "And now this"
cp three.app four.exe
./four.exe
ln one.app five.exe
./five.exe
cp five.exe six.app
./six.app
echo
echo "Neat, huh?"
echo "I will erase the .app and .exe files now, so you can run this script again"
rm one.app two.exe three.app four.exe five.exe six.app
echo "I am currently running Darwin 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64"
echo "It is not a problem of the shell script, it also happens with exectuables"
echo "which I compiled with gcc. So there is something else happening!"
echo
echo "Enjoy finding the bug! Personally, I think it is the best part of my job"
Thomas