[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#487317: perl-modules: File::Path::rmtree sets symlink target permissions to 0777



Quoth Russ Allbery <rra@debian.org>, on 2008-06-21 09:29:33 -0700:
> There's an lchmod function that avoids this behavior, but I'm not sure
> that Perl provides an interface to it without a new XS module.  (It's not
> portable to all systems, but it is available on Linux.)

I'm basically familiar with lchmod, but is it really available on this
platform?  It doesn't seem to be.  With Debian GNU/Linux unstable on
AMD64 with Linux 2.6.24.2 and GCC 4.3.1 20080523 (prerelease) (Debian
4.3.0-5), I get the following results (newlines added for clarity):

  $ ln -s /dev/null foo
  $ ls -l foo
  lrwxrwxrwx 1 drake drake 9 2008-06-21 12:27 foo -> /dev/null

  $ man 2 lchmod
  No manual entry for lchmod in section 2
  $ man 3 lchmod
  No manual entry for lchmod in section 3

  $ cat >lchmod.c
  main() { lchmod("foo", 0700); }
  $ gcc -o lchmod lchmod.c
  /tmp/cc478IUh.o: In function `main':
  lchmod.c:(.text+0x18): warning: warning: lchmod is not implemented and will always fail
  $ ./lchmod
  $ ls -l foo
  lrwxrwxrwx 1 drake drake 9 2008-06-21 12:27 foo -> /dev/null

  $ gcc -static -o lchmod lchmod.c
  /tmp/ccqjaRGU.o: In function `main':
  lchmod.c:(.text+0x18): warning: warning: lchmod is not implemented and will always fail
  $ strace ./lchmod
  execve("./lchmod", ["./lchmod"], [/* 40 vars */]) = 0
  uname({sys="Linux", node="drache", ...}) = 0
  brk(0)                                  = 0x68b000
  brk(0x68bf10)                           = 0x68bf10
  arch_prctl(ARCH_SET_FS, 0x68b850)       = 0
  brk(0x6acf10)                           = 0x6acf10
  brk(0x6ad000)                           = 0x6ad000
  exit_group(-1)                          = ?
  Process 16730 detached

   ---> Drake Wilson


Reply to: