Fix kdialog --progressbar usage

Returned dbus reference is multi-word string, it was not quoted on
purpose. ShellCheck was wrong about it.

QubesOS/qubes-issues#3449
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-08 02:25:59 +01:00
parent a8aa41e040
commit 7d82029aec
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 12 additions and 6 deletions

View File

@ -22,7 +22,8 @@
if command -v kdialog 2> /dev/null; then if command -v kdialog 2> /dev/null; then
SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1) SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1)
REF=$(kdialog --progressbar "Copy progress") REF=$(kdialog --progressbar "Copy progress")
qdbus "$REF" org.freedesktop.DBus.Properties.Set "" maximum "$SIZE" # shellcheck disable=SC2086
qdbus $REF org.freedesktop.DBus.Properties.Set "" maximum "$SIZE"
export PROGRESS_TYPE=gui export PROGRESS_TYPE=gui
@ -31,10 +32,12 @@ if command -v kdialog 2> /dev/null; then
/usr/lib/qubes/qfile-agent "$@" | /usr/lib/qubes/qfile-agent "$@" |
(while read -r sentsize ; do (while read -r sentsize ; do
CURRSIZE=$((sentsize / 1024)) CURRSIZE=$((sentsize / 1024))
qdbus "$REF" org.freedesktop.DBus.Properties.Set "" value "$CURRSIZE" # shellcheck disable=SC2086
qdbus $REF org.freedesktop.DBus.Properties.Set "" value "$CURRSIZE"
done) done)
qdbus "$REF" close # shellcheck disable=SC2086
qdbus $REF close
# we do not want a dozen error messages, do we # we do not want a dozen error messages, do we
# if ! [ "x"$agentstatus = xDONE ] ; then # if ! [ "x"$agentstatus = xDONE ] ; then
# kdialog --sorry 'Abnormal file copy termination; see /var/log/qubes/qrexec.xid.log in dom0 for more details' # kdialog --sorry 'Abnormal file copy termination; see /var/log/qubes/qrexec.xid.log in dom0 for more details'

View File

@ -25,7 +25,8 @@ if type kdialog 2> /dev/null; then
SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1) SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1)
REF=$(kdialog --progressbar "Move progress") REF=$(kdialog --progressbar "Move progress")
qdbus "$REF" org.freedesktop.DBus.Properties.Set "" maximum "$SIZE" # shellcheck disable=SC2086
qdbus $REF org.freedesktop.DBus.Properties.Set "" maximum "$SIZE"
export PROGRESS_TYPE=gui export PROGRESS_TYPE=gui
@ -34,14 +35,16 @@ if type kdialog 2> /dev/null; then
/usr/lib/qubes/qfile-agent "$@" | /usr/lib/qubes/qfile-agent "$@" |
(while read -r sentsize ; do (while read -r sentsize ; do
CURRSIZE=$((sentsize / 1024)) CURRSIZE=$((sentsize / 1024))
qdbus "$REF" org.freedesktop.DBus.Properties.Set "" value "$CURRSIZE" # shellcheck disable=SC2086
qdbus $REF org.freedesktop.DBus.Properties.Set "" value "$CURRSIZE"
done) done)
# shellcheck disable=SC2181 # shellcheck disable=SC2181
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
rm -rf "$@" rm -rf "$@"
fi fi
qdbus "$REF" close # shellcheck disable=SC2086
qdbus $REF close
# we do not want a dozen error messages, do we # we do not want a dozen error messages, do we
# if ! [ "x"$agentstatus = xDONE ] ; then # if ! [ "x"$agentstatus = xDONE ] ; then
# kdialog --sorry 'Abnormal file copy termination; see /var/log/qubes/qrexec.xid.log in dom0 for more details' # kdialog --sorry 'Abnormal file copy termination; see /var/log/qubes/qrexec.xid.log in dom0 for more details'