Bug 13521

Summary: start-stop-daemon: test failed with -a option
Product: Busybox Reporter: dharan <dharanendiran>
Component: Standard ComplianceAssignee: unassigned
Status: ASSIGNED ---    
Severity: major CC: busybox-cvs
Priority: P5    
Version: 1.31.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: busybox-1.32.1-config-file
Strace log

Description dharan 2021-02-05 17:04:37 UTC
Created attachment 8756 [details]
busybox-1.32.1-config-file

When running testsuite, one of the "start-stop-daemon" testcases fails:

# ./runtest  -v start-stop-daemon
======================
echo -ne '' >input
echo -ne '' | start-stop-daemon -S -x true 2>&1; echo $?
PASS: start-stop-daemon -x without -a
======================
echo -ne '' >input
echo -ne '' | start-stop-daemon -S -a false 2>&1; echo $?
PASS: start-stop-daemon -a without -x
======================
echo -ne '' >input
echo -ne '' | start-stop-daemon -S false 2>&1; echo $?
PASS: start-stop-daemon without -x and -a
======================
echo -ne '' >input
echo -ne '' | start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?
FAIL: start-stop-daemon with both -x and -a
--- expected
+++ actual
@@ -1 +1,2 @@
-1
+qwerty: applet not found
+127
#
Comment 1 dharan 2021-02-09 05:13:07 UTC
Hi Team,

   Can you please share update on requested failed case. 

Regards,
-Dharan
Comment 2 dharan 2021-02-10 11:04:50 UTC
Created attachment 8761 [details]
Strace log
Comment 3 Denys Vlasenko 2021-03-09 00:11:59 UTC
your /bin/false is a symplink to busybox?

Then the failure is expected: busybox looks at argv[0] to determine what to do.
Comment 4 dharan 2021-03-10 05:55:41 UTC
Hi Denys,

> your /bin/false is a symplink to busybox?

Yes, the /bin/false command is symbolic link to /bin/busybox.

> Then the failure is expected: busybox looks at argv[0] to determine what to do.

In this case, the test case output should be PASS right instead of FAIL?

----------------------------------
echo -ne '' | start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?
FAIL: start-stop-daemon with both -x and -a
--- expected
+++ actual
@@ -1 +1,2 @@
-1
+qwerty: applet not found
+127
----------------------------------

Regards,
-Dharan
Comment 5 Denys Vlasenko 2021-03-10 10:47:19 UTC
>Yes, the /bin/false command is symbolic link to /bin/busybox.
>
>> Then the failure is expected: busybox looks at argv[0] to determine what to do.
>
>In this case, the test case output should be PASS right instead of FAIL?

No, it'll fail. busybox looks at argv[0] to determine what to do. In this case, it sees "qwerty" in argv[0] and acts accordingly: says "qwerty: applet not found".