Commit 7a74a491b184125d2e5d2fb6e7604cc8506ea6de

Authored by Jay Berkenbilt
1 parent f4ca04ce

Fixes in appimage AppRun (fixes #789)

* Don't "shift" when $ARGV0 is a qpdf executable
* Base -- to basename to avoid stuff like `qpdf --version` calling
  `basename --version`
Showing 1 changed file with 5 additions and 7 deletions
appimage/AppRun
@@ -381,7 +381,7 @@ fi @@ -381,7 +381,7 @@ fi
381 if [ x"$1" == "xman" -o x"$1" == "x--man" ] ; then 381 if [ x"$1" == "xman" -o x"$1" == "x--man" ] ; then
382 export MANPATH="$HERE/usr/share/man:$MANPATH" 382 export MANPATH="$HERE/usr/share/man:$MANPATH"
383 shift 383 shift
384 - exec man "$@" || man $(basename $1) 384 + exec man "$@" || man $(basename -- $1)
385 fi 385 fi
386 386
387 387
@@ -452,9 +452,9 @@ fi @@ -452,9 +452,9 @@ fi
452 ### Main stuff happens from here: 452 ### Main stuff happens from here:
453 if [ ! -z $APPIMAGE ] ; then 453 if [ ! -z $APPIMAGE ] ; then
454 # We run as an AppImage 454 # We run as an AppImage
455 - BINARY_NAME=$(basename "$ARGV0") 455 + BINARY_NAME=$(basename -- "$ARGV0")
456 APPIMAGE=$APPIMAGE 456 APPIMAGE=$APPIMAGE
457 - CALLED_SUBCMD=$( basename $1 2>/dev/null ) 457 + CALLED_SUBCMD=$( basename -- $1 2>/dev/null )
458 if [ "x$SET_SHOW_ENV_FOR_APPRUN" == "xYeSS" ] ; then 458 if [ "x$SET_SHOW_ENV_FOR_APPRUN" == "xYeSS" ] ; then
459 # We have the (hidden) env var for debugging stuff set 459 # We have the (hidden) env var for debugging stuff set
460 echo BINARY_NAME=$BINARY_NAME 1>&2 # Don't leak strings into output of qpdf|fix-pdf|zlib-flate going to stdout! 460 echo BINARY_NAME=$BINARY_NAME 1>&2 # Don't leak strings into output of qpdf|fix-pdf|zlib-flate going to stdout!
@@ -470,7 +470,6 @@ if [ ! -z $APPIMAGE ] ; then @@ -470,7 +470,6 @@ if [ ! -z $APPIMAGE ] ; then
470 echo APPIMAGE=$APPIMAGE 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout! 470 echo APPIMAGE=$APPIMAGE 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout!
471 echo CALLED_SUBCMD=$CALLED_SUBCMD 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout! 471 echo CALLED_SUBCMD=$CALLED_SUBCMD 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout!
472 fi 472 fi
473 - shift  
474 exec "$HERE/usr/bin/$BINARY_NAME" "$@" 473 exec "$HERE/usr/bin/$BINARY_NAME" "$@"
475 474
476 else 475 else
@@ -504,9 +503,9 @@ if [ ! -z $APPIMAGE ] ; then @@ -504,9 +503,9 @@ if [ ! -z $APPIMAGE ] ; then
504 503
505 else 504 else
506 # Most likely we run from an AppDir, not as an AppImage: 505 # Most likely we run from an AppDir, not as an AppImage:
507 - BINARY_NAME=$(basename "$ARGV0") 506 + BINARY_NAME=$(basename -- "$ARGV0")
508 APPIMAGE=$APPIMAGE 507 APPIMAGE=$APPIMAGE
509 - CALLED_SUBCMD=$( basename $1 2>/dev/null ) 508 + CALLED_SUBCMD=$( basename -- $1 2>/dev/null )
510 if [ "x$SET_SHOW_ENV_FOR_APPRUN" == "xYeSS" ] ; then 509 if [ "x$SET_SHOW_ENV_FOR_APPRUN" == "xYeSS" ] ; then
511 # We have the (hidden) env var for debugging stuff set 510 # We have the (hidden) env var for debugging stuff set
512 echo BINARY_NAME=$BINARY_NAME 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout! 511 echo BINARY_NAME=$BINARY_NAME 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout!
@@ -534,7 +533,6 @@ else @@ -534,7 +533,6 @@ else
534 echo APPIMAGE=$APPIMAGE 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout! 533 echo APPIMAGE=$APPIMAGE 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout!
535 echo CALLED_SUBCMD=$CALLED_SUBCMD 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout! 534 echo CALLED_SUBCMD=$CALLED_SUBCMD 1>&2 # Don't leak strings into qpdf|fix-pdf|zlib-flate output going to stdout!
536 fi 535 fi
537 - shift  
538 exec "$HERE/usr/bin/$BINARY_NAME" "$@" 536 exec "$HERE/usr/bin/$BINARY_NAME" "$@"
539 537
540 else 538 else