public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Amadeusz Żołnowski" <aidecoe@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/files/, sys-kernel/dracut/
Date: Sun, 16 Aug 2015 10:04:24 +0000 (UTC)	[thread overview]
Message-ID: <1439719131.8c578d67d48c971ba1cc438e610b5158eb247d76.aidecoe@gentoo> (raw)

commit:     8c578d67d48c971ba1cc438e610b5158eb247d76
Author:     Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 16 09:58:26 2015 +0000
Commit:     Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org>
CommitDate: Sun Aug 16 09:58:51 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c578d67

sys-kernel/dracut: Add patches removing non-portable use of `echo -n`

Gentoo-Bug: 554750

Package-Manager: portage-2.2.20.1

 sys-kernel/dracut/dracut-043-r1.ebuild             |   2 +
 ...02-Replace-echo-n-with-printf-in-code-wit.patch | 275 +++++++++++++++++++++
 ...03-syncheck-Look-for-echo-n-usage-in-modu.patch |  26 ++
 3 files changed, 303 insertions(+)

diff --git a/sys-kernel/dracut/dracut-043-r1.ebuild b/sys-kernel/dracut/dracut-043-r1.ebuild
index 6c16464..b713bea 100644
--- a/sys-kernel/dracut/dracut-043-r1.ebuild
+++ b/sys-kernel/dracut/dracut-043-r1.ebuild
@@ -50,6 +50,8 @@ DOCS=( AUTHORS HACKING NEWS README README.generic README.kernel README.modules
 MY_LIBDIR=/usr/lib
 PATCHES=(
 	"${FILESDIR}/${PV}-0001-Revert-lvm-Don-t-activate-LVs-with-act.patch"
+	"${FILESDIR}/${PV}-0002-Replace-echo-n-with-printf-in-code-wit.patch"
+	"${FILESDIR}/${PV}-0003-syncheck-Look-for-echo-n-usage-in-modu.patch"
 	)
 QA_MULTILIB_PATHS="
 	usr/lib/dracut/dracut-install

diff --git a/sys-kernel/dracut/files/043-0002-Replace-echo-n-with-printf-in-code-wit.patch b/sys-kernel/dracut/files/043-0002-Replace-echo-n-with-printf-in-code-wit.patch
new file mode 100644
index 0000000..7f0e627
--- /dev/null
+++ b/sys-kernel/dracut/files/043-0002-Replace-echo-n-with-printf-in-code-wit.patch
@@ -0,0 +1,275 @@
+From 15f330fe1afe9ac8870461faad55b7d63e791aca Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Tue, 14 Jul 2015 22:22:14 -0400
+Subject: [PATCH 2/3] Replace echo -n with printf in code with a /bin/sh
+ shebang
+
+POSIX does not mandate that echo support the -n parameter.
+printf has more well-defined behavior.
+---
+ modules.d/04watchdog/watchdog-stop.sh      | 2 +-
+ modules.d/40network/net-lib.sh             | 2 +-
+ modules.d/45ifcfg/write-ifcfg.sh           | 2 +-
+ modules.d/90lvm/lvm_scan.sh                | 4 ++--
+ modules.d/95fcoe/fcoe-up.sh                | 2 +-
+ modules.d/98usrmount/mount-usr.sh          | 2 +-
+ modules.d/99base/dracut-lib.sh             | 6 +++---
+ modules.d/99base/init.sh                   | 2 +-
+ test/TEST-10-RAID/create-root.sh           | 2 +-
+ test/TEST-10-RAID/cryptroot-ask.sh         | 2 +-
+ test/TEST-12-RAID-DEG/create-root.sh       | 2 +-
+ test/TEST-12-RAID-DEG/cryptroot-ask.sh     | 2 +-
+ test/TEST-13-ENC-RAID-LVM/create-root.sh   | 2 +-
+ test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh | 2 +-
+ test/TEST-14-IMSM/cryptroot-ask.sh         | 2 +-
+ test/TEST-20-NFS/client-init.sh            | 2 +-
+ test/TEST-40-NBD/create-root.sh            | 2 +-
+ test/TEST-40-NBD/cryptroot-ask.sh          | 2 +-
+ 18 files changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/modules.d/04watchdog/watchdog-stop.sh b/modules.d/04watchdog/watchdog-stop.sh
+index 91d45d6..921f969 100755
+--- a/modules.d/04watchdog/watchdog-stop.sh
++++ b/modules.d/04watchdog/watchdog-stop.sh
+@@ -1,2 +1,2 @@
+ #!/bin/sh
+-[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
++[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
+diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
+index a09cdaf..6c739e8 100755
+--- a/modules.d/40network/net-lib.sh
++++ b/modules.d/40network/net-lib.sh
+@@ -189,7 +189,7 @@ set_ifname() {
+ fix_bootif() {
+     local macaddr=${1}
+     local IFS='-'
+-    macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
++    macaddr=$(printf '%s:' ${macaddr})
+     macaddr=${macaddr%:}
+     # strip hardware type field from pxelinux
+     [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
+diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
+index fa7db27..251d684 100755
+--- a/modules.d/45ifcfg/write-ifcfg.sh
++++ b/modules.d/45ifcfg/write-ifcfg.sh
+@@ -48,7 +48,7 @@ print_s390() {
+         for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
+             [ -e $i ] || continue
+             channel=$(readlink -f $i)
+-            echo -n "${channel##*/},"
++            printf '%s' "${channel##*/},"
+         done
+     })
+     [ -n "$SUBCHANNELS" ] || return 1
+diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
+index 7495644..ead28aa 100755
+--- a/modules.d/90lvm/lvm_scan.sh
++++ b/modules.d/90lvm/lvm_scan.sh
+@@ -15,14 +15,14 @@ SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
+ lvmdevs=$(
+     for f in /tmp/.lvm_scan-*; do
+         [ -e "$f" ] || continue
+-        echo -n "${f##/tmp/.lvm_scan-} "
++        printf '%s' "${f##/tmp/.lvm_scan-} "
+     done
+ )
+ 
+ if [ ! -e /etc/lvm/lvm.conf ]; then
+     {
+         echo 'devices {';
+-        echo -n '    filter = [ '
++        printf '    filter = [ '
+         for dev in $lvmdevs; do
+             printf '"a|^/dev/%s$|", ' $dev;
+         done;
+diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
+index 43a0ad5..950e4b6 100755
+--- a/modules.d/95fcoe/fcoe-up.sh
++++ b/modules.d/95fcoe/fcoe-up.sh
+@@ -64,7 +64,7 @@ elif [ "$netdriver" = "bnx2x" ]; then
+     sleep 3
+     fipvlan "$netif" -c -s
+ else
+-    echo -n "$netif" > /sys/module/fcoe/parameters/create
++    printf '%s' "$netif" > /sys/module/fcoe/parameters/create
+ fi
+ 
+ need_shutdown
+diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
+index c29610f..d1a629c 100755
+--- a/modules.d/98usrmount/mount-usr.sh
++++ b/modules.d/98usrmount/mount-usr.sh
+@@ -12,7 +12,7 @@ filtersubvol() {
+     while [ $# -gt 0 ]; do
+         case $1 in
+             subvol\=*) :;;
+-            *) echo -n "${1}," ;;
++            *) printf '%s' "${1}," ;;
+         esac
+         shift
+     done
+diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
+index 08110cc..7a3c58c 100755
+--- a/modules.d/99base/dracut-lib.sh
++++ b/modules.d/99base/dracut-lib.sh
+@@ -298,7 +298,7 @@ _dogetargs() {
+         fi
+     done
+     if [ -n "$_found" ]; then
+-        [ $# -gt 0 ] && echo -n "$@"
++        [ $# -gt 0 ] && printf '%s' "$*"
+         return 0
+     fi
+     return 1;
+@@ -329,9 +329,9 @@ getargs() {
+     done
+     if [ -n "$_gfound" ]; then
+         if [ $# -gt 0 ]; then
+-            echo -n "$@"
++            printf '%s' "$*"
+         else
+-            echo -n 1
++            printf 1
+         fi
+         debug_on
+         return 0
+diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
+index f96dbb5..a59e8ea 100755
+--- a/modules.d/99base/init.sh
++++ b/modules.d/99base/init.sh
+@@ -253,7 +253,7 @@ while :; do
+ done
+ 
+ {
+-    echo -n "Mounted root filesystem "
++    printf "Mounted root filesystem "
+     while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
+ } | vinfo
+ 
+diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh
+index a7e56a5..7b5f2a7 100755
+--- a/test/TEST-10-RAID/create-root.sh
++++ b/test/TEST-10-RAID/create-root.sh
+@@ -18,7 +18,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /d
+ # randomly.
+ mdadm -W /dev/md0
+ set -e
+-echo -n test >keyfile
++printf test >keyfile
+ cryptsetup -q luksFormat /dev/md0 /keyfile
+ echo "The passphrase is test"
+ cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
+diff --git a/test/TEST-10-RAID/cryptroot-ask.sh b/test/TEST-10-RAID/cryptroot-ask.sh
+index 407d067..c39eff6 100755
+--- a/test/TEST-10-RAID/cryptroot-ask.sh
++++ b/test/TEST-10-RAID/cryptroot-ask.sh
+@@ -1,5 +1,5 @@
+ #!/bin/sh
+ 
+ [ -b "/dev/mapper/$2" ] && exit 0
+-echo -n test >/keyfile
++printf test >/keyfile
+ /sbin/cryptsetup luksOpen "$1" "$2" </keyfile
+diff --git a/test/TEST-12-RAID-DEG/create-root.sh b/test/TEST-12-RAID-DEG/create-root.sh
+index 7b9a171..3299aa6 100755
+--- a/test/TEST-12-RAID-DEG/create-root.sh
++++ b/test/TEST-12-RAID-DEG/create-root.sh
+@@ -20,7 +20,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sdb /de
+ # wait for the array to finish initailizing, otherwise this sometimes fails
+ # randomly.
+ mdadm -W /dev/md0
+-echo -n test >keyfile
++printf test >keyfile
+ cryptsetup -q luksFormat /dev/md0 /keyfile
+ echo "The passphrase is test"
+ set -e
+diff --git a/test/TEST-12-RAID-DEG/cryptroot-ask.sh b/test/TEST-12-RAID-DEG/cryptroot-ask.sh
+index db27c5b..78ed7f5 100755
+--- a/test/TEST-12-RAID-DEG/cryptroot-ask.sh
++++ b/test/TEST-12-RAID-DEG/cryptroot-ask.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+ [ -b /dev/mapper/$2 ] && exit 0
+-echo -n test >/keyfile
++printf test >/keyfile
+ /sbin/cryptsetup luksOpen $1 $2 </keyfile
+ 
+diff --git a/test/TEST-13-ENC-RAID-LVM/create-root.sh b/test/TEST-13-ENC-RAID-LVM/create-root.sh
+index e74fe7f..72bc765 100755
+--- a/test/TEST-13-ENC-RAID-LVM/create-root.sh
++++ b/test/TEST-13-ENC-RAID-LVM/create-root.sh
+@@ -14,7 +14,7 @@ sfdisk /dev/sda <<EOF
+ ,25M
+ EOF
+ udevadm settle
+-echo -n test >keyfile
++printf test >keyfile
+ cryptsetup -q luksFormat /dev/sda2 /keyfile
+ cryptsetup -q luksFormat /dev/sda3 /keyfile
+ cryptsetup -q luksFormat /dev/sda4 /keyfile
+diff --git a/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh b/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
+index db27c5b..78ed7f5 100755
+--- a/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
++++ b/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+ [ -b /dev/mapper/$2 ] && exit 0
+-echo -n test >/keyfile
++printf test >/keyfile
+ /sbin/cryptsetup luksOpen $1 $2 </keyfile
+ 
+diff --git a/test/TEST-14-IMSM/cryptroot-ask.sh b/test/TEST-14-IMSM/cryptroot-ask.sh
+index db27c5b..78ed7f5 100755
+--- a/test/TEST-14-IMSM/cryptroot-ask.sh
++++ b/test/TEST-14-IMSM/cryptroot-ask.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+ [ -b /dev/mapper/$2 ] && exit 0
+-echo -n test >/keyfile
++printf test >/keyfile
+ /sbin/cryptsetup luksOpen $1 $2 </keyfile
+ 
+diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh
+index 2311981..a443289 100755
+--- a/test/TEST-20-NFS/client-init.sh
++++ b/test/TEST-20-NFS/client-init.sh
+@@ -8,7 +8,7 @@ strstr() { [ "${1##*"$2"*}" != "$1" ]; }
+ 
+ stty sane
+ if strstr "$CMDLINE" "rd.shell"; then
+-    [ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
++    [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
+ 	strstr "$(setsid --help)" "control" && CTTY="-c"
+ 	setsid $CTTY sh -i
+ fi
+diff --git a/test/TEST-40-NBD/create-root.sh b/test/TEST-40-NBD/create-root.sh
+index 391279e..20d0eff 100755
+--- a/test/TEST-40-NBD/create-root.sh
++++ b/test/TEST-40-NBD/create-root.sh
+@@ -5,7 +5,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
+ done
+ rm -f -- /etc/lvm/lvm.conf
+ udevadm control --reload
+-echo -n test >keyfile
++printf test >keyfile
+ cryptsetup -q luksFormat /dev/sdb /keyfile
+ echo "The passphrase is test"
+ cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
+diff --git a/test/TEST-40-NBD/cryptroot-ask.sh b/test/TEST-40-NBD/cryptroot-ask.sh
+index db27c5b..78ed7f5 100755
+--- a/test/TEST-40-NBD/cryptroot-ask.sh
++++ b/test/TEST-40-NBD/cryptroot-ask.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+ [ -b /dev/mapper/$2 ] && exit 0
+-echo -n test >/keyfile
++printf test >/keyfile
+ /sbin/cryptsetup luksOpen $1 $2 </keyfile
+ 
+-- 
+2.5.0
+

diff --git a/sys-kernel/dracut/files/043-0003-syncheck-Look-for-echo-n-usage-in-modu.patch b/sys-kernel/dracut/files/043-0003-syncheck-Look-for-echo-n-usage-in-modu.patch
new file mode 100644
index 0000000..8be8833
--- /dev/null
+++ b/sys-kernel/dracut/files/043-0003-syncheck-Look-for-echo-n-usage-in-modu.patch
@@ -0,0 +1,26 @@
+From 4e17745f9786bfe21d5419c2e0eeff8c5667e747 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Tue, 14 Jul 2015 11:12:16 -0400
+Subject: [PATCH 3/3] syncheck: Look for 'echo -n' usage in modules
+
+---
+ Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 0af5d0f..16c6d2a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -211,7 +211,8 @@ syncheck:
+                 [ "$${i##*/}" = "module-setup.sh" ] && continue; \
+                 read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
+ 		[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
+-		[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \
++		[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
++		[ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
+ 	done;exit $$ret
+ 	@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
+ 	                modules.d/*/module-setup.sh; do \
+-- 
+2.5.0
+


             reply	other threads:[~2015-08-16 10:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-16 10:04 Amadeusz Żołnowski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-11-04 18:39 [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/files/, sys-kernel/dracut/ Mike Gilbert
2017-02-09 18:47 Patrick McLean
2017-02-09 18:47 Patrick McLean
2018-03-24 18:03 Mike Gilbert
2019-01-21 14:23 Mike Gilbert
2019-12-29 19:39 Mike Gilbert
2020-03-10 19:50 Mike Gilbert
2020-07-03 11:18 Thomas Deutschmann
2021-06-14 18:42 Mike Gilbert
2021-07-23 19:16 Mike Gilbert
2021-08-17 17:24 Mike Gilbert
2021-09-06  0:14 Mike Gilbert
2021-12-27 16:51 Mike Gilbert
2022-12-25  2:53 Mike Gilbert
2023-05-26 20:03 Mike Gilbert
2023-07-20  3:39 Sam James
2023-09-22  6:10 Andrew Ammerlaan
2023-12-13  9:19 Andrew Ammerlaan
2024-09-30  9:09 Andrew Ammerlaan
2024-11-01 17:10 Andrew Ammerlaan
2024-11-10  2:21 Mike Gilbert
2025-02-03 17:40 Nowa Ammerlaan
2025-03-24  1:55 Sam James
2025-05-18 10:28 Nowa Ammerlaan

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=1439719131.8c578d67d48c971ba1cc438e610b5158eb247d76.aidecoe@gentoo \
    --to=aidecoe@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