Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Detecting lchown and falling back to chown

by bluto (Curate)
on Feb 01, 2008 at 16:40 UTC ( #665598=note: print w/replies, xml ) Need Help??

in reply to Detecting lchown and falling back to chown

FWIW, if you have lchown available you'll chown the symlink but not the target. If you don't, you'll chown the target, but not the symlink.

That seems kind of strange to me, but YMMV. I could see that if lchown was defined you'd want to change the symlink, but how you handle the target seems like it should always be the same (i.e. always chown the target, or always avoid it).

  • Comment on Re: Detecting lchown and falling back to chown

Replies are listed 'Best First'.
Re^2: Detecting lchown and falling back to chown
by andy314 (Initiate) on Feb 01, 2008 at 16:49 UTC
    The program is supposed to recreate permissions of files. It would be run over both symlinks and non-symlinks, and over non-symlinks any function will do, however for symlinks I would need lchown. So I want my script to have full functionality on systems with lchown and at least partial functionality on systems without it.

    However you are right .. I do not really want to even attempt the chown if it is a symlink and I do not have lchown. I guess this would be more appropriate:
    sub best_chown($$$) { chown(@_) unless -l $_[0]; }

    Does this make sense?
      Messed up the parameter order. Should probably be (I never call it for more than 1 file at a time):
      sub best_chown($$$) { chown(@_) unless -l $_[2]; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665598]
[talexb]: TStanley I'm flying to Vegas in two weeks time. After that flights leaving Vegas and Phoenix are late at night .. I've been hearing that it gets so hot that the air isn't dense enough for planes to take off. Weird. Guess you won't have that problem.
[Corion]: Yay, vacation time now - one week off work (but a Perl workshop in the middle ;)) )
[talexb]: TStanley I just realized that I was in your area for a convention back in April. We were at the high school for the weekend, the one with the long driveway. Nice spot.
[TStanley]: I am heading to Arlington, Virginia next week, then I get to spend an entire week at home. Looking forward to that as I will have spent 7 weeks on the road by the end of next week

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2017-06-23 14:16 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (548 votes). Check out past polls.