#48254 Shell CLI fails with usage errors if an argument containing white spaces is given
Closed: Fixed None Opened 4 years ago by nhosoi.

For instance, if db2index is run against the standard browsing index, it fails.

sh -x /usr/sbin/db2index -Z SERVERID -n userRoot -T "by MCC ou=People dc=example dc=com"

+ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-SERVERID -n userRoot= -T by MCC ou=People dc=example dc=com
usage: ns-slapd db2index -D configdir -n backend-instance-name [-d debuglevel] {-t attributetype}* {-T VLV Search Name}*

There are 2 issues.

1. '=' is accidentally added to "userRoot"
2. "by MCC ou=People dc=example dc=com" is not passed as one string, but as separate words.

I didn't know you could preserve whitespace with eval like that. Good to know.

Reviewed by Rich (Thank you!!)

Pushed to master:
db7153f..3507c46 master -> master
commit 3507c46

Pushed to 389-ds-base-1.3.4:
1781280..a6d7e3b 389-ds-base-1.3.4 -> 389-ds-base-1.3.4
commit a6d7e3b

Pushed to 389-ds-base-1.3.3:
5c48f28..7f63b58 389-ds-base-1.3.3 -> 389-ds-base-1.3.3
commit 7f63b58

Should we apply the "eval" change to all the DS scripts?

Replying to [comment:6 mreynolds]:

Should we apply the "eval" change to all the DS scripts?

Probably... The "eval" was added to keep the spaces in the shell command line arg, e.g., "by MCC ou=People dc=example dc=com". I thought the cases are rare, but...

For instance, this works:
/usr/sbin/db2ldif -Z test -s "dc=example,dc=com"
but this fails...
/usr/sbin/db2ldif -Z test -s "dc=example, dc=com"
And, this command line fails, too... :(
/usr/sbin/db2ldif -Z test -n userRoot -a /tmp/'a b c'
Exported ldif file: /tmp/a
usage: ns-slapd db2ldif -D configdir [-n backend-instance-name] [-d debuglevel] [-N] [-a outputfile] [-r] [-C] [{-s includesuffix}] [{-x excludesuffix}] [-u] [-U] [-m] [-M] [-E] [-q]
Note: either "-n backend_instance_name" or "-s includesuffix" is required.
Updatinng the summary and reopening it.

git patch file (master) -- applying the similar changes to all the shell CLI

Reviewed by Mark (Thank you!!)

Pushed to master:
3507c46..5fe2892 master -> master
commit 5fe2892

Pushed to 389-ds-base-1.3.4:
a6d7e3b..19b0d4a 389-ds-base-1.3.4 -> 389-ds-base-1.3.4
commit 19b0d4a

Metadata Update from @nhosoi:
- Issue assigned to nhosoi
- Issue set to the milestone:

2 years ago

Login to comment on this ticket.