← Commit list

de5edadee

Denys Vlasenko
Denys Vlasenko
2015-04-21
SUCCESS Duration: 180s

Subject

special-case {true,false,test} --help

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/false.c+3 -5
@@ -10,11 +10,9 @@
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */
-//usage:#define false_trivial_usage
-//usage: ""
-//usage:#define false_full_usage "\n\n"
-//usage: "Return an exit code of FALSE (1)"
-//usage:
+/* "false --help" is special-cased to ignore --help */
+//usage:#define false_trivial_usage NOUSAGE_STR
+//usage:#define false_full_usage ""
//usage:#define false_example_usage
//usage: "$ false\n"
//usage: "$ echo $?\n"
coreutils/test.c+3 -8
@@ -39,14 +39,9 @@
//config: help
//config: Enable 64-bit support in test.
-/* "test --help" does not print help (POSIX compat), only "[ --help" does.
- * We display "<applet> EXPRESSION ]" here (not "<applet> EXPRESSION")
- * Unfortunately, it screws up generated BusyBox.html. TODO. */
-//usage:#define test_trivial_usage
-//usage: "EXPRESSION ]"
-//usage:#define test_full_usage "\n\n"
-//usage: "Check file types, compare values etc. Return a 0/1 exit code\n"
-//usage: "depending on logical value of EXPRESSION"
+/* "test --help" is special-cased to ignore --help */
+//usage:#define test_trivial_usage NOUSAGE_STR
+//usage:#define test_full_usage ""
//usage:
//usage:#define test_example_usage
//usage: "$ test 1 -eq 2\n"
coreutils/true.c+3 -5
@@ -10,11 +10,9 @@
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */
-//usage:#define true_trivial_usage
-//usage: ""
-//usage:#define true_full_usage "\n\n"
-//usage: "Return an exit code of TRUE (0)"
-//usage:
+/* "true --help" is special-cased to ignore --help */
+//usage:#define true_trivial_usage NOUSAGE_STR
+//usage:#define true_full_usage ""
//usage:#define true_example_usage
//usage: "$ true\n"
//usage: "$ echo $?\n"
libbb/appletlib.c+12 -10
@@ -748,23 +748,25 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
xfunc_error_retval = EXIT_FAILURE;
applet_name = APPLET_NAME(applet_no);
-#if defined APPLET_NO_test
/* Special case. POSIX says "test --help"
* should be no different from e.g. "test --foo".
* Thus for "test", we skip --help check.
+ * "true" and "false" are also special.
*/
- if (applet_no != APPLET_NO_test)
+ if (1
+#if defined APPLET_NO_test
+ && applet_no != APPLET_NO_test
+#endif
+#if defined APPLET_NO_true
+ && applet_no != APPLET_NO_true
#endif
- {
- if (argc == 2 && strcmp(argv[1], "--help") == 0) {
#if defined APPLET_NO_false
- /* Someone insisted that "false --help" must exit 1. Sigh */
- if (applet_no != APPLET_NO_false)
+ && applet_no != APPLET_NO_false
#endif
- {
- /* Make "foo --help" exit with 0: */
- xfunc_error_retval = 0;
- }
+ ) {
+ if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+ /* Make "foo --help" exit with 0: */
+ xfunc_error_retval = 0;
bb_show_usage();
}
}