- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
lol.. $perms are cool
Admin
Sigh, it's "chmod 777 article".
But this is the DailyWTF, so what's a few more WTFs in the comments...
Admin
<flamebait>TRWTF is you</flamebait>. The bits above 0777 are 04000 (setuid), 02000 (setgid) and 01000 (sticky). Above that there are values for determining whether the inode you've stat()ed is a file, directory, symlink, char dev, block dev, fifo etc.
$mode & 0777 is perfectly legitimate in certain situations.
Admin
So what happens is that the .* gobbles up the whole input, which means it can't match the remaining 9 characters. So it will backtrack 1 character 9 times, after which it can succeed.
But of course I agree about using -r.
Admin
Admin
and $permsbin lol one step before the $permbank
Admin
By definition, any problem that can be solved with a regular expression (and only a regexp), isn't interesting.
Admin
By definition, you suck.
/hate it when people use "by definition". //Unless it is, y'know...actually by definition.
Admin
so $perms from the -r $path ends up in the $permsbin...
Sounds like some really messy coding!!!
Admin
What irritates me is the fact that I didn't even notice this until I'd seen 2 or 3 people post about the joke. :/ Damn my "$"-heavy programming language background!
Admin
Admin
'cause I often stumble over code like this (and no, I didnt change indenting):
in the code my predecessor left me. And yes, the code that reads the permissions is .. interesting.
Admin
You got me with this one, I literally "LOL"ed. Thanks for this comment.
Admin
Admin
$permsbin...i can't begin to imagine...
Admin
I read it as a pun on the word regular. Try eating breakfast in the morning. It may improve your mood throughout the day.
Admin
lol yeah. but see, it's wrong. It says my $perms = stat($path);
when in the REAL world
MY $perms = splat($face);
Admin
Xenis was first released in 1980, while MS-DOS came out in 1981. That's not exactly a long span.
Says the 'pedia:
Finally...
Reference or it didn't happen.
Admin
Admin
Dno if you realize this, but 7 = "it's a dir!" and 6 means rwx ....
Admin
...and $permsbin...thehehee...
Admin
As always, this site reminds me that no matter how shitty of a programmer I think I am, there are plenty of worse examples out there.
Admin
And what was wrong with
if (-r $file) {
This is readable
... }
or even
open FILE, "$file" or print "Can't open $file: $!\n";
Admin
God, the programmer in me is way too serious. It took me two read-throughs to read that as intended. I first read it as simply "perms". XD
Admin
Um, no.
Seriously, was that what the "RWTF" guy on the first comment page was complaining about with "$perms->mode & 0777"? I thought it was some arcana related to octal or that Perl's "&" doesn't work the same way as C's. If he was just retarded, that makes his comment a lot less intriguing.
Admin
Um, you got it backwards. Owner read is 0400, group is 0040, and world is 0004.
Admin
False. Windows uses ACLs to determine executable permission. Right click on an executable. Select Properties. Select the Security tab. See the check boxes marked "read and execute".
Admin
Gives new meaning to "sticky bit"...
Admin
NOT the one you take home to Mom!
Admin
Of course, either of the methods mentioned give "is this file readable for anyone." The simple chunk:
... gives "is this file readable for me"...
Admin
LOL $perms Why is that so funny
Wait I know
Admin
bleh it even haz this:
$permsbin =~
Admin
Actually, it's chmod 777 article. You guys always get the parameter order wrong.