This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Permissions get lost when moving files between drives.


On Thu, 15 Jan 2004, Dave Korn wrote:

> > -----Original Message-----
> > From: cygwin-owner@cygwin.com
> > [mailto:cygwin-owner@cygwin.com] On Behalf Of Igor Pechtchanski
>
> > On Thu, 15 Jan 2004, Ronald Fischer wrote:
> >
> > > I'm using cygwin bash on a Windows 2000 machine. When I perform the
> > > following steps (c: is the local drive, h: is a network
> > drive, which
> > > is also my $HOME):
> > >
> > > cd c:/
> > > echo xxx >h:/tmp/x
> > > mv h:/tmp/x y
> > >
> > > then a
> > >
> > >   ls -l
> > >
> > > shows that c:/y has the permissions set to 000, though h:/tmp/x has
> > > them correct as 644.
> > >
> > > Ronald
>
> > At a guess, your C: drive is a FAT (or, worse yet, FAT32)
> > drive.  The cygcheck output mentioned at the above link will
> > show whether this is the case.
> >       Igor
>
>
>   Nope, it's more complicated than that.  Here on my system I've got cygwin
> root installed on an NTFS partition (under XP), and /win/t is a mountpoint
> for the dos path T:\ which is a samba share from a linux box....  Now watch:

BTW, in this case I hope you're aware of both "ntsec" and "smbntsec", and
how they interact.

> ---snip---
> dk@mace /> echo helloworld >testfile
> dk@mace /> ls -la testfile
> -rw-r--r--    1 dk       Domain U       11 Jan 15 17:12 testfile
> dk@mace /> echo helloworld >/win/t/testfile2
> dk@mace /> ls -la /win/t/testfile2
> -rw-r--r--    1 dk       Domain U       11 Jan 15  2004 /win/t/testfile2
> dk@mace /> cp /win/t/testfile2 ./testfile2a
> dk@mace /> mv /win/t/testfile2 ./testfile2b
> dk@mace /> ls -la testfile*
> -rw-r--r--    1 dk       Domain U       11 Jan 15 17:12 testfile
> -rw-r--r--    1 dk       Domain U       11 Jan 15 17:12 testfile2a
> -rwx------+   1 dk       Domain U       11 Jan 15  2004 testfile2b
> dk@mace />
> ---snip---
>
>   So, I observe that:
>
> A) it's not to do with OP's use of dos paths with drive letters and colons

I never said it did.  I suspected he's on a non-permission-preserving
filesystem.

> B) it's not to do with FAT-vs-NTFS

Possible, but without the cygcheck output, your guess is as good as mine.
FWIW, I suspect everything is behaving as intended (see below in C).

> C) it's not always 000 that the perms get set to, for me it's 700

If the owner of the file on the samba share is not the same as your
Windows login name, the attempt to preserve file permissions might result
in something like that.

> D) it happens with cp but not with mv

Of course it does -- see below. :-)

> E) something funny seems to occur with the c/m/a timestamps as well.
>
>   Of those three, D) should give a big clue if anyone's familiar with the
> different internals of those two commands...

Nope, D (and E) is bogus, sorry.  "mv" will attempt to preserve all of the
file attributes (owner, permissions, ACLs, timestamps, etc).  "cp" by
itself will not -- it happily creates a new file with default permissions.
If you want this test to be conclusive, try "cp -p" (which, I suspect,
will behave identically to "mv").

>    cheers,
>      DaveK

In any case, until we see the OP's cygcheck output, the applicability of
the above to his problem is all guesswork on both of our parts.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]