Live data from Hacker News

Chmod -x chmod

slideshare.net

21–30 of 34 posts

Re: Chmod -x chmod

#21

This is neat but it sort of seems kind of trivial to solve. I guess it's interesting to see the different possibilities but if you are allowed to write some kind of program then it's just totally trivial.

Don't know why you were downvoted, the whole chmod "problem" is a storm in a teacup.

I'm surprised nobody commented on the last guy's reply (no problem had occurred yet). Apparently all were busy watching the sky fall.

Re: Chmod -x chmod

#22
post #3

It might be an interesting topic, but wouldn't it be better if reformatted into a single page of text (there's what, 300 words there?) rather than 49 slides?

Quite possibly - the original was a lightning talk delivered at YAPC::EU in Pisa this year - so while a single page of text would probably be a better idea for you as a reader, the original format worked very well live.

Imagine the presenter going through these one at a time with descriptions and appropriate pauses so people go "oh my god he's not going to ... he is!" and an audience of a couple hundred perl hackers laughing their collected asses off at each slide to approximate the original effect.

If anybody does collect it into a single page version, please do tell cog - I'm hoping that the video will eventually go up onto http://presentingperl.org/ along with all the others, and I'll make sure it gets linked with a thank you :)

Re: Chmod -x chmod

#23
post #10

The simplest way I could figure out was: cp sh chmod.new cp chmod chmod.new

My first thought was, just re-implement it in C, then I remembered than we do have a bunch of boxes without a compiler on.

Re: Chmod -x chmod

#24
post #18
post #13

Earlier quoted context omitted.

IMO the simplest way is: $ /lib/ld-linux-x86-64.so.2 /bin/chmod +x /bin/chmod ELF files run by manually launching the dynamic loader don't require the executable bit.

The parent seems simpler. More importantly, it works on just about any Unix.

Couldn't you just set an appropriate umask and then make a copy of chmod?

Re: Chmod -x chmod

#25
post #18

Earlier quoted context omitted.

The parent seems simpler. More importantly, it works on just about any Unix.

Couldn't you just set an appropriate umask and then make a copy of chmod?

I don't think umask setting affects the executable bits of files, just directories. You can try by entering something like

  umask 0; touch foo; ls -l foo

Re: Chmod -x chmod

#27
post #4

Earlier quoted context omitted.

People seem to be more and more fixated on the "one thing per rapidly changing slide" style of presentation nowadays. I can certainly see the advantages of having only one thing in your audience's mind at a time as you blab--they're more focused, and the rapidly changing slides fits better with modern attention spans. But it definitely kills the utility of the slides on their own. For an even more difficult to follow…

Looks like it was Lawrence Lessig who first brought the method into our community (technically inclined content aficionados) with his lectures.

I would blame/credit audrey tang, pugs and the lambdacamels for popularizing the takahashi method[0] (notable difference from lessig's style is the lack of non-text content).

My feeling about this is mostly anecdotical, but during the days of crazy pugs development a massive number of hackers from different communities was exposed to what was happening, tools designed for building such presentations bloomed, and, well, after that time I've seen a lot more of those :)

[0] http://en.wikipedia.org/wiki/Takahashi_method

Re: Chmod -x chmod

#28
post #19
post #16

Earlier quoted context omitted.

I agree that this is easiest, and I'm surprised that the article calls it "hardcore" (slides 38-39). But it does bring to mind a more devious challenge: Someone ran "chmod -x ld.so"...

What about: find / -type f -perm +x | xargs chmod -x EDIT: chmod has to be the last program to be chmodded, in the above list.. :-)

Your use of xargs can lead to nasty surprises because of the separator problem http://en.wikipedia.org/wiki/Xargs#The_separator_problem

GNU Parallel http://www.gnu.org/software/parallel/ does not have that problem.

Watch the intro video for GNU Parallel: http://www.youtube.com/watch?v=OpaiGYxkSuQ

Re: Chmod -x chmod

#30
I'm stupid, I guess. I saw the last slide ("there is no problem as the system is still running" (and chmod can therefore still be executed)) and thought that was the solution.

Once again I've learned that for every problem there is a solution that is clear, simple and wrong (and that I myself am quite likely to hit upon this solution).

If you try it, you'll find that it doesn't, in fact, work. Apparently the shell performs a lookup of the access rights of the program you're trying to execute, meaning once you've done "chmod -x chmod", you really have created yourself a problem.

I'd now say the solution is something like this:

cp -pr /bin/chown /bin/chown.safe

cp /bin/chmod /bin/chown

chown 755/bin/chmod

cp /bin/chown.safe /bin/chown

[edit: formatting]

Post reply on HN