ntang (ntang) wrote,

  • Mood:

Holy shit, batman

gnu vi/bash are fucked up and buggy, check this crap out.

As root:

cd /tmp
mkdir foo; cd foo
mkdir bar; cd bar
cat "this is a test" > foo.txt
chown [your username] foo.txt
chmod go-rwx ../bar
chmod go-rwx ../../foo
su [your username]
vi foo.txt

what happens? No, not permission denied, as it should do. It says "new file". Why? strace it. The stupid program CHANGES INTO YOUR HOME DIRECTORY without warning and does it in there. HELLO?!

The proper response: "permission denied".

To elaborate: as user [you], you have rw access to foo.txt. However, the directory it's in (/tmp/foo/bar), and its parent directory (/tmp/foo) you have neither read nor execute permissions for. So you can't actually change directories to get to that file or take a directory listing to see it. But because you su'd without the dash, it leaves you in the directory you have no access to. A sun box will correctly tell you "permission denied". A linux box (the ones I've tested anyway) will silently change directory into your home directory when you try to vi the file, but only for vi. So vi will be operating out of your home directory while your pwd is still /tmp/foo/bar. That is SO STUPID.

  • Where I am nowadays

    I haven't updated this in a million years... in case you're wondering why, it's because I've mostly moved on to other places. You can find my…

  • DSL

    I've been a loyal Megapath customer for years. (Something like 8 or 10, crazy, in that range...) They've had great service (and a great service -…

  • MySQL failover

    So we're running some MySQL at work, which is a little unusual for us, but is probably long overdue. (Specifically, it's for some Wordpress…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment