The command line interface to tar is complex and sometimes confusing,
but we should still do our best to figure where the file name is on
that command line.

Add support for the --file FILE and --file=FILE options. Other long
options must be explicitly skipped, as well as short options not
containing the letter "f".

With this we should be good to go in most real-world cases, but
there are still a few corner cases we may not handle properly. These
can be addressed later when reported.
---
 quilt/scripts/inspect.in |   34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

--- a/quilt/scripts/inspect.in
+++ b/quilt/scripts/inspect.in
@@ -249,14 +249,32 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
 
        tar_input_file()
        {
-               case "$1" in
-               *C*f*)
-                       echo "$3"
-                       ;;
-               *f*)
-                       echo "$2"
-                       ;;
-               esac
+               while [ $# -gt 0 ]; do
+                       case "$1" in
+                       --file)
+                               echo "$2"
+                               return
+                               ;;
+                       --file=*)
+                               echo "${1#--file=}"
+                               return
+                               ;;
+                       --*)
+                               shift
+                               ;;
+                       *C*f*)
+                               echo "$3"
+                               return
+                               ;;
+                       *f*)
+                               echo "$2"
+                               return
+                               ;;
+                       -*)
+                               shift
+                               ;;
+                       esac
+               done
        }
 
        unzip_input_file()

-- 
Jean Delvare
SUSE L3 Support


_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to