Fashionable, but unable to tell fact from fiction (testing4l) wrote,
Fashionable, but unable to tell fact from fiction
testing4l

Well -- I know you're all dying to hear about my April Fool's day prank. I've only had two reports of it -- which is a shame. I was really rather proud of it.

The easiest way to go about this is to explain what the effect was:

boogeyman tmp # mkdir /tmp/a
boogeyman tmp # cd a
boogeyman a # touch b c d


So there's a directory with 3 files in it. If we do an ls of one of them -- we should see it.

boogeyman a # /tmp/april/ls b
boogeyman a # /tmp/april/ls b
b


...What? Let's try that again!

boogeyman a # /tmp/april/ls b
boogeyman a # /tmp/april/ls b
b


Ok -- what the heck is up with ls!?!?!?

boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
boogeyman a # /tmp/april/ls 
b  c  d
boogeyman a #


So in essence, you try to run your command and sometimes it works, sometimes it doesn't. relsqui went for it -- her screen commands stopped working. One user (nova20) said "Geez, do I have to ask the Magic 8-Ball if I can run my command?!??!"

Well -- after a fashion, you do!

#!/bin/sh

let blah=$RANDOM%2
export PATH="$(echo $PATH | /bin/sed 's/[/]tmp[/]april[/][:]//g')"
if [ $blah -eq 0 ]; then
   PROG="$(echo $0 | /bin/sed 's/[^/]*[/]//g')"
   exec $PROG $@
   exit
else
   echo -n
fi


In essence, take a random number. If it's even, run the command properly. If it's odd, do nothing.

This was perpetrated by tucking /tmp/april into $PATH in /etc/profile, making hard links to the script for every executable in $PATH in /tmp/april, and waiting. 8)
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment