[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Ovirt-devel] PATCH: make "warn" function more robust



I noticed that the warn shell function (and hence die, too) would
misbehave when operating on something containing a % (or, far less
likely, a \c sequence that printf recognizes).

These fix the four definitions I found,
3 in node-image/, 1 in appliance/.

>From fc3baab76f26db9e1565a065f8fc42820d483465 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Sat, 4 Oct 2008 10:34:30 +0200
Subject: [PATCH node-image] warn: robustify

---
 ovirt-flash        |    2 +-
 ovirt-flash-static |    2 +-
 ovirt-pxe          |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ovirt-flash b/ovirt-flash
index bb5b9be..0b9c793 100755
--- a/ovirt-flash
+++ b/ovirt-flash
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

 ME=$(basename "$0")
-warn() { printf "$ME: $ \n" >&2; }
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 die() { warn "$@"; exit 1; }

 test $# != 2 && die "Usage: $ME <usbdevice> <iso-image>"
diff --git a/ovirt-flash-static b/ovirt-flash-static
index be9c7c9..4c2bb22 100755
--- a/ovirt-flash-static
+++ b/ovirt-flash-static
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

 ME=$(basename "$0")
-warn() { printf "$ME: $ \n" >&2; }
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 die() { warn "$@"; exit 1; }

 test $# != 2 && die "Usage: $ME <usbdevice> <iso-image>"
diff --git a/ovirt-pxe b/ovirt-pxe
index facca5b..5223990 100755
--- a/ovirt-pxe
+++ b/ovirt-pxe
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

 ME=$(basename "$0")
-warn() { printf "$ME: $ \n" >&2; }
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 die() { warn "$@"; exit 1; }

 test $# != 1 && die "Usage: $ME <iso-image>"
--
1.6.0.2.307.gc427


>From 209369f1430f763510d716238bba2d6a09458dd6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Sat, 4 Oct 2008 10:34:17 +0200
Subject: [PATCH appliance] warn: robustify

---
 create-ovirt-appliance |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/create-ovirt-appliance b/create-ovirt-appliance
index 2689a49..88d0188 100755
--- a/create-ovirt-appliance
+++ b/create-ovirt-appliance
@@ -2,8 +2,8 @@

 PATH=$PATH:/sbin:/usr/sbin

-ME=$(basename "$0") 
-warn() { printf "$ME: $ \n" >&2; }
+ME=$(basename "$0")
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 try_h() { printf "Try \`$ME -h' for more information.\n" >&2; }
 die() { warn "$@"; try_h; exit 1; }

--
1.6.0.2.307.gc427


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]