Hi Jacob!

Can you provide more information about your environment, in particular how whoami(1) failed?

I'm playing around with the source bootstrap process of Guix¹.  The built 
Binutils has some issue and I want to run its testsuite.  There is no Coreutils 
at this stage but only gash-utils², which provides a subset of commands with 
only limited functionality.

In the first place I was wondering why at all logname is needed.

This code dates back to the beginning of the repository history and ChangeLog-1992 suggests that it likely originated in 1993 or 1994. Those error messages presumably are from some particular (now archaic) environment that did not have whoami(1), but unless Tcl's evaluation semantics have changed, this misuse of catch(n) should have blown up then, too. I am a bit confused how this could have gone unnoticed for so long.

Yes, I saw that, too.  I assume whoami was used without a catch in the 
beginning and someone added the catch wrongly without having an actual problem 
with it.

If you are actually the first person to have tried running DejaGnu on a system lacking both of the USER and LOGNAME environment variables and the whoami(1) command, I am not sure that the fallback for a missing whoami(1) is still relevant. (If it never worked, then I am unsure that it was ever relevant.)

I would even go a step further and argue that logname should be dropped.  It is 
only used to put the user's name into a log-file.  You could treat it as a data 
leak and problematic for reproducibility.

By the way, I need another patch, as /bin is not existing in my case.  I'm 
actually a bit wondering why all tools like awk, expect, tcl have a fallback 
without a path just to their executable name, but sh needs a fallback to 
/bin/sh.  But anyway, this is a common problem packaging software for Guix and 
not a problem of DejaGnu.

diff --git a/dejagnu b/dejagnu
index 3f9b99b..0cc2992 100755
--- a/dejagnu
+++ b/dejagnu
@@ -480,7 +480,7 @@ case $selected_ext in
     exp)    exec "$expectbin" -- "${commdir}/${command}.exp" ${1+"$@"} ;;
     gawk)   exec "$gawkbin" -f "${commdir}/${command}.gawk" -- ${1+"$@"} ;;
     tcl)    exec "$tclbin" "${commdir}/${command}.tcl" ${1+"$@"} ;;
-    sh)     exec /bin/sh "${commdir}/${command}.sh" ${1+"$@"} ;;
+    sh)     exec sh "${commdir}/${command}.sh" ${1+"$@"} ;;
     echo)
        echo command: "${command}"
        echo args: ${1+"$@"}


Bye

Stefan


¹ 
<https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/>
² <https://savannah.nongnu.org/git/?group=gash>

Reply via email to