delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/15/15:05:41

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AFFF3857C5E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1637006740;
bh=6kHdvGbFkTCaSdU1e8l1KVLDFymL+jgyY6IXeZEz9hE=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=cYN5VYQUPbC/XFCIyYJvCeqKddG0wtv61ZofgqPkaDJUuricrZv4GbO3k64nXzGBi
zhzsmpkT6aka1wkEpXMpKtXmPywj90r1gCKbynMRUW/l551F/ZTHxeFUsf/0jZusNV
N1mBlwwa0rDXWqXrINBgh9q14z04vwBsIWCSe3XQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B31F3858405
Date: Mon, 15 Nov 2021 21:05:06 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Editing with vim clears Windows 10 file system archive bit.
Message-ID: <YZK9ciahf8PDvX7A@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <SN6PR04MB4799AEB60421601D02E22680BB979 AT SN6PR04MB4799 DOT namprd04 DOT prod DOT outlook DOT com>
<305aedc4-9bb2-02b8-f5ab-f88aba39e9cf AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <305aedc4-9bb2-02b8-f5ab-f88aba39e9cf@t-online.de>
X-Provags-ID: V03:K1:ihyR6ZsRxPpYzb3hzaqnkfNGcZ+lPQJJv9u+uSFSZzUI3Kn3eSE
eF3/Po6EHzSdfuGVnX0eorIs3C6sUyuLk1iWOakbqe6TAtAtK8Av6wfiBSjI9Ri4Jd9oAcf
KQML/KzvAy/j4ApT8f3/zZutBtJTwt1rQ3Hr4i+fGI6Cl5EunhFFLiVnQw05/3sSuuZe6A4
CLQIYugAWSQxFbHIJQKmw==
X-UI-Out-Filterresults: notjunk:1;V03:K0:AVL1gnuiUaM=:UdhQAUMJmMs7BPg1yaoWb9
tyqRlAxpoeatbtm8KaY2nQD135s5P401JvlL8dVZsG/kWEhYYqHoQkMnh3yuPeqQde4N1t3Jk
xAAl0uXWSLZ5nymXQk1e+mVEzr56bTl7h8DCpNyX1kesAsbhpo6/sOr99lszxW1+2uS+T8pcP
ejzJQ3bMONDT1kIkRvHeXNchamykqffSagImkhJG4EoAHfE0t1vNrFjSwb56MeA5cij/YbSzQ
S734qFPvQQEGgtZ9NteyL/r6W0O0kejXaDriP4hlds5SyTdDW7BGiDC4uUDvDg61AzoNe4L1i
96kp80nZu0xXNtBe5Mmpy3KcnQVLMbIVqWVT8PwMBTZwEYmJkXtvCvjpPGDKXPManpqr8NLVH
LSlztFRPe9Fbo7uj62IYOyiWIhDGxsKFYPtZTuRUKQQk+d4VSlzq1JyeCeOjkkQIRjrrANc7h
KwQw2MoxayTwKGbZwILUhbzsK27hZhp+1MP5vGKP3ImW1ZGvZWPFlaVdKOoBn1RCBVqCqoAg8
IktwdQ23Zpkm7nBcqaw7r2S1wQL29hmYmQEpR4HE+wRAesQ7NkFiKT0TnZEbN6LO15gP09DcF
RK9+g2flc0thc2GF7n1wSWerAxQJ09hMucryuhe2IyPQ3bAlGgTORKQ31DJQ9ITkkxp8oxITg
6knSqcdeLYM9SFcbMrC3TNumkVzdUPJDgxrKyOunIUbRIYTgcozRd5FYht6gW0pG9uAEe9B+8
TeJIkxC65SgPOuub
X-Spam-Status: No, score=-99.1 required=5.0 tests=BAYES_00,
GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS,
RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 1AFK5fVl002149

On Nov 15 19:54, Christian Franke wrote:
> Steve Ward via Cygwin wrote:
> > Description of problem:
> > While using vim 8.2 on cygwin 3.3 (x86_64) on Windows 10,
> > when editing an existing file with vim and saving it, the Window’s
> > file system archive bit is always left cleared (not modified state).
> > This happens, whether the archive bit was set (is modified) or
> > clear (not modified) initially.
> 
> The problem also occurs with 'cp' command:
> 
> $ touch file1
> 
> $ /bin/cp file1 file2
> 
> $ /bin/cp --preserve=mode file1 file3
> 
> $ lsattr file?
> ---a-------- file1
> ---a-------- file2
> ------------ file3
> 
> Some Cygwin functions apparently clear the archive attribute unexpectedly,
> for example:
> 
> int fd = open(filename, O_CREAT|O_TRUNC|O_WRONLY, 0644);
> write(fd, "Test\n", 5);
> fchmod(fd, 0644); // clears archive attribute
> close(fd);
> 
> Same with facl(., SETACL, ...). The variants chmod() and acl() are not
> affected.

It's funny that it took so long that somebody actually noticed this.
This behaviour is present at least since 2004.  Cygwin *never* actually
cared for the ARCHIVE attribute explicitely.  The reason for the above
observation is the open call containing the O_CREAT flag.  When Cygwin
creates files, it sets the attributes to FILE_ATTRIBUTE_NORMAL only, not
adding the FILE_ATTRIBUTE_ARCHIVE flag. 

Changing that is actually pretty simple, just set FILE_ATTRIBUTE_ARCHIVE
as soon as the underlying NtCreateFile is called for an open(O_CREAT).

Fixed in current git.


Thanks,
Corinna

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

- Raw text -


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