Re: [PATCH] Catch errors properly, if whoami or who don't exist

Jacob Bachmeyer <[email protected]> Sun, 08 Sep 2024 21:30:37 -0500
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
Rob Savoye wrote:
> On 9/8/24 6:15 PM, Jacob Bachmeyer wrote:
>
>> So the logs were not sitting on a shared server, then.  Perhaps a 
>> notion of credit-where-credit-is-due to the testers?
>
>   In those days we were still using UUCP over Telebit Trailblazer 
> modems. :-) The shared server came by years later when we built the 
> big build farm for cross testing. At one point we were testing 144 
> host/target variations of GCC in a fully automated fashion for every 
> release. Pre-github, no Gerrit or Jenkins, the dinosaur days of CI...

That would certainly make keeping track of where a given test log 
originated seem important, so (if I understand the history correctly) 
you know who to call if you have questions when it lands in your UUCP 
inbox overnight.  :-)

>> I am still inclined to keep it, but perhaps we should check if the 
>> working directory or source tree is a Git checkout, and if so, use the 
>
>   Some people would be running DejaGnu from an installed package, so 
> git wouldn't work. If LOGNAME doesn't exist, I'd just set it to "unknown".

No, not DejaGnu itself, the package being tested:  check both the 
current working directory where runtest(1) is run and the "testsuite" 
directory to see if either is in a Git working tree.  A Git identity 
would override the login name if found, and the existing behavior would 
be kept if Git is not in use.

>> Also, do you remember what system used `who am i` instead of `whoami` 
>> and why DejaGnu extracts the second /[ !]/-delimited field from that 
>> command's output?
>
>   Back then DejaGnu had to run a wide variety of Unixes. Pure System 
> V, BSD variants, SunOs/Solaris, Unixware, HPUX, IRIX, AIX, NextOS, 
> MSDOS, plus the crazy Canadian cross to build a cross compiler that 
> ran on Windows. I can't remember which system used "who am I", but 
> there was a huge amount of weird obscure differences between systems 
> we just had to deal with.

I see:  some oddball now-probably-forgotten Unix used that and the code 
is of negligible cost if `whoami` succeeds (which it will on the GNU 
system) or either environment variable is set (which they usually are on 
GNU-ish systems), so it may as well stay in DejaGnu.  I might add a 
comment about it supporting a now-forgotten ancient system.

Do I guess correctly that USER is from BSD and LOGNAME is from System V?

> That's one of the things that made the GNU toolchain so popular, it 
> ran on almost anything, so your code became truly portable. That was a 
> big deal in the late 80s into the early 90s due to vendor lock-in with 
> proprietary compilers.

All of that was before my time, so those lessons are particularly 
important to remember, lest vendor lock-in again become a problem.


-- Jacob