delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/06/14:35:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 6 May 2002 14:12:46 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: tar won't restore permissions
Message-ID: <20020506181246.GB31223@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <200205061623 DOT g46GNJO19868 AT work DOT bitmover DOT com> <200205061658 DOT g46GwlO20091 AT work DOT bitmover DOT com>
Mime-Version: 1.0
In-Reply-To: <200205061658.g46GwlO20091@work.bitmover.com>
User-Agent: Mutt/1.3.23.1i

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019