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

commit b4e4cb4c866508ce2bd97ab55e39230b57043c18
Author: Jeremy Drake <cyg...@jdrake.com>
Date:   Thu Jun 26 12:39:55 2025 -0700

    Cygwin: testsuite: test relative path to exe after addchdir.
    
    This is apparently relative to the new cwd, but my implementation is
    currently treating it as relative to the parent's cwd, so it's worth
    testing.
    
    Signed-off-by: Jeremy Drake <cyg...@jdrake.com>

Diff:
---
 winsup/testsuite/winsup.api/posix_spawn/errors.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/winsup/testsuite/winsup.api/posix_spawn/errors.c 
b/winsup/testsuite/winsup.api/posix_spawn/errors.c
index cd5d65030..3fbc2cbf9 100644
--- a/winsup/testsuite/winsup.api/posix_spawn/errors.c
+++ b/winsup/testsuite/winsup.api/posix_spawn/errors.c
@@ -16,6 +16,7 @@ void cleanup_tmpfile (void)
 
 int main (void)
 {
+  posix_spawn_file_actions_t fa;
   pid_t pid;
   int fd;
   char *childargv[] = {"ls", NULL};
@@ -54,5 +55,12 @@ int main (void)
       posix_spawn (&pid, tmpsub, NULL, NULL, childargv, environ));
 #endif
 
+  /* expected ENOENT: relative path after chdir */
+  errCode (posix_spawn_file_actions_init (&fa));
+  errCode (posix_spawn_file_actions_addchdir_np (&fa, "/tmp"));
+  errCodeExpected (ENOENT,
+      posix_spawn (&pid, tmppath, &fa, NULL, childargv, environ));
+  errCode (posix_spawn_file_actions_destroy (&fa));
+
   return 0;
 }

Reply via email to