From nobody Tue Apr 16 13:20:45 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 4VJl655RpYz5GrYp; Tue, 16 Apr 2024 13:20:45 +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 4VJl653clWz44LJ; Tue, 16 Apr 2024 13:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713273645; 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=gs4WMy+/kyzXmd4i40mcKo/UNiMnvpmWqe0Pn9kKUd8=; b=D+R1dd3o0BwBb0jrrnx2wKdesqQ6Ib5SEcnKCmbQhHNIIuFhEAZwpE59wTETd0514FLR5l +qXmP9eatYJNi40SoTLXn3R8d68fSdmlSt6LkQyFLx2rt3s2Kddlkg9Lhqign1ktqVlVtE dhKSKlL/Ia0Z4w0bacM6MuHFL2S0HBJFCyCz4fp8WJM83jqMlo7jjkXzjyrrCWWkW8uXcw 7/uS9RNoDojfskh+s+t1he19mp5hseigSWdfpoWtPUrSpW6wgk4cjnScbJAxWukYq0sH8N 13R4xZMITYWP451afnXGX1EReVQY7+zQseFDp+gtLMJCqzcYAeDkA7dBs9ZGQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713273645; a=rsa-sha256; cv=none; b=VBF4BpO/DRzBnPc3aDBLxkTZV081VVAxxt6d0bi07dtPACenhXdcz1mAyPtegjTnDx63S6 Q/3M4W+eifroEFVJVEOVQt20fiPwqrDZuzmYE/fsiNEVuJoogZuUiUiCuirFHoy8CKgQs3 gayboM24m3EVIk5zEKga9c9euXRiJkFBMAczggVWP0eauo9CQeTZdBQC5w733m79QMAJdw LtX5u/cJwvSzGQPwEmRLg3o7HffthYnyY5qwreDNVoWHubfsZim/2u4SloNktgEare9+5l ukOomraZByScZL3SySaj6wihXxT+2lQmGF8VO7gKkbCML5SWWhPc7BgsC+Dkyg== 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=1713273645; 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=gs4WMy+/kyzXmd4i40mcKo/UNiMnvpmWqe0Pn9kKUd8=; b=sjn4IkXyc7MSk5sn1Mqw470inquS+724rOm+3K+iEEHjmBhX2Dj3wPS7rU1qxy316FQQSg XAwLM/ov9hTPPTBI5ZaHX0brCnfyh+Syw00gnVFUtik2bxXdPSSsyzDH9zR1LnfQ4Hy9io EFcjeYeE5ksvWdfpznmKNhKTJyKbQfMIPWHbYxfrW/BMkY5ivqM+wnGtmIrKIWW9z532KD I75GlvRqrTSxsvG/Eo7tqokB2YSN3vFBXtdEHmv4Hdmy0vnYUzb/XYnqgUhVLAV/KlIeQi R6ENkjrZtLUhsw42/AiLR2m7B8vPVyNKhotxjweyQ4TLClQFg9APer1b2HbXIw== 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 4VJl653B9fzl1C; Tue, 16 Apr 2024 13:20:45 +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 43GDKjpl035585; Tue, 16 Apr 2024 13:20:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GDKjeY035582; Tue, 16 Apr 2024 13:20:45 GMT (envelope-from git) Date: Tue, 16 Apr 2024 13:20:45 GMT Message-Id: <202404161320.43GDKjeY035582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 428f86fd2ff1 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 428f86fd2ff1fd2b073d556fac273c8c7f457376 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=428f86fd2ff1fd2b073d556fac273c8c7f457376 commit 428f86fd2ff1fd2b073d556fac273c8c7f457376 Author: Ricardo Branco AuthorDate: 2024-03-16 17:13:10 +0000 Commit: Mark Johnston CommitDate: 2024-04-16 13:18:15 +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 --- 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 7a1ecba7e076..8aea4bbf567c 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -319,6 +319,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 @@ -339,11 +345,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);