Thanks for your bug report.  That patch isn't quite right, since it'd
cause the script to accept "-l=3", which should be rejected.  Could
you please try this patch instead?  (I've installed it, but it'd be
nice if you could double-check it.)  Thanks.

>From 4490773f87195f042fa151bb6959d332801fc46c Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Mon, 22 Nov 2010 15:18:10 -0800
Subject: [PATCH] scripts: fix option parsing

Problem reported by Dennis Wydra in
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00082.html>.
* scripts/backup.in: Accept "-l LEVEL".  Be more systematic about
backslashes inside ``; it shouldn't matter for modern shells but
it might matter for older ones.
* scripts/restore.in: Likewise.
* scripts/backup.in: Adjust implementation of -t/--time to match
the new implementation of -l/--level.
---
 scripts/backup.in  |   12 ++++++------
 scripts/restore.in |    5 +++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/scripts/backup.in b/scripts/backup.in
index 6a50e51..37bfed3 100644
--- a/scripts/backup.in
+++ b/scripts/backup.in
@@ -72,8 +72,9 @@ do
   --l=*|--le=*|--lev=*|--leve=*|--level=*)
          DUMP_LEVEL=$optarg
         ;;
+  -l?*)  DUMP_LEVEL=`expr $option : '-l\(.*\)'`;;
   -l|--l|--le|--lev|--leve|--level)
-         prev=$option
+        prev=--level
         ;;
   --verb=*|--verbo=*|--verbos=*|--verbose=*)
          VERBOSE=$optarg
@@ -81,14 +82,13 @@ do
   -v|--verb|--verbo|--verbos|--verbose)
          VERBOSE=100
         ;;
-  -v*)   VERBOSE=`expr $option : "-v\(.*\)"`;;
+  -v*)   VERBOSE=`expr $option : '-v\(.*\)'`;;
   --t=*|--ti=*|--tim=*|--time=*)
          TIME=$optarg
         ;;
-  -t)    prev=--t;;
-  -t*)   TIME=`expr $option : "-t\(.*\)"`;;
-  --t|--ti|--tim|--time)
-         prev=$option
+  -t?*)  TIME=`expr $option : '-t\(.*\)'`;;
+  -t|--t|--ti|--tim|--time)
+        prev=--time
         ;;
   -V|--v|--ve|--ver|--vers|--versi|--versio|--version)
         echo "backup (@PACKAGE_NAME@) @VERSION@"
diff --git a/scripts/restore.in b/scripts/restore.in
index efc320a..2f86bac 100644
--- a/scripts/restore.in
+++ b/scripts/restore.in
@@ -60,8 +60,9 @@ do
   --l=*|--le=*|--lev=*|--leve=*|--level=*)
          DUMP_LEVEL=$optarg
         ;;
+  -l?*)  DUMP_LEVEL=`expr $option : '-l\(.*\)'`;;
   -l|--l|--le|--lev|--leve|--level)
-         prev=$option
+        prev=--level
         ;;
   --verb=*|--verbo=*|--verbos=*|--verbose=*)
          VERBOSE=$optarg
@@ -69,7 +70,7 @@ do
   -v|--verb|--verbo|--verbos|--verbose)
          VERBOSE=100
         ;;
-  -v*)   VERBOSE=`expr $option : "-v\(.*\)"`;;
+  -v*)   VERBOSE=`expr $option : '-v\(.*\)'`;;
   -V|--v|--ve|--ver|--vers|--versi|--versio|--version)
         echo "restore (@PACKAGE_NAME@) @VERSION@"
         license
-- 
1.7.2


Reply via email to