Forums » Linux

things not to do...

Jan 15, 2005 Spider link
#!/bin/bash
ldd ${1} | awk '{ print $3 }' | grep / - | while read LIB;
do
strip --strip-debug --strip-unneeded ${LIB}
done

other fun things involve using readelf on said binaries and missing a > sign, ending up with a very garbled file containing mostly ^@ (null signs)

As a practice to the forlorn, Do tell why the code above is a bad idea. :-)
Jan 16, 2005 Solra Bizna link
sbizna ~$ sudo scp sbizna@192.168.0.10:/usr/lib/libc.so /usr/lib/libc.so
Password:
sbizna@192.168.0.10's password:
libc.so 100% 204 0.8KB/s 00:00
Four months later I fixed it by reinstalling.
-:sigma.SB
Jan 16, 2005 Spider link
Sorry. won't do
scp is a linked library that links against libc.so, so you can't cp it over becuase scp and cp will not run :)

from a bootcd, sure. but thats cheating ;)
Jan 16, 2005 Solra Bizna link
Actually, it worked up until and immediately after it deleted libc.so to make way for the new file, then when it tried to exec a child process to actually do the copy it... died
-:sigma.SB
Jan 16, 2005 Spider link
Then you didn't clobber libdl.so ;) I did, that immediately kills -all- applications that are running. *cough*
Jan 17, 2005 Solra Bizna link
Heheh...
-:sigma.SB
Jan 18, 2005 a1k0n link
Haha. I remember trying to remotely upgrade libc4 to libc5 years and years ago. That, uh, didn't work.

"Hmm, this seems like kind of a stupid idea..." <presses enter anyway>
...
<enter><enter><enter> ... "ah, crap."
Jan 19, 2005 Spider link
Hehe, didn't do it remote, but locally.. Thought I was clear by installing most apps as static....

Turns out I was wrong in a few occasions. *cough* That wasn't good.
Jan 19, 2005 nihon-jin link
:() { :|: & } ; :

^ this is the funniest bash script i've ever seen in my life. Yet, its still very good to test how good your ulimit settings are. Basically, it will start to fork bash infinitely REALLY fast (thousands of them under a second) until kernel process auto-killer gets some cpu time to kill it all. You just experience some insane lagging (including mouse/keyboard freeze and some time skew) if maximum process per user is a bit high (if it's too high kernel will never get chance to stop this).

Funnier is to run it as root, as this one isn't affected by ulimit. Mouse start to lag, one second after you can't type that killall cuz even the clock has stopped and all you can see are ram/cpu usage @ 100% before your gkrellm/top/gdesklet froze.

don't forget to save your work before trying it out :p So far it always worked, but different kernels (2.4/2.6) have different ways to make decissions to auto-kill not to mention that distributions comes with different ulimits each time.