The wrapper mongodb script could use exec in the last step to eliminate one additional floating process. The wrapper also doesn't deal with spaces in any arguments (which currently isn't an issue, but one never know in the future), as such, I'm proposing replacement with the attached. The proposed change does not affect functionality in any way, it merely gets the shell process out of the system. Reproducible: Always
Created attachment 632748 [details] mongod replacement wrapper script
I'll be honest, I don't understand the logic in the for loop, and I don't understand how spaces could be a problem for the sed I'm doing now. Adding exec seems like a good idea though.
It loops through the arguments one by one, shifting it out, and then appending it onto the arguments again once it's decided it must stay. for arg in "$@"; do would have been more complete. Let's say: $1="/some path/with spaces" $2="--removearg" $3="--removearg-but-not-quite" Your logic would end up with: $1="/some" $2="path/with" $3="spaces" $4="-but-not-quite" Mine would end up with: $1="/some path/with spaces" $2="--removearg-but-not-quite" If you really only want to take the exec that's also fine by me. The space scenario as well as the matching argument within another is unlikely enough that I won't push the issue.
Thanks for the explanation, it (mostly) makes sense and the few tests I tried to behave as we want.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dec01d375dab043eaf11cf012958e9843745705f commit dec01d375dab043eaf11cf012958e9843745705f Author: Ben Kohler <bkohler@gentoo.org> AuthorDate: 2020-04-14 17:48:09 +0000 Commit: Ben Kohler <bkohler@gentoo.org> CommitDate: 2020-04-14 17:54:27 +0000 net-wireless/unifi: mongod-wrapper improvements Thanks to Jaco Kroon Closes: https://bugs.gentoo.org/717396 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Ben Kohler <bkohler@gentoo.org> net-wireless/unifi/files/mongod-wrapper | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)