Update of bug #68587 (group findutils):
Status: None => Code Review
Assigned to: None => berny
_______________________________________________________
Follow-up Comment #1:
Thanks for the suggestion.
> diff --git a/locate/updatedb.sh b/locate/updatedb.sh
> index 4014a4bf..e2d26788 100644
> --- a/locate/updatedb.sh
> +++ b/locate/updatedb.sh
> @@ -121,15 +121,17 @@ getuid() {
> # uid=1(daemon) gid=1(other)
> # for `id's that don't understand -u
> id | cut -d'(' -f 1 | cut -d'=' -f2
> }
>
> # figure out if su supports the -s option
> select_shell() {
> - if su "$1" -s $SHELL -c false < /dev/null ; then
> + if [ "$updatedbuserchange" = "runuser" ] ; then
> + echo "-s $SHELL"
> + elif su "$1" -s $SHELL -c false < /dev/null ; then
> # No.
> echo ""
This does not test whether runuser(1) actually works or not.
E.g. if some regular user's PATH includes /sbin, then which(1) below would
find the tool, but it still would not work.
$ /sbin/runuser someuser - true
runuser: may not be used by non-root users
> else
> if su "$1" -s $SHELL -c true < /dev/null ; then
> # Yes.
> echo "-s $SHELL"
> else
> @@ -278,26 +280,32 @@ sysfs
> if test -n "$PRUNEFS"; then
> prunefs_exp=`echo $PRUNEFS |sed -e 's/\([^ ][^ ]*\)/-o -fstype \1/g' \
> -e 's/-o //' -e 's/$/ -o/'`
> else
> prunefs_exp=''
> fi
>
> +if which runuser 2>&1 ; then
> + updatedbuserchange=runuser
> +else
> + updatedbuserchange=su
> +fi
> +
I'm not sure about this redirection of stderr to stdout.
Did you mean
if which runuser >/dev/null 2>&1 ; then
?
I've fixed both, and added documentation (man+texi) and a NEWS entry.
Good to push the attached?
(file #58871)
_______________________________________________________
Additional Item Attachment:
[PATCH] updatedb: prefer runuser(1) over su(1)
Name: 0001-updatedb-prefer-runuser-1-over-su-1.patch Size: 4.9KiB
<https://file.savannah.gnu.org/file/0001-updatedb-prefer-runuser-1-over-su-1.patch?file_id=58871>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-a6bd2af55ecbc1d79b276bb1fd2fc3899046f847.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68587>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
