aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2025-07-24 14:36:48 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2025-07-25 00:02:59 +0900
commit99cfcb824f30aebfd4a9a79f2ee698440f647ea4 (patch)
tree66bdfc805afd3962f2ae3302814245d32ea8ab10
parent41e0d0e26e4584021c55d4dc9ba33fc957e08ef3 (diff)
downloadnewlib-cygwin-3_6-branch.zip
newlib-cygwin-3_6-branch.tar.gz
newlib-cygwin-3_6-branch.tar.bz2
Cygwin: Fix handling of archetype fhandler in process_fdcygwin-3_6-branch
Previously, process_fd failed to correctly handle fhandlers using an archetype. This was due to the missing PATH_OPEN flag in path_conv, which caused build_fh_pc() to skip archetype initialization. The root cause was a bug where open() did not set the PATH_OPEN flag for fhandlers using an archetype. This patch introduces a new method, path_conv::set_isopen(), to explicitly set the PATH_OPEN flag in path_flags in fhandler_base:: open_with_arch(). Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258167.html Fixes: 92ddb7429065 ("(build_pc_pc): Use fh_alloc to create. Set name from fh->dev if appropriate. Generate an archetype or point to one here.") Reported-by: Christian Franke <Christian.Franke@t-online.de> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> (cherry picked from commit f67a5cffe052b9e746f0baf64fb762e8b2de162d)
-rw-r--r--winsup/cygwin/fhandler/base.cc3
-rw-r--r--winsup/cygwin/local_includes/path.h1
-rw-r--r--winsup/cygwin/release/3.6.53
3 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index 64a5f6a..beebd71 100644
--- a/winsup/cygwin/fhandler/base.cc
+++ b/winsup/cygwin/fhandler/base.cc
@@ -474,6 +474,9 @@ fhandler_base::open_with_arch (int flags, mode_t mode)
if (!open_setup (flags))
api_fatal ("open_setup failed, %E");
}
+ /* For pty and console, PATH_OPEN flag has not been set in open().
+ So set it here unconditionally. */
+ pc.set_isopen ();
close_on_exec (flags & O_CLOEXEC);
/* A unique ID is necessary to recognize fhandler entries which are
diff --git a/winsup/cygwin/local_includes/path.h b/winsup/cygwin/local_includes/path.h
index 1fd542c..a9ce2c7 100644
--- a/winsup/cygwin/local_includes/path.h
+++ b/winsup/cygwin/local_includes/path.h
@@ -244,6 +244,7 @@ class path_conv
int isopen () const {return path_flags & PATH_OPEN;}
int isctty_capable () const {return path_flags & PATH_CTTY;}
int follow_fd_symlink () const {return path_flags & PATH_RESOLVE_PROCFD;}
+ void set_isopen () {path_flags |= PATH_OPEN;}
void set_cygexec (bool isset)
{
if (isset)
diff --git a/winsup/cygwin/release/3.6.5 b/winsup/cygwin/release/3.6.5
index 97bb397..f14fbe6 100644
--- a/winsup/cygwin/release/3.6.5
+++ b/winsup/cygwin/release/3.6.5
@@ -19,3 +19,6 @@ Fixes:
- Instead, fix internal conversion of filenames in case of an invalid
4 byte UTF-8 sequence.
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258358.html
+
+- Make process_fd correctly handle pty and console.
+ Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258167.html