[Tcsh] [PATCH] Fix: bug in "which" builtin

Christos Zoulas christos at zoulas.com
Tue Feb 8 14:36:38 UTC 2022


Fixed, thanks!

christos

> On Feb 5, 2022, at 10:32 PM, Jamie Landeg-Jones <jamie at catflap.org> wrote:
> 
> (Re-sent with more appropriate subject line)
> 
> Damn! I just last night discovered a bug I was going to mention today!
> 
> Basically, I noticed my aliases were out of wack. I discovered that "which"
> is no longer returning error 1 if a command is not found.
> 
> It seems that when "setcopy" was changed in some cases to "setstatus", a mistake
> was made.
> 
> This is the fix:
> 
> --- tc.func.c.orig	2021-12-09 11:32:52.000000000 +0000
> +++ tc.func.c	2022-02-02 07:23:26.065413000 +0000
> @@ -503,7 +503,7 @@
> 	rv &= cmd_expand(*v, NULL);
> 
>     if (!rv)
> -	setstatus(0);
> +	setstatus(1);
> }
> 
> static int
> 
> I didn't check when this change occurred, but I plucked out a tc.func.c from 2016 and
> did the following:
> 
> "tcsh" jamie at thompson% sdiff -s /tmp/tc.func.c tc.func.c | egrep 'setstatus|setcopy.STRstatus'
>        setcopy(STRstatus, STR1, VAR_READWRITE);                 |      setstatus(0);
>        setcopy(STRstatus, STR1, VAR_READWRITE);                 |      setstatus(1);
>        setcopy(STRstatus, STR0, VAR_READWRITE);                 |      setstatus(0);
>        setcopy(STRstatus, STR1, VAR_READWRITE);                 |      setstatus(1);
> 
> The inconsistency can be easily seen there.
> 
> Cheers, Jamie
> --
> Tcsh mailing list
> Tcsh at astron.com
> https://mailman.astron.com/mailman/listinfo/tcsh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20220208/ce3c70d7/attachment.asc>


More information about the Tcsh mailing list