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: tar won't restore permissions


Recent cygwin snapshots should fix this problem.

cgf

On Mon, May 06, 2002 at 10:07:47AM -0700, Andrew Chang wrote:
>Randall, 
>
>Thanks for your reply. I finally have some time to look at this issues again.
>It seems that we are talking about slightly different things. I tried the 
>your suggestion of setting up CYGWIN=ntsec (I did it in the control panel and 
>rebooted the machine, the file system is NTFS). It turns out this only works 
>if *all* of the application is accessing the file via cygwin.dll.  it does 
>not work if one of the application is a non-cygwin apps which access the file
>directly via the win32 api.
>It looks like cygwin.dll cached the file permission somewhere and the 
>permission is not write thru to NTFS layer. I tried the following
>a) chmod -w file (make the file readonly)
>b) "tar pcf" and  "tar pxf" the file
>c) cygwin "ls -l"  will tell you the file is readonly as expected
>d) but if you go to the NT explorer and look at the file property, 
>   explorer thinks the same file is writable. (the readonly box has no
>   check mark)
>
>My fix/hack is very simple but seems to work, in set_mode() in extract.c
>There seems to some optimization which short -circuit the
>code path if it *thinks* the mode is already correct, which
>return early without calling chmod(). On cygwin, we need to
>always calls chmod() so the permission change is 
>force thru to the NTFS layer. If this is not acceptable as a default 
>behaviour, giving us a new option to froce this behavior would be great.
>
>--- extract.c   Mon May  6 08:19:59 2002
>+++ extract.c.old       Mon May  6 08:37:09 2002
>@@ -128,7 +128,6 @@
>     {
>       mode = stat_info->st_mode;
>
>-#ifndef __CYGWIN__ /* must fix up mode when on cygwin -awc */
>       /* If we created the file and it has a usual mode, then its mode
>         is normally set correctly already.  But on many hosts, some
>         directories inherit the setgid bits from their parents, so we
>@@ -138,7 +137,6 @@
>          && typeflag != DIRTYPE
>          && typeflag != GNUTYPE_DUMPDIR)
>        return;
>-#endif
>     }
>   else if (! invert_permissions)
>     return;

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]