Jul. 25th, 2007 [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2007-07-25 11:07
rm -F

The build system at work occasionally generates entire directory trees full of files and directories with read-only permissions. Trying to delete such a directory is always a pain, because the procedure goes something like

  • rm -rf directory
  • rm gets EPERM on every file in a read-only subdirectory
  • swear
  • chmod -r +w directory
  • chmod tries to take the r permission away from the nonexistent file +w
  • swear
  • chmod -R +w directory
  • chmod now gets EPERM, because the previous invocation also successfully took the r permission away from directory
  • swear
  • chmod -R +rw directory
  • rm -rf directory

… and since I mostly try to avoid generating these directories in the first place, this happens just infrequently enough that the next time I've forgotten all the pitfalls and do pretty much the same thing again.

What I want is for rm to support the -F option, which is like -f except that it also authorises rm to temporarily restore write permission (if permitted to) on any directory from which the lack of it is preventing it from deleting a file. Or possibly it should only be allowed to do that if the directory is one it's planning to delete completely later in the operation anyway; that might be safer. But either way, the point is, if the Unix permissions system makes it possible in principle to arrange for the directory not to be there any more, then I want to be able to get rm to just do so, by any means necessary short of requesting the root password, and not bother me with trivial details of how.

Link8 comments | Reply
Wed 2007-07-25 14:33
Lignotacty

I've only mentioned it once or twice in this diary, but I've spent the last couple of months gradually trying to buy a house. (Status update, for anyone interested: nothing has gone wrong so far, and we're now at the stage where my solicitor might plausibly phone up any day and ask me for a lot of money in order to exchange contracts.)

During this time I've been almost comically superstitious about trying not to jinx the purchase – taking exaggerated care to refer to the house as ‘the house I'm trying to buy’, using ‘if’ rather than ‘when’ at all times, and looking around ostentatiously for some wood to touch when I slip up. One would be forgiven for thinking that I honestly did believe that as soon as I took the success of the attempt for granted, Murphy would intervene and ensure that it fell through at the last minute. Particularly if one were to spy on me when I was alone and found that I behave much the same way when muttering to myself, and it's not (or at least not solely) for the entertainment of my audience.

But I'm not, of course; however much I play up the superstition, I know perfectly well that my choice of language and whether or not I touch wood has no bearing on the actual odds of a successful house purchase. Nonetheless, I think one of the reasons I keep doing it is because it is serving a purpose, even if not the obvious one.

The purpose it's serving is to prevent me from taking success for granted, not because that has any bearing on the chance of failure, but because it has a significant effect on the cost of failure. As long as I'm pessimistic about the whole business, I'll be reasonably prepared to cope if it does fall through at the last moment; it'll be very annoying and a waste of a lot of time and money and effort, but not an absolutely crushing blow. But if I were to start assuming that the house was definitely going to be mine, make a lot of detailed plans about what I'll do with it, and reorganise the inside of my brain around the premise that only one or two minor formalities separated me from being a homeowner, then if it fell through at the last minute it would be a much bigger blow.

And it's hard not to get my hopes up. Having been thinking about this stuff for months, I'm now constantly aware of all sorts of things that irritate me about the place I'm currently living in (some specific to it, others general consequences of it being a flat or being rented), and I really want to believe that all of those irritations are things I'll only have to put up with for another month or two at most. The desire to give in to wishful thinking and start celebrating, without even noticing, is incredibly strong.

Hence, in self-defence, I've adopted this exaggerated cod-superstitious attitude at all times so that it's become a habit; so now, when my internal monologue on the subject does start to creep towards the wishful, my touch-wood habit kicks in, and in so doing it reminds me to get my thoughts back under control.

(Of course, if I were Murphy's Law, I'd be much more imaginative than having the purchase fall through at the last minute. That's downright predictable. Faced with someone perpetually touching wood like this, I'd arrange for them to pick up a really nasty splinter on the day before completion :-)

Link3 comments | Reply
navigation
[ viewing | July 25th, 2007 ]
[ go | Previous Day|Next Day ]