[PATCH] checkupdates: use $UID instead of $USER in temporary directory path

Johannes Löthberg johannes at kyriasis.com
Sat Dec 14 00:04:35 UTC 2019


Excerpts from nl6720's message of November 20, 2019 17:57:
> If $USER is not set when running checkupdates, the temporary directory's
> name will be "checkup-db-". This will cause issues if multiple users run
> checkupdates. A common situation where $USER is not set is when a command
> is executed with systemd-run, e.g. from a systemd unit.
> See https://github.com/systemd/systemd/pull/8227 for details.
> 
> Replace the usage of $USER with $UID since it is guaranteed to exist and so
> that the temporary directory is isolated per-user.
> 
> Signed-off-by: nl6720 <nl6720 at gmail.com>
> ---
>  src/checkupdates.sh.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/checkupdates.sh.in b/src/checkupdates.sh.in
> index 52f8899..ba9b960 100644
> --- a/src/checkupdates.sh.in
> +++ b/src/checkupdates.sh.in
> @@ -85,7 +85,7 @@ if ! type -P fakeroot >/dev/null; then
>  fi
>  
>  if [[ -z $CHECKUPDATES_DB ]]; then
> -	CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/"
> +	CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${UID}/"
>  fi
>  
>  trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT
> -- 
> 2.24.0
> 

Applied, thanks!
-- 
Sincerely,
  Johannes Löthberg :: SA0DEM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 1727 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/pacman-contrib/attachments/20191214/23a27285/attachment.sig>


More information about the pacman-contrib mailing list