From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AB37415800F for ; Tue, 24 Jan 2023 03:05:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7E77DE07C7; Tue, 24 Jan 2023 03:05:55 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 63332E07C7 for ; Tue, 24 Jan 2023 03:05:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4F18933E3A9 for ; Tue, 24 Jan 2023 03:05:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AA8A6882 for ; Tue, 24 Jan 2023 03:05:51 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1674529532.cbe23e2638435ddeced39979099fceb77fbb98fb.sam@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/install-xattr/checkcopyattrs.sh X-VCS-Directories: misc/install-xattr/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: cbe23e2638435ddeced39979099fceb77fbb98fb X-VCS-Branch: master Date: Tue, 24 Jan 2023 03:05:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 47f69bc1-2233-461f-b75e-f465407bb2bc X-Archives-Hash: 9caa085ad73a5d8731ed10678b910427 commit: cbe23e2638435ddeced39979099fceb77fbb98fb Author: Sam James gentoo org> AuthorDate: Tue Jan 24 03:04:39 2023 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jan 24 03:05:32 2023 +0000 URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=cbe23e26 install-xattr: minor test fixups - Add set -x like we did for fix-gnustack (87ca5c5bbe63ea3c9227fdd4a01ccdc1ce723323) for easier debugging when something fails. - Use Bash tests everywhere given we're already using Bash. - Use portable Bash shebang. - Fix shellcheck nits. Signed-off-by: Sam James gentoo.org> misc/install-xattr/checkcopyattrs.sh | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/misc/install-xattr/checkcopyattrs.sh b/misc/install-xattr/checkcopyattrs.sh index a9149d7..9d5dc13 100755 --- a/misc/install-xattr/checkcopyattrs.sh +++ b/misc/install-xattr/checkcopyattrs.sh @@ -1,5 +1,5 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -ex touch a b c mkdir -p d e h @@ -13,41 +13,41 @@ setfattr -n user.pax.flags -v "r" c ./install-xattr b y ./install-xattr c z -[ "$(getfattr --only-values -n user.foo x)" == "bar" ] -[ "$(getfattr --only-values -n user.bas x)" == "x" ] -[ "$(getfattr --only-values -n user.pax.flags x)" == "mr" ] -[ "$(getfattr --only-values -n user.pax.flags y)" == "p" ] -[ "$(getfattr --only-values -n user.pax.flags z)" == "r" ] +[[ "$(getfattr --only-values -n user.foo x)" == "bar" ]] +[[ "$(getfattr --only-values -n user.bas x)" == "x" ]] +[[ "$(getfattr --only-values -n user.pax.flags x)" == "mr" ]] +[[ "$(getfattr --only-values -n user.pax.flags y)" == "p" ]] +[[ "$(getfattr --only-values -n user.pax.flags z)" == "r" ]] ./install-xattr a b c d -[ "$(getfattr --only-values -n user.foo d/a)" == "bar" ] -[ "$(getfattr --only-values -n user.bas d/a)" == "x" ] -[ "$(getfattr --only-values -n user.pax.flags d/a)" == "mr" ] -[ "$(getfattr --only-values -n user.pax.flags d/b)" == "p" ] -[ "$(getfattr --only-values -n user.pax.flags d/c)" == "r" ] +[[ "$(getfattr --only-values -n user.foo d/a)" == "bar" ]] +[[ "$(getfattr --only-values -n user.bas d/a)" == "x" ]] +[[ "$(getfattr --only-values -n user.pax.flags d/a)" == "mr" ]] +[[ "$(getfattr --only-values -n user.pax.flags d/b)" == "p" ]] +[[ "$(getfattr --only-values -n user.pax.flags d/c)" == "r" ]] # This tests if the src file was inside a directory # the correct dst location should be f/a. NOT f/d/a. ./install-xattr d/a h -[ -x h/a ] -[ ! -x h/d/a ] -[ "$(getfattr --only-values -n user.foo h/a)" == "bar" ] -[ "$(getfattr --only-values -n user.bas h/a)" == "x" ] +[[ -x h/a ]] +[[ ! -x h/d/a ]] +[[ "$(getfattr --only-values -n user.foo h/a)" == "bar" ]] +[[ "$(getfattr --only-values -n user.bas h/a)" == "x" ]] ./install-xattr -t e a b c -[ "$(getfattr --only-values -n user.foo e/a)" == "bar" ] -[ "$(getfattr --only-values -n user.bas e/a)" == "x" ] -[ "$(getfattr --only-values -n user.pax.flags e/a)" == "mr" ] -[ "$(getfattr --only-values -n user.pax.flags e/b)" == "p" ] -[ "$(getfattr --only-values -n user.pax.flags e/c)" == "r" ] +[[ "$(getfattr --only-values -n user.foo e/a)" == "bar" ]] +[[ "$(getfattr --only-values -n user.bas e/a)" == "x" ]] +[[ "$(getfattr --only-values -n user.pax.flags e/a)" == "mr" ]] +[[ "$(getfattr --only-values -n user.pax.flags e/b)" == "p" ]] +[[ "$(getfattr --only-values -n user.pax.flags e/c)" == "r" ]] ./install-xattr a -D f/a -[ "$(getfattr --only-values -n user.foo f/a)" == "bar" ] -[ "$(getfattr --only-values -n user.bas f/a)" == "x" ] -[ "$(getfattr --only-values -n user.pax.flags f/a)" == "mr" ] +[[ "$(getfattr --only-values -n user.foo f/a)" == "bar" ]] +[[ "$(getfattr --only-values -n user.bas f/a)" == "x" ]] +[[ "$(getfattr --only-values -n user.pax.flags f/a)" == "mr" ]] # Check that we can copy large files truncate -s2G a @@ -68,8 +68,8 @@ truncate -s2G a ./install-xattr -p a backup-a ./install-xattr -d g/g/g -./install-xattr -o $(id -u) a mode-a -./install-xattr -g $(id -g) a mode-a +./install-xattr -o "$(id -u)" a mode-a +./install-xattr -g "$(id -g)" a mode-a ./install-xattr -m 666 a mode-a # Let's abuse ourselves