From nobody Thu Mar 16 12:20:00 2023 X-Original-To: dev-commits-src-main@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 4PcmYD5Ngwz3y39K; Thu, 16 Mar 2023 12:20:00 +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 4PcmYD4gZ7z4KMN; Thu, 16 Mar 2023 12:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678969200; 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=9SRBVfQEw7f0GLgq/QW/aONd7EeUZkl0PR92MVce5Mk=; b=bKr+YU5/pJ6HZob0ND/lIARUX1yEOjhSLie6wmwAnfDf4hJmNeP9gXBenctSoRB7IeiRek s5wXfjFoF6laxOO6IPpjlIj5CDfpRgCnqmX/xCKuL7TBiE0FSFZXLKe00i+nEs0ascGL8X VocOY794Jp/tq9mMxwUEoPP4jp6ijgGCW65vZ9TqSp1J7f5OPHqQUGt0N/cK8RlU6I24nQ SK00c27HbdjA4ehjvNPFK7CqbGPsJg5mO7NE3csNrk44/0CgujY8TlR1gRmUnTcLddbaxv 8LNQrDcRPlum/trh4gLXkpP6DrnxETOlockUKGANbF7/B7nWp7gKEeVmG2Na6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678969200; 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=9SRBVfQEw7f0GLgq/QW/aONd7EeUZkl0PR92MVce5Mk=; b=xGyl108LcGZ3H5UFg4KeyhugmYrT8L3T17LwKuzozFf4hO+ilLUbT9ZSYxDqktTTcxQKjX +78uDRju3wRy/gSzHJUt+/q+nz+eMDIOfhYqOBCIy4KMC4gzIBlwculsEkZ0VCKL+txFEu URqfIXh5xzPy9WFAgoO9rES/hpp4ZRiyei6KpRRi8AuDK3zJAg7rsk1PWntiGDtv/jz95r 4wD6nPsmhbFqnLYiEucNR+8qAQ5J+otAnuIVozNfgCwYBgXcTVG5Hs7RucKjeCpjNiZHhE g4qs6nTAWHfgwfkf5Glbn61UyCTOieTVH8xct1XZaY/59NCyMFoHvbAcqSFIoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678969200; a=rsa-sha256; cv=none; b=lM8MZxIS425/XrSUkzOdw59AqD3QbLif+VMrR6BMEKalxSrVKR+DWGAcOq+KgnPoJA2Shw YuDVUdrSF/sbZ2SYS0VP4ZarRCTVyO+Dos+QU+l31prlZy4zDCkjH3l1cfi+PZOdZajsRb 0au55Yk+suF52CidRxELdVdFbpsibfEBmxDJd6a7i1yJ3twoM3BF0nOd//KyjphL8FNQCs 3iM22uD+5oasyJpZpaSE0Xg/S6JyPoOwyxn2F/axKbXOkEAfOT3+eDMJCBkRKb5c84zaIw ahnKfEQqE7wWTvFDYqFFYC6ybZZm21Jl3m1doA0KUEyKXAhUFCI+BV6tXjCxGQ== 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 4PcmYD3RSWzjWp; Thu, 16 Mar 2023 12:20:00 +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 32GCK075079990; Thu, 16 Mar 2023 12:20:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32GCK0IB079971; Thu, 16 Mar 2023 12:20:00 GMT (envelope-from git) Date: Thu, 16 Mar 2023 12:20:00 GMT Message-Id: <202303161220.32GCK0IB079971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: e81d55b43948 - main - tarfs: Support tar files which include file modes with permissions. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e81d55b43948e4ebcd20a9563521aae54ab727cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e81d55b43948e4ebcd20a9563521aae54ab727cc commit e81d55b43948e4ebcd20a9563521aae54ab727cc Author: Dag-Erling Smørgrav AuthorDate: 2023-03-16 11:31:10 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-03-16 11:31:22 +0000 tarfs: Support tar files which include file modes with permissions. Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39020 --- sys/fs/tarfs/tarfs_vfsops.c | 4 ++-- tests/sys/fs/tarfs/tarfs_test.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/fs/tarfs/tarfs_vfsops.c b/sys/fs/tarfs/tarfs_vfsops.c index 9d7297eb9d73..837fc7644ac1 100644 --- a/sys/fs/tarfs/tarfs_vfsops.c +++ b/sys/fs/tarfs/tarfs_vfsops.c @@ -515,12 +515,12 @@ again: /* get standard attributes */ num = tarfs_str2int64(hdrp->mode, sizeof(hdrp->mode)); - if (num < 0 || num > ALLPERMS) { + if (num < 0 || num > (S_IFMT|ALLPERMS)) { TARFS_DPF(ALLOC, "%s: invalid file mode at %zu\n", __func__, TARFS_BLOCKSIZE * (blknum - 1)); mode = S_IRUSR; } else { - mode = num; + mode = num & ALLPERMS; } num = tarfs_str2int64(hdrp->uid, sizeof(hdrp->uid)); if (num < 0 || num > UID_MAX) { diff --git a/tests/sys/fs/tarfs/tarfs_test.sh b/tests/sys/fs/tarfs/tarfs_test.sh index 50d98f857e06..d0624b79eb2d 100644 --- a/tests/sys/fs/tarfs/tarfs_test.sh +++ b/tests/sys/fs/tarfs/tarfs_test.sh @@ -59,6 +59,7 @@ tarfs_basic_body() { atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/short_link)" atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/long_link)" atf_check_equal "$(sha256 -q "${mnt}"/sparse_file)" ${sum} + atf_check_equal "$(stat -f%p "${mnt}"/sparse_file)" 100644 atf_check_equal "$(stat -f%l "${mnt}"/sparse_file)" 2 atf_check_equal "$(stat -f%l "${mnt}"/hard_link)" 2 }