From nobody Wed Mar 26 01:29:06 2025 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 4ZMq2C5rBDz5s5kD; Wed, 26 Mar 2025 01:29:07 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZMq2C079Tz3rlF; Wed, 26 Mar 2025 01:29:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742952547; 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=xuQjsuSSsdKa2i0vcUh+B2KHLYPqZAuf/9rJg7Xemmo=; b=CYSwzxpfRYgUoXSYnhdxxtBYM2z+FmnGjum7zEvMgYPb0tpoUQDz/ps0yDYEA4Nu8KOzXN 9W87xUHV/q8i1axWXGp/68zBCZHmYxZ/CQDK+lA6rZhbfT0uzZNH31lN0xIWFNmDAQ9iua VgeIaIc1dfqydTc/ug7WgN5aY+ocpfOuy+3E+cMhCFKbsl2eyvgycbuLgYWfGg2esTIx0y TUn59ss/npcXCbBEBTWm3i/l58X12tcu9atQXmLHl9iEirFDgz7Nu5+UzM3I/FiobsME7s KgznEPXRe9EPZN4dcwxket3N3dHTVGSfOWlgN16Anztv1JQ+Qbzv3j26RWSbjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742952547; a=rsa-sha256; cv=none; b=G8TNPpTofSrGYx9dXZ3VbUJECC/GivJIfPUcxNFc0YkfjZjzNU5dFk+CCQwp1msulovgNN 86rYFMSLmUZ7hXQAix8wB3BqkZ36AgzKo6TS9QY7ftKh7VUvHwBnXeUSanDmW4z7VmcEYr ILmlJscajwlBxQx2X2u6+7Pkiw44pVeCBDu3kvZpgukhsJUljS40zg5SRtaOViE8d15fGu 8n/xW+a+KpzmzpLYG1SzgQzhbsYNbxASm82rfeT1hpVRgUoVgundLVVE0iHFBBh1hTnfvK 91jaVeIxEIw0qJeLuZxa24Xc49i1eS0uNXN+sRBsfWxkgUqmdZm8fVBo+gZxFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742952547; 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=xuQjsuSSsdKa2i0vcUh+B2KHLYPqZAuf/9rJg7Xemmo=; b=vDuCceEgwOFV43FjnG8r1JY8lLGw64yLEy5uuhvLxvfRK0rvremv3F1seJM9iJ6FRjhsSH BslG0W4kuSyamZk8/phTL9UTFUB1tfDbG7C5yGDitKvbSsanJiSX25MoNJVLy/u4ZxFwQy Ch47CckerLepZCnREz/bxAWQh79LEZdpgX+GSQrEWB8qfTzbH0KtcCOK/ee4wRU8h7BcTv DmbGwpUDpvlOI/Idf4QsBqwZoA3BQ3SzQQhaCrCFyi0impWRFk2MrsMfn0ByPFqoMjcmsG JhSGZPkJJfAa+MmYpb5VcGP+cvcODmaCuxVeuztgPdMBZQgsvcyMu7XYZBbuug== 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 4ZMq2B6ZbXz14Yr; Wed, 26 Mar 2025 01:29:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 52Q1T6mG047495; Wed, 26 Mar 2025 01:29:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52Q1T6HK047492; Wed, 26 Mar 2025 01:29:06 GMT (envelope-from git) Date: Wed, 26 Mar 2025 01:29:06 GMT Message-Id: <202503260129.52Q1T6HK047492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c0e07c93e858 - stable/14 - install: print directory name instead of file name if mkstemp fails 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c0e07c93e858136c6b10d26810e9405e79ad2fb5 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c0e07c93e858136c6b10d26810e9405e79ad2fb5 commit c0e07c93e858136c6b10d26810e9405e79ad2fb5 Author: Ahmad Khalifa AuthorDate: 2024-08-14 14:26:04 +0000 Commit: Warner Losh CommitDate: 2025-03-26 01:28:39 +0000 install: print directory name instead of file name if mkstemp fails Printing the file name doesn't make sense since mkstemp failing means that the file wasn't created. Also add a test case for this. Co-authored-by: Jose Luis Duran Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1383 (cherry picked from commit e8d027be6b84ac976eacd46283c286b934dd6f1f) --- usr.bin/xinstall/tests/install_test.sh | 10 ++++++++++ usr.bin/xinstall/xinstall.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/usr.bin/xinstall/tests/install_test.sh b/usr.bin/xinstall/tests/install_test.sh index b35706521ec3..0f1f93ab4c63 100755 --- a/usr.bin/xinstall/tests/install_test.sh +++ b/usr.bin/xinstall/tests/install_test.sh @@ -32,6 +32,15 @@ copy_to_empty_body() { install testf "" } +atf_test_case copy_to_nonexistent_dir +copy_to_nonexistent_dir_body() { + local dir="/nonexistent" + + printf 'test\n123\r456\r\n789\0z' >testf + atf_check -s not-exit:0 -e match:$dir": No such file or directory" \ + install testf $dir/testf +} + copy_to_nonexistent_with_opts() { printf 'test\n123\r456\r\n789\0z' >testf atf_check install "$@" testf copyf @@ -506,6 +515,7 @@ set_optional_exec_body() atf_init_test_cases() { atf_add_test_case copy_to_empty atf_add_test_case copy_to_nonexistent + atf_add_test_case copy_to_nonexistent_dir atf_add_test_case copy_to_nonexistent_safe atf_add_test_case copy_to_nonexistent_comparing atf_add_test_case copy_to_nonexistent_safe_comparing diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 4d771186781b..4942d57b1f9c 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -881,7 +881,7 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags) to_fd = create_tempfile(to_name, tempfile, sizeof(tempfile)); if (to_fd < 0) - err(EX_OSERR, "%s", tempfile); + err(EX_OSERR, "%s", dirname(tempfile)); if (!devnull) { if (dostrip) { stripped = strip(tempfile, to_fd, from_name,