https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5a58110d12842a477c4ff9f3f2df1c0175b134ce
commit 5a58110d12842a477c4ff9f3f2df1c0175b134ce 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:45 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> (cherry picked from commit b940faa144cae9cd29295d8fdaac163a17f334cc) 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 1e035f9d6a3e..6a28cfd18908 100644 --- a/winsup/cygwin/local_includes/devices.h +++ b/winsup/cygwin/local_includes/devices.h @@ -377,7 +377,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 77e07eb65879..6b7bc0ac1e3a 100644 --- a/winsup/cygwin/local_includes/path.h +++ b/winsup/cygwin/local_includes/path.h @@ -228,8 +228,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 e6f4c3e3de03..599809f941a5 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1233,10 +1233,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