bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix coreutils-5.0.91 rejecting "[ toto -eq tata ]" like form


From: Thierry Vignaud
Subject: Re: [PATCH] fix coreutils-5.0.91 rejecting "[ toto -eq tata ]" like forms
Date: Wed, 07 Jan 2004 12:35:37 +0000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Thierry Vignaud <address@hidden> writes:

> latest coreutils wrongly assume the same behavior for both test and [
> programs.
> 
> however, whereas it's ok for test to be called as in "test toto -eq
> tata ]" , "[" call must be finished by a "]" as in "[ toto -eq tata ]"
> 
> this bug is often silently unseen because most shells (especially most
> used ones such as bash, zsh and the like) provide a builtin [ command,
> thus hiding this bug.
> 
> csh like shells such as tcsh do not provide builtin [ command and thus
> unhide this bug.
> 
> 
> see http://qa.mandrakesoft.com/show_bug.cgi?id=6736 for reference
> 
> 
> the following patch fix that bug:
> --- ./src/test.c.tv   2004-01-07 12:36:21.000000000 +0100
> +++ ./src/test.c      2004-01-07 13:06:06.000000000 +0100
> @@ -1091,7 +1091,7 @@
>  
>    argv = margv;
>  
> -  if (LBRACKET)
> +  if (strcmp (margv[0], "[") != 0)
>      {
>        /* Recognize --help or --version, but only when invoked in the
>        "[" form, and when the last argument is not "]".  POSIX

oops, i sent the wrong patch:
--- ./src/test.c.tv     2004-01-07 12:36:21.000000000 +0100
+++ ./src/test.c        2004-01-07 13:06:06.000000000 +0100
@@ -1091,7 +1091,7 @@
 
   argv = margv;
 
-  if (LBRACKET)
+  if (strcmp (margv[0], "[") == 0)
     {
       /* Recognize --help or --version, but only when invoked in the
         "[" form, and when the last argument is not "]".  POSIX

reply via email to

[Prev in Thread] Current Thread [Next in Thread]