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

Re: permissions all zero when using 'cp'



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Bob,

thank you for the hints
I tried out, what you suggested.
here are the results:


Am 30.12.2010 04:04, schrieb Bob Proulx:
> type 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
>

as user:

mlo@vs152058:~$ type cp
cp is aliased to `cp -i'

as root:

root@vs152058:~# 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
>

root@vs152058:~# (
> env -i
> umask
> )
0022


>   $ 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
>

root@vs152058:~# (
> env -i
> date -R > testfile1
> ls -ldog testfile1
> echo
> rm -f testfile2
> echo
> cp testfile1 testfile2
> ls -ldog testfile2
> )
- -r-Sr-x--- 1 32 30. Dez 20:22 testfile1


- ---------- 1 32 30. Dez 20:22 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
>
stat64("testfile2", 0xbfffd7b0)         = -1 ENOENT (No such file or
directory)

stat64("testfile1", {st_dev=makedev(144, 109), st_ino=37590572,
st_mode=S_IFREG|S_ISUID|0450, st_nlink=1, st_uid=0, st_gid=0,
st_blksize=4096, st_blocks=8, st_size=32, st_atime=2010/12/30-20:22:29,
st_mtime=2010/12/30-20:22:29, st_ctime=2010/12/30-20:22:29}) = 0

stat64("testfile2", 0xbfffd624)         = -1 ENOENT (No such file or
directory)

open("testfile1", O_RDONLY|O_LARGEFILE) = 3
open("testfile2", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0) = 4

does this tell you something?

thank you for your help

regards
martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNHNzdAAoJECZ8myNlGwU11nUH/3vVPEIe+2tuf+kYHg9deuzu
h0zLFUUzePSBIrlsoZNNlGBkKUp9O7Y4L3WnK+QHTz9i7xisnVnb4X/m/ubFrFds
Oy8AehUHry24XohHzCYcMhToWlZ8kzSJhKpl9Wy72QjsClIU/ZHV3weS+0ecj/3G
MeGo+b5fiym1Rpl3nRyj7clDpdCxxgSS2IF8m9DsyifC1Zw1TVMHl+OwwXBJDoQv
I7M3Rnt0IW6WYnHBVUWekm91o2gCemMrCZ0lhE952OdBXm9cG2ecT4FmC03XZAAu
zxyikYdL0go6UJQso/i6qrOBYJ6gNL63ICEWsahQYaDXzXyEfDB3NLabKjKUs3I=
=iynZ
-----END PGP SIGNATURE-----


Reply to: