[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [Bug: Busybox 1.22.1] false return 0 instead of 1 with '--help' switch.
From:       tito <farmatito () tiscali ! it>
Date:       2014-08-30 11:15:53
Message-ID: 201408301315.53689.farmatito () tiscali ! it
[Download RAW message or body]

On Saturday 30 August 2014 13:02:50 Laurent Bercot wrote:
> > The question is would it break something if --help would return EXIT_FAILURE
> > everytime ?
> 
>   Well the usual GNU --help behaviour is to return EXIT_SUCCESS after
> displaying the help.
>   false is the exception, not the rule, and should be specialcased in busybox
> as it is in GNU coreutils.
> 
>   My opinion is that busybox should drop --help entirely for trivial applets
> (i.e. most of them), but some people insist on compatibility with GNU tools.
> 
> 

Hi,
maybe changing this in appletlib.c

	if (!ENABLE_TEST || strcmp(applet_name, "test") != 0) {
			/* If you want "foo --help" to return 0: */
			xfunc_error_retval = 0;
			bb_show_usage();
		}


to

	if (!ENABLE_TEST || strcmp(applet_name, "test") != 0) {
			/* If you want "foo --help" to return 0: */
+			if (strcmp(applet_name, "false") != 0)
				xfunc_error_retval = 0;
			bb_show_usage();
		}

Should fix the true and false case. Untested.

Ciao,
Tito
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic