From bea096b8ad54e9e91164126898bdceb35dd2a72f Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Mon, 14 Oct 2024 11:21:35 +0000 Subject: [PATCH 1/2] qvm-copy-to-vm.gnome: lowercase $size and $description --- qubes-rpc/qvm-copy-to-vm.gnome | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qubes-rpc/qvm-copy-to-vm.gnome b/qubes-rpc/qvm-copy-to-vm.gnome index cc7f69267..e7fddfda8 100755 --- a/qubes-rpc/qvm-copy-to-vm.gnome +++ b/qubes-rpc/qvm-copy-to-vm.gnome @@ -43,11 +43,11 @@ progress_kdialog() { (while read -r pos; do if [[ $pos == 0 ]]; then # shellcheck disable=SC2207 - ref=( $(kdialog --progressbar "$DESCRIPTION") ) + ref=( $(kdialog --progressbar "$description") ) trap '"$qdbus" "${ref[@]}" close' EXIT # for this subshell fi - "$qdbus" "${ref[@]}" value $((100 * pos / SIZE)) + "$qdbus" "${ref[@]}" value $((100 * pos / size)) done) >/dev/null # hide qdbus's empty output lines } @@ -57,10 +57,10 @@ progress_zenity() { (while read -r pos; do if [[ $pos == 0 ]]; then trap 'kill -- $!' EXIT # for this subshell - exec {fd}> >(exec zenity --progress --text="$DESCRIPTION") + exec {fd}> >(exec zenity --progress --text="$description") fi - echo $((100 * pos / SIZE)) >&$fd + echo $((100 * pos / size)) >&$fd done) } @@ -73,22 +73,22 @@ for path; do esac done -SIZE=$( +size=$( find "${find_paths[@]}" -type f -print0 2>/dev/null | du --files0-from - -c --apparent-size -b | tail -n 1 | cut -f 1 | grep -xE '[0-9]+' -) || SIZE=0 +) || size=0 if [[ ${0##*/} == qvm-move-to-vm.* ]]; then - DESCRIPTION="Moving files..." + description="Moving files..." trap '[[ $? == 0 ]] && rm -rf -- "$@"' EXIT else - DESCRIPTION="Copying files..." + description="Copying files..." fi -if [[ $SIZE == 0 ]]; then +if [[ $size == 0 ]]; then copy "$@" >/dev/null elif [[ $0 == *.kde ]] && type kdialog >/dev/null && set_qdbus; then copy "$@" | progress_kdialog From 254312c8eedaa4875d5dc00e056a077a6d88d492 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Mon, 14 Oct 2024 11:21:36 +0000 Subject: [PATCH 2/2] qvm-copy-to-vm.gnome: port +allow-all-names logic from qvm-copy Fixes QubesOS/qubes-issues#9506 --- qubes-rpc/qvm-copy-to-vm.gnome | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/qubes-rpc/qvm-copy-to-vm.gnome b/qubes-rpc/qvm-copy-to-vm.gnome index e7fddfda8..38e1f6c9b 100755 --- a/qubes-rpc/qvm-copy-to-vm.gnome +++ b/qubes-rpc/qvm-copy-to-vm.gnome @@ -33,8 +33,9 @@ set_qdbus() { } copy() { - PROGRESS_TYPE=gui /usr/lib/qubes/qrexec-client-vm @default \ - qubes.Filecopy /usr/lib/qubes/qfile-agent "$@" + PROGRESS_TYPE=gui /usr/lib/qubes/qrexec-client-vm \ + --filter-escape-chars-stderr -- @default \ + "$service" /usr/lib/qubes/qfile-agent "$@" } progress_kdialog() { @@ -65,21 +66,14 @@ progress_zenity() { } -find_paths=( ) -for path; do - case "$path" in - (-*) find_paths+=( ./"$path" ) ;; - (*) find_paths+=( "$path" ) ;; - esac -done - -size=$( - find "${find_paths[@]}" -type f -print0 2>/dev/null | - du --files0-from - -c --apparent-size -b | - tail -n 1 | - cut -f 1 | - grep -xE '[0-9]+' -) || size=0 +if size=$(/usr/lib/qubes/qubes-fs-tree-check \ + --allow-symlinks --allow-directories --machine -- "$@"); then + service=qubes.Filecopy +else + status=$? + if [[ "$status" -ne 2 ]]; then exit "$status"; fi + service=qubes.Filecopy+allow-all-names +fi if [[ ${0##*/} == qvm-move-to-vm.* ]]; then description="Moving files..."