Bug#835513: [PATCH] rpctrace: Pass prefixed_name to _hurd_exec_file_name.
This fixes the following test case:
mkdir testy
echo '#! /bin/bash' > testy/prog
echo 'printf "%s\n" "$0"' >> testy/prog
chmod +x testy/prog
PATH=$(pwd)/testy /bin/rpctrace -E PATH=/usr/bin:/bin -o /dev/null prog
Before this patch, the output is:
/bin/bash: prog: No such file or directory
After this patch, the output is similar to:
/home/kalle/testy/prog
* utils/rpctrace.c (traced_spawn): Get prefixed_name from
file_name_path_lookup and pass it to _hurd_exec_file_name.
---
Samuel Thibault <sthibault@debian.org> writes:
> It seems simple enough that it's not copyrightable, could you send a
> patch? (english phrasing can always have ambiguity issues...)
Here is the patch I last built. It fixes both test cases.
However, I wrote the commit message before finding the shorter
test case and filing the bug. Perhaps one should replace the
lengthy description with just a DEP-3 "Bug-Debian" header.
https://www.gnu.org/prep/maintain/maintain.html#Legally-Significant
says a series of minor changes can become significant.
I list my previously applied patches so that you have the correct
information for your decision:
commit 52d0590bca46d1368a6c5588d214e3724ebad358
diffstat (+7 -4) excluding ChangeLog, which was not from me
posted to 39925@bugs.debian.org (deleted) on 1999-07-01
"hurd: /libexec/rc waits for /tmp/* translators"
applied on 1999-07-01
commit 9e84be3cabcdd988f4c4af9f0794d0ba2d6929c1
diffstat (+1 -1)
posted to http://bugs.debian.org/47382 on 1999-10-14
"libdiskfs/opts-std-startup.c (parse_startup_opt): TOGGLE never clears the variable"
applied on 1999-10-14
commit 0e0bcad3e157579dbeafec933ac6ccbc00a515a3
diffstat (+1 -1)
posted to http://bugs.debian.org/62557 on 2000-04-17
"[patch] #! doubles first character of argument"
applied on 2000-07-20
commit ca5b01f538c122dc1f0e989f5703c75b8cf8ca3a
"rpctrace: Print beyond '\0' in MACH_MSG_TYPE_CHAR."
diffstat (+2 -1)
posted to bug-hurd on 2016-08-23
applied on 2016-08-23
utils/rpctrace.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 95ff124..10843bc 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1622,8 +1622,9 @@ traced_spawn (char **argv, char **envp)
task_t traced_task;
struct sender_info *ti;
struct receiver_info *receive_ti;
+ char *prefixed_name;
file_t file = file_name_path_lookup (argv[0], getenv ("PATH"),
- O_EXEC, 0, 0);
+ O_EXEC, 0, &prefixed_name);
if (file == MACH_PORT_NULL)
error (1, errno, "command not found: %s", argv[0]);
@@ -1664,7 +1665,8 @@ traced_spawn (char **argv, char **envp)
the actual task, so the RPCs to map in the program itself do not get
traced. Could have an option to use TASK_WRAPPER here instead. */
#ifdef HAVE__HURD_EXEC_FILE_NAME
- err = _hurd_exec_file_name (traced_task, file, *argv, argv, envp);
+ err = _hurd_exec_file_name (traced_task, file, prefixed_name ?: *argv,
+ argv, envp);
#else
err = _hurd_exec (traced_task, file, argv, envp);
#endif
@@ -1675,6 +1677,7 @@ traced_spawn (char **argv, char **envp)
cannot die and hence our TRACED_TASK ref cannot have been released. */
mach_port_deallocate (mach_task_self (), task_wrapper);
+ free (prefixed_name);
return pid;
}
--
2.6.4
Reply to: