bug-coreutils
[Top][All Lists]
Advanced

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

bug#33468: A bug with yes and --help


From: Bernhard Voelker
Subject: bug#33468: A bug with yes and --help
Date: Fri, 22 Feb 2019 08:46:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 2/21/19 9:15 AM, Bernhard Voelker wrote:
> On 2/19/19 2:53 PM, Eric Blake wrote:
>> [...] - just blindly set
>> opterr without worrying about restoring it.
> 
> You are both right, sorry for the confusion.
> Adjusted patches attached.
> 
> I added some more test cases as well.
> Finally, I documented the change in 'yes' in NEWS regarding:
> 
>   $ yes a -- b | head -n1
>   a -- b
> vs.
>   $ src/yes a -- b | head -n1
>   a b

What about putting 'yes' into the 'nohup' category?  I mean, we have
the SCAN_ALL flag in our new function, so why not simply use it?

diff --git a/src/yes.c b/src/yes.c
index 0864186f9..477872e92 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)
   atexit (close_stdout);

   parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
-                                   Version, true, usage, AUTHORS,
+                                   Version, false, usage, AUTHORS,
                                    (char const *) NULL);

   char **operands = argv + optind;


That makes:

  $ src/yes a -- b | sed 1q
  a -- b

and also recognizing --help when other arguments are following:

  $ src/yes --help a -- b | sed 1q
  Usage: src/yes [STRING]...

That is actually our intention, no?
WDYT?

Thanks & have a nice day,
Berny





reply via email to

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