public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/
Date: Tue, 24 Jan 2023 03:05:51 +0000 (UTC)	[thread overview]
Message-ID: <1674529532.cbe23e2638435ddeced39979099fceb77fbb98fb.sam@gentoo> (raw)

commit:     cbe23e2638435ddeced39979099fceb77fbb98fb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 24 03:04:39 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> 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 <sam <AT> 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


             reply	other threads:[~2023-01-24  3:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24  3:05 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-29  3:57 [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/ Sam James
2023-01-24  3:05 Sam James
2023-01-11  6:53 Sam James
2023-01-10  5:21 Sam James
2023-01-10  5:21 Sam James
2019-11-10  0:59 Anthony G. Basile
2019-11-10  0:54 Anthony G. Basile
2019-11-10  0:54 Anthony G. Basile
2019-11-09 18:24 Anthony G. Basile
2019-11-09 18:24 Anthony G. Basile
2019-04-14 18:40 Anthony G. Basile
2019-03-30 10:12 Anthony G. Basile
2015-06-08 13:07 Anthony G. Basile
2015-05-29 11:32 Anthony G. Basile
2014-11-02 21:46 Anthony G. Basile
2014-10-13  2:28 Anthony G. Basile
2014-10-13  2:20 Anthony G. Basile
2014-10-09  2:40 Anthony G. Basile
2014-07-21 21:25 Anthony G. Basile
2014-06-27 12:26 Anthony G. Basile
2014-06-27 12:26 Anthony G. Basile
2014-06-24 21:49 Anthony G. Basile
2014-06-15 22:09 Anthony G. Basile
2014-06-11 11:25 Anthony G. Basile
2014-06-10 21:04 Anthony G. Basile
2014-06-10  1:49 Anthony G. Basile
2014-06-10  1:49 Anthony G. Basile
2014-06-08 20:27 Anthony G. Basile
2014-06-01  0:26 Anthony G. Basile
2014-02-13 19:08 Anthony G. Basile
2014-02-13 19:01 Anthony G. Basile
2014-02-13 18:48 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1674529532.cbe23e2638435ddeced39979099fceb77fbb98fb.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox