From nobody Wed Nov 09 06:04:18 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N6ZDL5Btnz4dXvV; Wed, 9 Nov 2022 06:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N6ZDL4dNkz4QX7; Wed, 9 Nov 2022 06:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667973858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6cho68d6JAa6UqnaPRM/34OWAmdmdMGemCdsDwR2rwQ=; b=CFvsfxHzo68bUSgnSHVdDJZwCPHDw+jFHel+wXplTuEDkG/2L0gkw3Y77md+i9R2LQX2vN GgGqv+VzNo8bagks1lACPz05QriFTwsv4WqDmepBZrGGejLY/Zr1B8e6IzP5v3YbF4SvaQ 06uKw/nvGDU25rVvo7j7GMVOUZI5xptmNbZZptj3Y0z7/ff9svrXoKeVDPbm4MjbpTqSJU O/oeNKFk4l+qK7QlBsgIl2xziP6JWqORjdCzXLNLNIDurYJqVPKuIT7e5TD70XrPPXy2uW 5oacC7jlezcldldqE7QZCjALafc0rGFjVOVIhV/nNzm9TAsm6WmO6RpByXHTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667973858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6cho68d6JAa6UqnaPRM/34OWAmdmdMGemCdsDwR2rwQ=; b=QDcM5wQtJOCoaEe2d28k36XNSAVw8//NU+qQ3kKUd1Vgp6I6EijKjas68t3jkN8Mt5Jt3n KtM1IhCkmbjPcjw2+EJ4O7Uhevn1JcEWL89dFbT4J2umDj7EziJJjM0IE/3A0VapDLEpjS 4sqvWZ8w1Qnn1F/4mhTl1/OR0qOSM6k0zaiXlIz/AHT9JINI1r3lvWAZTih7lB7N5GmtHn cPjFU9rGBCRT+S8Ij9xVBYYxIXYu8d2Jbk7SkALg0N1LJbn0tMBtXJi66TmORI5ai6V44K Aoyo/yjUyBj3CCJO71Nu9dAm/mpE2TtzYQKI2CGUFW618I9ERThuEjndujs/wA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667973858; a=rsa-sha256; cv=none; b=I71gW6+AhVrVPe5mWUkCCVHCSvM7zQxgjuccHuL++n+CPpqnuEEC+pymkvRRyo7LIPpLq9 DD4iflXC8g/mT95ExB60FcW66MnSG/zqeIHiL1801MeGk1ds08bzSwMu5SWEMhvLGmxmBS NHcEo+C10botqwdnzTStHAURzm051V0Eb1X9AKuEKfr4EhCjlEOtOIbXh9Z9KYtkAUfRn9 Rro8dmsQT9v75mRfTKSWPtkrvej9vfAOwUQ2FffhAFeZCxxgaes0Pu57i/FI2TEFNEYof9 t4K7ckkmodwGlB1BjEgX+ihTyDi2j7gE/NyVBjC+XwOMl8rAwTaPELcoaZgTYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N6ZDL3gfFz19x7; Wed, 9 Nov 2022 06:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A964ILV036905; Wed, 9 Nov 2022 06:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A964IJV036904; Wed, 9 Nov 2022 06:04:18 GMT (envelope-from git) Date: Wed, 9 Nov 2022 06:04:18 GMT Message-Id: <202211090604.2A964IJV036904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d22f03636be1 - main - mktemp: skip later TMPDIR check if -p is specified List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d22f03636be1c012951f744f414b0d410970808e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d22f03636be1c012951f744f414b0d410970808e commit d22f03636be1c012951f744f414b0d410970808e Author: Kyle Evans AuthorDate: 2022-11-09 06:02:25 +0000 Commit: Kyle Evans CommitDate: 2022-11-09 06:04:04 +0000 mktemp: skip later TMPDIR check if -p is specified We already did the necessary $TMPDIR fallback, if it's going to be used. Skip the later check so that we don't accidentally override our -p argument. Fixes: ac6f924e1c ("mktemp: add -p/--tmpdir argument") Sponsored by: Klara, Inc. --- usr.bin/mktemp/mktemp.c | 6 ++++++ usr.bin/mktemp/tests/mktemp_test.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c index 6f5b21ce70d5..226084fefb49 100644 --- a/usr.bin/mktemp/mktemp.c +++ b/usr.bin/mktemp/mktemp.c @@ -85,6 +85,12 @@ main(int argc, char **argv) tmpdir = optarg; if (tmpdir == NULL || *tmpdir == '\0') tmpdir = getenv("TMPDIR"); + + /* + * We've already done the necessary environment + * fallback, skip the later one. + */ + prefer_tmpdir = false; break; case 'q': diff --git a/usr.bin/mktemp/tests/mktemp_test.sh b/usr.bin/mktemp/tests/mktemp_test.sh index 60555f1b561b..505c60536b34 100755 --- a/usr.bin/mktemp/tests/mktemp_test.sh +++ b/usr.bin/mktemp/tests/mktemp_test.sh @@ -69,7 +69,7 @@ tmpdir_pflag_body() # Finally, combined -p -t atf_check -o match:"^$pflag/foo\..+$" \ env -u TMPDIR mktemp -p "$pflag" -t foo - atf_check -o match:"^$tmpdir/foo\..+$" \ + atf_check -o match:"^$pflag/foo\..+$" \ env TMPDIR="$tmpdir" mktemp -p "$pflag" -t foo }