From patchwork Wed Nov 20 16:57:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nl6720 X-Patchwork-Id: 1381 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id D6435152F035B for ; Wed, 20 Nov 2019 16:57:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED=0.001, DKIM_INVALID=1,DKIM_SIGNED=0.1,FREEMAIL_FROM=0.5,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01, T_DMARC_SIMPLE_DKIM=0.01 autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 20 Nov 2019 16:57:38 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 223FC16C093B1B; Wed, 20 Nov 2019 16:57:34 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id C1F7B16C093B17; Wed, 20 Nov 2019 16:57:33 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BSw0ueS+ Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id BA2C92CAC7; Wed, 20 Nov 2019 16:57:33 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BSw0ueS+ Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 718F72CAC6 for ; Wed, 20 Nov 2019 16:57:30 +0000 (UTC) Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 20 Nov 2019 16:57:30 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id v8so28326131ljh.5 for ; Wed, 20 Nov 2019 08:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QB1BCUt8UFlTTz/ZtkC8bj1VvtRS7zLnaqHrVSqymdo=; b=BSw0ueS+3LdtKKUGuC9owCilQ1TRsEiJu8FkBZx5jI0INvOyXmB4u8cQ6VEcVtQM8Q BAlLHOP7SkiV3mp+V5R4d+e0hgEDnsT4XVC7aImuhd5nNjFcQlW6Ie5yO+dNOsKbiAV2 CnDe2dB4pwx7Uz7uf1ouUwJJKSXeKEzKLfTl/8CW+T3OdvCpMfRv+RKaq90m8teiA0kY qYbXY0/NJbJBL0fYEqz1bxLUgj5p698tWB1zaOZ5w3F4/MuZ0+27XQhP3aIDqhtOpxch Vw340KciRBHMUNS4LqTwRYk6YAlwFzuN1s1SJfX+OTsNeD9hv/T04mGvmImpXwKzYHAE nCNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QB1BCUt8UFlTTz/ZtkC8bj1VvtRS7zLnaqHrVSqymdo=; b=cyYoEFTJUbNVIN4skNyBUVS8kRkVatz6+AbsEJNuMLxrWL5MC4Rf1BlE5Xi7EmXOBE IF4VpTdg/qMoKoocX2bIBL1wm+gtLAOvUHSjyd+YoAovpsF7QOif+ufuIhXGYRYiueKO viAIm5zLaq53iAn6CZdk9CUhZ9+fY9EsObW72JokLtlXBxMbTEQdbwV5N6O5wd0NJQPm ZvdgV1dzmwx4H1Y+plA1tGfeLE0hoDHFgHJLgvuBZYFSrlFiALtSrd1VDIPf1t+cDYNh AUJhOGPqcrVFeAHFEYBbtnLIEfOW1w4nMiMtaPGEEPHdkQ7Ta8A3wCfxreaP54FEPNfV PPWg== X-Gm-Message-State: APjAAAVWGvI+FsGGdEoWF8b+Y4eHPNgXQ375rrUO2g2TJLCHf4ZFsZLN nCQWHFOYrdsri6a2In+DKCNUHcfz/JI= X-Google-Smtp-Source: APXvYqxgD2AHEEJi+1y4/kr0wOCPM2koTFtLU2T4L/c5yXlus2Juv8EIztcAV7bhQnHXEyqE6FB7HQ== X-Received: by 2002:a2e:9699:: with SMTP id q25mr3667600lji.251.1574269048793; Wed, 20 Nov 2019 08:57:28 -0800 (PST) Received: from walnut.lan (balticom-231-46.balticom.lv. [83.99.231.46]) by smtp.gmail.com with ESMTPSA id z22sm11948704ljm.92.2019.11.20.08.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 08:57:28 -0800 (PST) From: nl6720 To: pacman-contrib@lists.archlinux.org Subject: [PATCH] checkupdates: use $UID instead of $USER in temporary directory path Date: Wed, 20 Nov 2019 18:57:07 +0200 Message-Id: <20191120165707.34383-1-nl6720@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: pacman-contrib@lists.archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for pacman-contrib development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pacman-contrib-bounces@lists.archlinux.org Sender: "pacman-contrib" 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 --- 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