#48939 nsslapd-workingdir is empty when ns-slapd is started by systemd
Closed: wontfix Opened by nhosoi.

Description of problem:
nsslapd-workingdir is empty when ns-slapd is started by systemd. When ns-slapd
is started manually, the attribute has value.
How reproducible:
Always
Steps to Reproduce:
1. start-dirsrv
2. ldapsearch -D "cn=Directory manager" -W -b cn=config | grep
^nsslapd-workingdir
Actual results:
ldapsearch returns empty attribute
ldapsearch -D "cn=Directory manager" -W -b cn=config | grep
^nsslapd-workingdir
nsslapd-workingdir:
Expected results:
ldapsearch -D "cn=Directory manager" -W -b cn=config | grep
^nsslapd-workingdir
nsslapd-workingdir: /var/log/dirsrv/slapd-test
Additional info:
Bug was found by Simon Pichugin

Thank you so much for sharing the fixing idea and reviewing the patch, William!

Pushed to master:
ce44176..a06cb42 master -> master
commit a06cb4269613224e1454ed8c1ad6f702cc247b2b

Hi Noriko,

The fix looks good. two minor comments.
The previous set_workingdir used to skip ending '/' and '\'. The new fix does not skip ending '\' is it intentional ?
Also if errorlog directory is not accessible/writable, workingdir is not reset to '/'.

Replying to [comment:5 tbordaz]:

Hi Noriko,

The fix looks good. two minor comments.
The previous set_workingdir used to skip ending '/' and '\'. The new fix does not skip ending '\' is it intentional ?
Yes, the code is for Windows. Since we already removed windows code, I think we could get rid if it there, too.

Also if errorlog directory is not accessible/writable, workingdir is not reset to '/'.
A good point! Thanks, Thierry. I'm adding this one line.
{{{
diff --git a/ldap/servers/slapd/detach.c b/ldap/servers/slapd/detach.c
index cd13a99..46eb714 100644
--- a/ldap/servers/slapd/detach.c
+++ b/ldap/servers/slapd/detach.c
@@ -67,6 +67,7 @@ set_workingdir()
rc = chdir(errorlog);
if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ rc = chdir("/");
}
slapi_ch_free_string(&errorlog);
}
}}}

git patch file (master) -- additional fix suggested by tbordaz@redhat.com (Thanks, Thierry!!)
0001-Ticket-48939-nsslapd-workingdir-is-empty-when-ns-sla.2.patch

Reviewed by Mark (Thanks!!)

Pushed to master:
7a92bcf..70d06da master -> master
commit 70d06dab96468e0c6712482186f22de8e2c33e17

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

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1998

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

Metadata