public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation
@ 2021-11-15 20:04 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-11-15 20:04 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=282f40e4697b00a786d4b63f94e744b2e8a221b3

commit 282f40e4697b00a786d4b63f94e744b2e8a221b3
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Nov 15 20:31:51 2021 +0100

    Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation
    
    Do this for normal files and symlinks, not for temporary files,
    device files or unix sockets.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/exceptions.cc | 2 +-
 winsup/cygwin/fhandler.cc   | 3 ++-
 winsup/cygwin/path.cc       | 4 ++--
 winsup/cygwin/release/3.3.3 | 4 ++++
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index a914110fe..eccddd780 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -157,7 +157,7 @@ cygwin_exception::open_stackdumpfile ()
       NTSTATUS status;
       /* Try to open it to dump the stack in it. */
       status = NtCreateFile (&h, GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
-			     NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
+			     NULL, FILE_ATTRIBUTE_ARCHIVE, 0, FILE_OVERWRITE_IF,
 			     FILE_SYNCHRONOUS_IO_NONALERT
 			     | FILE_OPEN_FOR_BACKUP_INTENT, NULL, 0);
       if (NT_SUCCESS (status))
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2a07e6cf9..4e708595a 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -649,7 +649,8 @@ fhandler_base::open (int flags, mode_t mode)
 
       if (flags & (O_CREAT | O_TMPFILE))
 	{
-	  file_attributes |= FILE_ATTRIBUTE_NORMAL;
+	  file_attributes |= (flags & O_TMPFILE)
+			     ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_ARCHIVE;
 
 	  if (pc.fs_is_nfs ())
 	    {
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index baf04ce89..2cf9de9ef 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1945,7 +1945,7 @@ symlink_wsl (const char *oldpath, path_conv &win32_newpath)
   status = NtCreateFile (&fh, DELETE | FILE_GENERIC_WRITE
 			     | READ_CONTROL | WRITE_DAC,
 			 win32_newpath.get_object_attr (attr, sec_none_nih),
-			 &io, NULL, FILE_ATTRIBUTE_NORMAL,
+			 &io, NULL, FILE_ATTRIBUTE_ARCHIVE,
 			 FILE_SHARE_VALID_FLAGS, FILE_CREATE,
 			 FILE_SYNCHRONOUS_IO_NONALERT
 			 | FILE_NON_DIRECTORY_FILE
@@ -2264,7 +2264,7 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
 
       status = NtCreateFile (&fh, access,
 			     win32_newpath.get_object_attr (attr, sec_none_nih),
-			     &io, NULL, FILE_ATTRIBUTE_NORMAL,
+			     &io, NULL, FILE_ATTRIBUTE_ARCHIVE,
 			     FILE_SHARE_VALID_FLAGS,
 			     isdevice ? FILE_OVERWRITE_IF : FILE_CREATE,
 			     FILE_SYNCHRONOUS_IO_NONALERT
diff --git a/winsup/cygwin/release/3.3.3 b/winsup/cygwin/release/3.3.3
index 2ad28d465..1eb25e2fc 100644
--- a/winsup/cygwin/release/3.3.3
+++ b/winsup/cygwin/release/3.3.3
@@ -12,3 +12,7 @@ Bug Fixes
 
 - Fix showing DLL version info from native Windows tools.
   Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249867.html
+
+- Fix long-standing problem that new files don't get created with the
+  FILE_ATTRIBUTE_ARCHIVE DOS attribute set.
+  Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249909.html


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-15 20:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 20:04 [newlib-cygwin/cygwin-3_3-branch] Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).