https://bugs.openldap.org/show_bug.cgi?id=9209
Bug ID: 9209 Summary: test072/test075 fail on Solaris due to buggy test script Product: OpenLDAP Version: 2.5 Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: slapd Assignee: bugs@openldap.org Reporter: quanah@openldap.org Target Milestone: ---
Both test072 and test075 have this logic:
if test -z `which dsadm`; then echo "DSEE dsadm not in path, test skipped" exit 0 fi
This works fine on Linux, however it does not work on Solaris causing the test to execute (and then fail).
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |OL_2_5_REQ Target Milestone|--- |2.5.0
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |CONFIRMED Ever confirmed|0 |1
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #1 from Quanah Gibson-Mount quanah@openldap.org --- -bash-3.2$ ./run test075 Cleaning up test run directory leftover from previous run. Running /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist for mdb... running defines.sh Setting up DSEE provider slapd on TCP/IP port 9011... /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsadm: not found /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsadm: not found /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsconf: not found /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsconf: not found /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsconf: not found /export/home/build/sold/openldap/tests/scripts/test075-dsee-persist: dsadm: not found Using ldapsearch to check that provider slapd is running... Waiting 5 seconds for slapd to start... Waiting 5 seconds for slapd to start... Waiting 5 seconds for slapd to start... Waiting 5 seconds for slapd to start...
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|test072/test075 fail on |test072/test075 fail on |Solaris due to buggy test |Solaris10 due to buggy test |script |script OS|All |Solaris
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- Problem is that "which" on Solaris 10 returns output when it doesn't find a command:
-bash-3.2$ which blah no blah in /opt/csw/bin /usr/bin /bin
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- Even when using the Gnu which from CSW on Solaris 10, it bugs out if the result is empty:
/export/home/build/sold/openldap/tests/scripts/test072-dsee-sync: test: argument expected
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|OL_2_5_REQ | Resolution|--- |TEST Status|CONFIRMED |RESOLVED
--- Comment #4 from Quanah Gibson-Mount quanah@openldap.org --- Commits: • c5acb1d3 by Howard Chu at 2020-04-17T21:00:07+01:00 ITS#9209 fix test
2 changed files: • tests/scripts/test072-dsee-sync • tests/scripts/test075-dsee-persist
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|TEST |--- Status|RESOLVED |CONFIRMED
--- Comment #5 from Quanah Gibson-Mount quanah@openldap.org --- Still does not work with c5acb1d3
Using the Solaris supplied which, we get:
Running /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync for mdb... running defines.sh /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync: test: unknown operator dsadm -bash-3.2$ echo $? 1
Using GNU which, we get: Running /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync for mdb... running defines.sh which: no dsadm in (/opt/csw/gnu:/opt/csw/bin:/usr/bin:/bin) /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync: test: argument expected -bash-3.2$ echo $? 1
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #6 from Quanah Gibson-Mount quanah@openldap.org --- "command -v" seems more portable, as a replacement for "which".
I.e.:
command -v dsadm
Works on both linux and Solaris at least.
Still have issues with the test statement though:
Running /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync for mdb... running defines.sh /export/home/build/sold/openldap/tests/scripts/test072-dsee-sync: test: argument expected -bash-3.2$ echo $? 1
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #7 from Quanah Gibson-Mount quanah@openldap.org --- command -v works for FreeBSD as well
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #8 from Quanah Gibson-Mount quanah@openldap.org --- This works for me:
TEST=`command -v dsadm` if test -z "$TEST"; then
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #9 from Quanah Gibson-Mount quanah@openldap.org --- Works on linux as well.
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |IN_PROGRESS
--- Comment #10 from Quanah Gibson-Mount quanah@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/45
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|IN_PROGRESS |RESOLVED Resolution|--- |TEST
--- Comment #11 from Quanah Gibson-Mount quanah@openldap.org --- commit c5acb1d377cda624695f1a93ce8e24da6f846f8d Author: Howard Chu hyc@openldap.org Date: Fri Apr 17 21:00:07 2020 +0100
ITS#9209 fix test
commit 94ef2c9b43db43e2370905614b267e46cc891c6d Author: Howard Chu hyc@openldap.org Date: Sat Apr 18 01:29:26 2020 +0100
ITS#9209 quote test argument
https://bugs.openldap.org/show_bug.cgi?id=9209
Ryan Tandy ryan@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CONFIRMED Resolution|TEST |---
--- Comment #12 from Ryan Tandy ryan@openldap.org --- The last commits fixed this for GNU which (/opt/csw/gnu/which), but not for the built-in which (/usr/bin/which), which prints its error message to stdout.
Running with set -x, test072 does this:
+ which dsadm + test ! no dsadm in /usr/xpg6/bin /usr/sfw/bin /usr/ccs/bin /usr/bin /opt/csw/bin + mkdir -p /export/home/ryan/openldap/tests/testrun /export/home/ryan/openldap/tests/testrun/db.2.a
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #13 from Howard Chu hyc@openldap.org --- (In reply to Ryan Tandy from comment #12)
The last commits fixed this for GNU which (/opt/csw/gnu/which), but not for the built-in which (/usr/bin/which), which prints its error message to stdout.
Running with set -x, test072 does this:
- which dsadm
- test ! no dsadm in /usr/xpg6/bin /usr/sfw/bin /usr/ccs/bin /usr/bin
/opt/csw/bin
- mkdir -p /export/home/ryan/openldap/tests/testrun
/export/home/ryan/openldap/tests/testrun/db.2.a
Sounds like a ridiculously broken "which". That test is checking the exit status of which, and it should be non-zero if the command wasn't found.
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #14 from Ryan Tandy ryan@openldap.org --- (In reply to Howard Chu from comment #13)
Sounds like a ridiculously broken "which". That test is checking the exit status of which, and it should be non-zero if the command wasn't found.
Unfortunately so:
ryan@sol10:~$ which dsadm no dsadm in /usr/xpg6/bin /usr/sfw/bin /usr/ccs/bin /usr/bin /opt/csw/bin ryan@sol10:~$ echo $? 0
/usr/bin/which on the most recent release of Solaris 10.
It's actually a csh script... you can see the whole thing at https://unix.stackexchange.com/a/408550
I tried Quanah's suggestion of 'command -v'... that one seems to work on every platform I've touched lately. Shellcheck recommends it, too.
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #15 from Ryan Tandy ryan@openldap.org --- (In reply to Ryan Tandy from comment #14)
It's actually a csh script... you can see the whole thing at https://unix.stackexchange.com/a/408550
Ignore this -- the one pasted there has a "set exit_status = 1" which is _not_ in the original... I guess that poster fixed theirs locally :)
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #16 from Howard Chu hyc@openldap.org --- (In reply to Ryan Tandy from comment #15)
(In reply to Ryan Tandy from comment #14)
It's actually a csh script... you can see the whole thing at https://unix.stackexchange.com/a/408550
Ignore this -- the one pasted there has a "set exit_status = 1" which is _not_ in the original... I guess that poster fixed theirs locally :)
I already tested this fix on a vanilla Solaris 10 system, and the exit status was as expected.
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #17 from Ryan Tandy ryan@openldap.org --- (In reply to Howard Chu from comment #16)
I already tested this fix on a vanilla Solaris 10 system, and the exit status was as expected.
May I ask which "which" it actually executed on your test system?
I apologize for wasting your time, but I'd like to understand where I'm getting this wrong... "pkgchk SUNWcsu" confirms my /usr/bin/which is clean (sum(1) returns 25204); I don't see any other package on the DVD providing a 'which' command; and it still behaves as I pasted two comments ago...
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #18 from Quanah Gibson-Mount quanah@openldap.org --- (In reply to Ryan Tandy from comment #17)
(In reply to Howard Chu from comment #16)
I already tested this fix on a vanilla Solaris 10 system, and the exit status was as expected.
May I ask which "which" it actually executed on your test system?
I apologize for wasting your time, but I'd like to understand where I'm getting this wrong... "pkgchk SUNWcsu" confirms my /usr/bin/which is clean (sum(1) returns 25204); I don't see any other package on the DVD providing a 'which' command; and it still behaves as I pasted two comments ago...
It wasn't a vanilla system. ;)
https://bugs.openldap.org/show_bug.cgi?id=9209
--- Comment #19 from Quanah Gibson-Mount quanah@openldap.org --- I have a feeling test067 has similar issues.
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |RESOLVED Resolution|--- |TEST
--- Comment #20 from Quanah Gibson-Mount quanah@openldap.org --- Commits: • ce23aee9 by Quanah Gibson-Mount at 2020-09-04T22:06:15+00:00 ITS#9209 - Use portable command instead of which for determining if binaries are present
https://bugs.openldap.org/show_bug.cgi?id=9209
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED Resolution|TEST |FIXED