Skip to content

Commit

Permalink
qvm-copy-to-vm.gnome: avoid 'zenity --auto-close'
Browse files Browse the repository at this point in the history
'zenity --progress --auto-close' exits on reading a progress input of
100 or more. If the estimated transfer $SIZE was too low for whatever
reason, this kills the unfinished Filecopy process on the left side
of the pipe.

Avoid --auto-close using a similar approach in progress_zenity() as in
progress_kdialog().

https://forum.qubes-os.org/t/bug-report-should-be-fixed-immediately/13401
(cherry picked from commit 3400298)
  • Loading branch information
rustybird authored and marmarek committed Nov 29, 2022
1 parent 9bed013 commit f966983
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions qubes-rpc/qvm-copy-to-vm.gnome
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ progress_kdialog() {
}

progress_zenity() {
local pos
local pos fd

while read -r pos; do
# To avoid a window focus race with the qubes.Filecopy confirmation
# dialog, launch zenity *after* the copy has begun: Prepend an empty
# first line ...
(while read -r pos; do
if [[ $pos == 0 ]]; then
echo
trap 'kill -- $!' EXIT # for this subshell
exec {fd}> >(exec zenity --progress --text="$DESCRIPTION")
fi

echo $((100 * pos / SIZE))
done | {
read -r # ... and throw it away.
zenity --progress --text="$DESCRIPTION" --auto-close
}
echo $((100 * pos / SIZE)) >&$fd
done)
}


Expand Down

0 comments on commit f966983

Please sign in to comment.