~ chicken-core (chicken-5) 9f253b3c55b0a2592babc1b3852a491e700d9202
commit 9f253b3c55b0a2592babc1b3852a491e700d9202
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Sun Jun 4 00:55:02 2023 +0200
Commit: Felix Winkelmann <felix.winkelmann@bevuta.com>
CommitDate: Mon Jun 5 14:52:54 2023 +0200
Pass executed filename to execv[pe] unmodified when calling process-execute
Programs created via `process-execute` cannot currently determine their
real location from argv[0], since the directory part is discarded before
the executed filename is added to argv[0]. This change simply passes the
filename verrbatim, which is less surprising.
Signed-off-by: Felix Winkelmann <felix.winkelmann@bevuta.com>
(amended to remove unnecessary let-binding)
diff --git a/NEWS b/NEWS
index 6ecbbad2..c181866f 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@
- Added "locative-index", kindly contributed by John Croisant.
- Added "fp*+" (fused multiply-add) to "chicken.flonum" module
(suggested by Christian Himpe).
+ - The `process-execute` procedure now sets argv[0] to the unmodified
+ filename. Previously, the directory part would be stripped.
- Tools
- The -R option for csi and csc now accepts list-notation like
diff --git a/posix-common.scm b/posix-common.scm
index caa19e57..8ee394c0 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -709,11 +709,9 @@ EOF
lst))
(define call-with-exec-args
- (let ((pathname-strip-directory pathname-strip-directory)
- (nop (lambda (x) x)))
+ (let ((nop (lambda (x) x)))
(lambda (loc filename argconv arglist envlist proc)
- (let* ((stripped-filename (pathname-strip-directory filename))
- (args (cons stripped-filename arglist)) ; Add argv[0]
+ (let* ((args (cons filename arglist)) ; Add argv[0]
(argbuf (list->c-string-buffer args argconv loc))
(envbuf #f))
Trap