From nobody Thu Apr 25 13:20:55 2024 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 4VQGh75bPrz5HjJh; Thu, 25 Apr 2024 13:20:55 +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 4VQGh758LYz3xs3; Thu, 25 Apr 2024 13:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714051255; 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=qA1r/4f77a/3/bQbE+h+THWrf6lLWbm7r664gz6p8II=; b=x+lwG2QvBdQaq8HrdRyniFMu9P7yMyqB4qVmxm+Kmod5xcGbYhdN669EG+GSPTP4t8LTFH QIeEPesoBpnVVd6gTX8nnyvzsEwsOOKd90nneS7FoSUnw9QDcPkZGRHNeiFJtcMHtNHkie c1IJno3rXf6aAN5x0fnwlatVyTJn3zgVwTRYIj5m5dLj/NEe8uyzxDBbdc9EnOi0UQA5qF yyg0nm1TCFaIoVwDJ0p6yaFXkrnBasTol9ctDs6RRqZNt6gyKwzb8oG0g2XftP4C07PhUw JbaQW+mTmCFVp/tTeXEr8dRHOX7aubg48VviVQSWh3hJfl7TOkA5OkNb2316RA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714051255; a=rsa-sha256; cv=none; b=YVkZnZ+Pe8CL9yJ/nN3Kl3hh9wpPhGJPiinaynyQZG2Raom54e/b4aANiOuf9v9Hws69zu JLcnGAyKDOXODwxxZdobd+3JnLfg42mZ9p2uxzvBxh25fhMjAKgkOQrtxcaok2ZmT3Y7Zs 2VFU/eGdjz+G3bO8+GYCcs7UEoiPJOUlne/TvJZRcHrRjfpAD7KePaZN3B8bNPXMcMbN2q Vghyi1CjgpzskWUbngF8G2nUoNVYUAl+8PFLQuISD6+TRS8SYosKhkLJUwF6nhIiF/TUqG 42bvxw6JomSnolVTtCK8/1hsGJW+dKNTghhTU0HspgDLus/0uxeb6xisuTCU+A== 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=1714051255; 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=qA1r/4f77a/3/bQbE+h+THWrf6lLWbm7r664gz6p8II=; b=w2fOi7zfAKPE/XnQvPugcv0PtmWAK25yvVvatg8qh8AR4yvf/UKy8fcICXHXHfMYOAMSut rvQ0mhPe8/UQB717W9Tl+66KL47k0MY8jQJvaeuBzXyYxQJyPFvReUShW59TrzC9V6qOah hwtD4xGS6jv2jZKm86hKXX5AdZxSfy33UMS9rFKl6pSPrMnojMXjXZuc+ee7yWpBykkRXx k2NrfWL3JNcXkzUcPUbLbpO2vJ7HWdjeoiMYwSSagMrEKV/1J5JmhsBot9eKSOgH7iNTNK iFEqzWg0TZbRgyCpsB3/7yLTHki+jD0UqC/A/bUtW7TfUQyPqwQQ8+zcTSMEzg== 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 4VQGh74m3dz10mm; Thu, 25 Apr 2024 13:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43PDKtTm001731; Thu, 25 Apr 2024 13:20:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43PDKtwP001728; Thu, 25 Apr 2024 13:20:55 GMT (envelope-from git) Date: Thu, 25 Apr 2024 13:20:55 GMT Message-Id: <202404251320.43PDKtwP001728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: eff68b69dfa2 - stable/14 - mv: Set file flags after setting file times 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: eff68b69dfa234f757b370b46596f7c8d604e05d Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=eff68b69dfa234f757b370b46596f7c8d604e05d commit eff68b69dfa234f757b370b46596f7c8d604e05d Author: Ricardo Branco AuthorDate: 2024-03-16 17:13:10 +0000 Commit: Mark Johnston CommitDate: 2024-04-25 13:20:16 +0000 mv: Set file flags after setting file times Some file flags prevent modification of file times, so they should be set later. This matches NetBSD's behaviour. Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1138 (cherry picked from commit 428f86fd2ff1fd2b073d556fac273c8c7f457376) --- bin/mv/mv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 1320f603b3c4..dba71f55e5dc 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -331,6 +331,12 @@ err: if (unlink(to)) */ preserve_fd_acls(from_fd, to_fd, from, to); (void)close(from_fd); + + ts[0] = sbp->st_atim; + ts[1] = sbp->st_mtim; + if (futimens(to_fd, ts)) + warn("%s: set times", to); + /* * XXX * NFS doesn't support chflags; ignore errors unless there's reason @@ -351,11 +357,6 @@ err: if (unlink(to)) } else warn("%s: cannot stat", to); - ts[0] = sbp->st_atim; - ts[1] = sbp->st_mtim; - if (futimens(to_fd, ts)) - warn("%s: set times", to); - if (close(to_fd)) { warn("%s", to); return (1);