From patchwork Wed Nov 20 14:33:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nl6720 X-Patchwork-Id: 1380 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 26E95152E9866 for ; Wed, 20 Nov 2019 14:33:25 +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 14:33:25 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id E64C116C04AC4E; Wed, 20 Nov 2019 14:33:22 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (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 B704A16C04AC4A; Wed, 20 Nov 2019 14:33:22 +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=X7l85BQS Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id AC2EB2CAC7; Wed, 20 Nov 2019 14:33:22 +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=X7l85BQS Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id F375F2CAC6 for ; Wed, 20 Nov 2019 14:33:19 +0000 (UTC) Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 20 Nov 2019 14:33:19 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id q28so20372375lfa.5 for ; Wed, 20 Nov 2019 06:33:19 -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:mime-version :content-transfer-encoding; bh=1uqa/VlONt8sqgvc+TqQxOkD5bYHXLzsEz9tpIlNvmE=; b=X7l85BQS44HCRxcEMQJgYyD3fu2BaBMmxHtDglYNp9i98PZ+WIsvjCw+FHMBK2Hhke x54bAWvr/k2EZV8doCa4P42Of+3dtdYWIZDGBRD7P6LZHsCJomxXaNg0b5gnRUupMPSx nsfT3JimtspFn4w/FvyOn5gTeIF67BbW6HLz/4gXfUf+dUPrEza6EVvwoZQfFgLj0I28 aOBL7s7RWsHNSfxkCglYRV7gsq+kRvC5Fs0us/IIX1G3pOAA7R0hr3JJVPcW1nSrAnP0 zE1Tou6oTGn1OBAbvwFUPTcrHCKzryK3LrExW429trk8CLKJo44am1WpEipwyl0vxVOc 7QAg== 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:mime-version :content-transfer-encoding; bh=1uqa/VlONt8sqgvc+TqQxOkD5bYHXLzsEz9tpIlNvmE=; b=uYF36SEIr0GryDfCcIHVZLoq+QMOlV5kCgC/iZQPJpHfVCprs4U+Le88XzUusfDsnU hEhQiWvyrz4Nc31tmuQIv98RtvIeJKZRW8QxHXQlyN6OZ8eLl2xeXJQkuSZDZmhps/fF xEow6CLde20dyvV50vSdMxRoccvlyOX7WsNpRPERoLJcFJjGbtWfwnljNWWYeCJeVJv+ 2ov542BtPs+UHCWpJPTr3ICVczOw9iB6KnPYWeCsWDPQZCyZz8gKzQ4V2WpNj5OGz7dh rQGwUQ3CWD+wFyWf39ep/NS6Z+DrHxEbC8EvG4ma8Q+H06g7w8cnjkYPmNMp5jPW6ynX em5Q== X-Gm-Message-State: APjAAAVNNmkWa9eSNtuSk5xe/d1a1Uw4UCHbVPAcgv4oj/jyI2KtACrU gNLX9z+VhjwLkhk8Jud+o3KR4O/eE64= X-Google-Smtp-Source: APXvYqxnfOxXsZMELvAWEeQdPDVuIO/Cfu1TMmybgx9ofVnxDnxJcWqTn3Ff5ApcDYdqDazp+2Yt+w== X-Received: by 2002:ac2:46c9:: with SMTP id p9mr2912769lfo.166.1574260397792; Wed, 20 Nov 2019 06:33:17 -0800 (PST) Received: from walnut.lan (balticom-231-46.balticom.lv. [83.99.231.46]) by smtp.gmail.com with ESMTPSA id a11sm11736213ljp.97.2019.11.20.06.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 06:33:17 -0800 (PST) From: nl6720 To: pacman-contrib@lists.archlinux.org Subject: [PATCH] checkupdates: use $UID in temporary directory path if $USER is not set Date: Wed, 20 Nov 2019 16:33:12 +0200 Message-Id: <20191120143312.26400-1-nl6720@gmail.com> X-Mailer: git-send-email 2.24.0 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. Fall back to $UID 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..f2c468c 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-${USER:-$UID}/" fi trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT