Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1255851

Summary: Shell CLI fails with usage errors if an argument containing white spaces is given
Product: Red Hat Enterprise Linux 7 Reporter: Noriko Hosoi <nhosoi>
Component: 389-ds-baseAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: high    
Version: 7.0CC: amsharma, lmiksik, nkinder, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.4.0-14.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:44:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Noriko Hosoi 2015-08-21 17:01:40 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/48254

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.
}}}

Comment 1 Noriko Hosoi 2015-08-21 17:02:20 UTC
Justification: since CLI db2index is not usable, we should fix it.

Comment 2 Viktor Ashirov 2015-08-22 16:00:35 UTC
*** Bug 1255850 has been marked as a duplicate of this bug. ***

Comment 5 Noriko Hosoi 2015-08-26 01:29:50 UTC
Steps to verify:
1. sh -x db2index -Z YOURID -n userRoot -t cn
If it does not fail with "userRoot=", one bug is verified.
+ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-YOURID -n userRoot=

2. Run following CLIs with args including white spaces.  For instance, most of them takes "-s SUFFIX", where SUFFIX could be "dc=example, dc=com".  Or directory name could be 'dir with spaces".
  /usr/sbin/db2index
  /usr/sbin/bak2db
  /usr/sbin/db2bak
  /usr/sbin/db2index
  /usr/sbin/db2ldif
  /usr/sbin/ldif2db
  /usr/sbin/vlvindex
If no syntax error is returned, the fix is verified.

Comment 6 Amita Sharma 2015-09-15 07:46:02 UTC
1. Issue1 tested

 sh -x db2index -Z /etc/dirsrv/slapd-dhcp201-167 -n userRoot -t cn
++ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-dhcp201-167 -n userRoot -t cn
[15/Sep/2015:12:51:06 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:12:51:06 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58158
[15/Sep/2015:12:51:06 +051800] - Import allocates 753648KB import cache.
[15/Sep/2015:12:51:06 +051800] - userRoot: Indexing attribute: cn
[15/Sep/2015:12:51:06 +051800] - userRoot: Finished indexing.
[15/Sep/2015:12:51:06 +051800] - All database threads now stopped

2. White spaces tested::

[root@dhcp201-167 export]# db2index -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -t cn
[15/Sep/2015:13:00:49 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:13:00:49 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58306
[15/Sep/2015:13:00:49 +051800] - Import allocates 753648KB import cache.
[15/Sep/2015:13:00:49 +051800] - redhatdb: Indexing attribute: cn
[15/Sep/2015:13:00:49 +051800] - redhatdb: Finished indexing.
[15/Sep/2015:13:00:49 +051800] - All database threads now stopped

[root@dhcp201-167 export]# /usr/sbin/db2ldif -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com"Exported ldif file: /var/lib/dirsrv/slapd-dhcp201-167/ldif/dhcp201-167-redhatdb-redhat-2015_09_15_130421.ldif
ldiffile: /var/lib/dirsrv/slapd-dhcp201-167/ldif/dhcp201-167-redhatdb-redhat-2015_09_15_130421.ldif
[15/Sep/2015:13:04:21 +051800] - All database threads now stopped

 /usr/sbin/ldif2db -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -i /export/data.ldif 
importing data ...
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Created ancestorid index (new idl).
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Flushing caches...
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Closing files...
[15/Sep/2015:13:07:25 +051800] - All database threads now stopped
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Import complete.  Processed 105 entries (105 were skipped) in 7 seconds. (15.00 entries/sec)

[root@dhcp201-167 export]# vlvindex -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -T myVLVIndex 
[15/Sep/2015:13:10:04 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:13:10:04 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58305
[15/Sep/2015:13:10:04 +051800] - Import allocates 753648KB import cache

Hence VERIFIED.

[root@dhcp201-167 export]# rpm -qa | grep 389
389-ds-base-1.3.4.0-15.el7.x86_64
389-ds-base-debuginfo-1.3.4.0-1.el7.x86_64
389-ds-base-libs-1.3.4.0-15.el7.x86_64

Comment 7 errata-xmlrpc 2015-11-19 11:44:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2351.html