From: Jean Delvare Subject: inspect: Handle long options passed to tar Upstream: Submitted 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. Reported by Petr Tesarik. --- quilt/scripts/inspect.in | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) --- a/quilt/scripts/inspect.in +++ b/quilt/scripts/inspect.in @@ -257,14 +257,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()