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

commit b940faa144cae9cd29295d8fdaac163a17f334cc
Author:     Corinna Vinschen <cori...@vinschen.de>
AuthorDate: Mon Jan 27 11:01:29 2025 +0100
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Mon Jan 27 11:17:27 2025 +0100

    Cygwin: message queues are not devices
    
    Message queues are basically just files and in most cases can be handled
    like normal files.  So it was a mistake to set the "on-disk-device" flag
    for them to fix the mq_unlink() problem reported in
    https://cygwin.com/pipermail/cygwin/2025-January/257119.html
    
    Rather, given that unlink() just checks if the object to be deleted
    has an on-disk representation, make sure message queues are added to
    the path_conv::isondisk() predicate.
    
    This also reverts commit d870655f570f25393dcefbaf0b1dc807f277749c.
    
    Fixes: d870655f570f ("Cygwin: path_conv: set on-disk-device flag for 
message queue files")
    Reported-by: Christian Franke <christian.fra...@t-online.de>
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/local_includes/devices.h | 3 ++-
 winsup/cygwin/local_includes/path.h    | 3 +--
 winsup/cygwin/path.cc                  | 5 +----
 winsup/cygwin/release/3.5.7            | 5 +++++
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/local_includes/devices.h 
b/winsup/cygwin/local_includes/devices.h
index c4f06127418c..dc4a29b12b8e 100644
--- a/winsup/cygwin/local_includes/devices.h
+++ b/winsup/cygwin/local_includes/devices.h
@@ -376,7 +376,8 @@ public:
   }
   fh_devices operator = (fh_devices n) {return d.devn_fh_devices = n;}
   inline void setfs (bool x) {dev_on_fs = x;}
-  inline bool isfs () const {return dev_on_fs || d.devn == FH_FS;}
+  inline bool isfs () const {return dev_on_fs || d.devn == FH_FS
+                                   || d.devn == FH_MQUEUE;}
   inline bool is_fs_special () const {return dev_on_fs && d.devn != FH_FS;}
   inline bool is_dev_resident () const {return lives_in_dev;}
   inline int exists () const {return exists_func (*this);}
diff --git a/winsup/cygwin/local_includes/path.h 
b/winsup/cygwin/local_includes/path.h
index 924c93eed006..1fd542c96b4a 100644
--- a/winsup/cygwin/local_includes/path.h
+++ b/winsup/cygwin/local_includes/path.h
@@ -235,8 +235,7 @@ class path_conv
      /proc. */
   int isspecial () const {return dev.not_device (FH_FS);}
   /* Devices with representation on disk. This includes local sockets, FIFOs,
-     message queues and devices created with mknod.  It does not include
-     the /proc hierarchy. */
+     devices created with mknod.  It does not include the /proc hierarchy. */
   int is_fs_special () const {return dev.is_fs_special ();}
   /* Like is_fs_special but excluding local sockets. */
   int is_lnk_special () const {return is_fs_special () && !issocket ();}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c10f2e8e1bd8..658f3f9cf7ea 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1273,10 +1273,7 @@ path_conv::check (const char *src, unsigned opt,
 
          /* FIXME: bad hack alert!!!  We need a better solution */
          if (!strncmp (path_copy, MQ_PATH, MQ_LEN) && path_copy[MQ_LEN])
-           {
-             dev.parse (FH_MQUEUE);
-             dev.setfs (1);
-           }
+           dev.parse (FH_MQUEUE);
        }
 
       if (opt & PC_NOFULL)
diff --git a/winsup/cygwin/release/3.5.7 b/winsup/cygwin/release/3.5.7
new file mode 100644
index 000000000000..12180efd9a82
--- /dev/null
+++ b/winsup/cygwin/release/3.5.7
@@ -0,0 +1,5 @@
+Fixes:
+------
+
+- Fix stat() on message queues.
+  Addresses: https://cygwin.com/pipermail/cygwin/2025-January/257186.html

Reply via email to