From b940faa144cae9cd29295d8fdaac163a17f334cc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Jan 2025 11:01:29 +0100 Subject: 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 Signed-off-by: Corinna Vinschen --- 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(-) create mode 100644 winsup/cygwin/release/3.5.7 (limited to 'winsup/cygwin') diff --git a/winsup/cygwin/local_includes/devices.h b/winsup/cygwin/local_includes/devices.h index c4f0612..dc4a29b 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 924c93e..1fd542c 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 c10f2e8..658f3f9 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 0000000..12180ef --- /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 -- cgit v1.1