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

Re: permissions all zero when using 'cp'



Martin Lorenz wrote:
> what I found is really strange:
> when copying a file (no matter which) the copy gets zero permissions.

That is very strange.  And I feel must be in your personal
environment.  If it were in the system then I think your system would
have massive failures and would exhibit other problems.

Are you sure you are getting the system cp and not an alias or
wrapper?

  $ type cp
  cp is /bin/cp

Try running in a clean environment to see if it is an environment
variable.  'env -i' will initialize an empty environment.

  $ umask
  0002

  $ date -R > testfile1
  $ ls -ldog testfile1
  -rw-rw-r-- 1 32 Dec 29 20:00 testfile1

  $ rm -f testfile2
  $ env -i cp testfile1 testfile2
  $ ls -ldog testfile2
  -rw-rw-r-- 1 32 Dec 29 20:00 testfile2

If that still shows a problem then look deeper with strace.

  $ rm -f testfile2
  $ strace -v -e trace=file -o /tmp/cp.strace.out cp testfile1 testfile2

Then look through the cp.strace.out file to see what it is doing.  I
expect to see something like this:

  open("testfile1", O_RDONLY)             = 3
  open("testfile2", O_WRONLY|O_TRUNC)     = 5

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: