From a925a8ee3a7d8c4408bfadb79a9b70444b523074 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 11:07:01 +0000 Subject: [PATCH 1/5] fix: five bugs in dist-installer-cli and related files - Fix swapped clearnet/onion URLs for --virtualbox-only (site_clearnet was assigned the onion domain and vice versa) - Fix wrong option name in import_guest() log message (said --import-only instead of --no-import) - Add missing exit 1 in build-dist-installer-cli when helper_path directory doesn't exist (script continued after error) - Fix duplicate --noupgrade in man page (first instance should be --noupdate) - Fix double slash in xtrace_fifo path (mktemp returns absolute path, prepending / created //tmp/...) https://claude.ai/code/session_01GD1tL2UN9BxWya2mz812cc --- man/dist-installer-cli.1.ronn | 2 +- usr/bin/dist-installer-cli | 8 ++++---- usr/share/usability-misc/build-dist-installer-cli | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/man/dist-installer-cli.1.ronn b/man/dist-installer-cli.1.ronn index 67870af..292ebb8 100644 --- a/man/dist-installer-cli.1.ronn +++ b/man/dist-installer-cli.1.ronn @@ -132,7 +132,7 @@ format . Activate development mode, which sets the default download version to an empty image. -`--noupgrade` +`--noupdate` Skip package manager list update. For development only. diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index 3f2a43d..b2d87f0 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -1356,7 +1356,7 @@ import_guest() { fi if [ "${no_import}" = "1" ]; then - log notice "VM Import: Not importing guest via '--import-only' option." + log notice "VM Import: Not importing guest via '--no-import' option." end_installer fi @@ -3670,8 +3670,8 @@ get_download_links() { ;; *) ## Variables need to be set for --virtualbox-only. - site_clearnet="${site_onion_kicksecure}" - site_onion="${site_clearnet_kicksecure}" + site_clearnet="${site_clearnet_kicksecure}" + site_onion="${site_onion_kicksecure}" ;; esac @@ -4594,7 +4594,7 @@ log_term_and_file() { 2> >(run_as_target_user tee -a -- "${log_file_debug}" >&2) temp_folder="$(mktemp --directory)" - xtrace_fifo="/${temp_folder}/xtrace_fifo" + xtrace_fifo="${temp_folder}/xtrace_fifo" mkfifo -m 600 -- "$xtrace_fifo" if [ "${log_level}" = "debug" ] || test -o xtrace; then diff --git a/usr/share/usability-misc/build-dist-installer-cli b/usr/share/usability-misc/build-dist-installer-cli index 9e676d2..7d53781 100755 --- a/usr/share/usability-misc/build-dist-installer-cli +++ b/usr/share/usability-misc/build-dist-installer-cli @@ -55,6 +55,7 @@ helper_path="/usr/libexec/helper-scripts/" if ! test -d "$helper_path" ; then echo "$0: ERROR: directory helper_path '$helper_path' does not exist!" >&2 + exit 1 fi cp -- "${template}" "${target}" From 6c747a07aa960720cad1d78eb005a60a06ce498e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 11:40:34 +0000 Subject: [PATCH 2/5] fix: four more bugs in dist-installer-cli - Fix torsocks silently dropped: install_signify() only uses $1, so the second arg 'torsocks' on Debian was never installed. Split into separate install_signify and install_pkg calls. - Fix log directory increment broken past run 2: sort -rn on full paths doesn't work numerically, so last_run_integer always reset to 1. Use ${log_entries[@]##*/} to extract basenames before sorting. - Remove --no-show-errors leftovers from usage(), man page, bash and zsh completions (option was removed from code in 2023 per changelog but docs/completions were not cleaned up). - Fix man page log-level description: said "below" but log levels show messages at or above the specified level. https://claude.ai/code/session_01GD1tL2UN9BxWya2mz812cc --- man/dist-installer-cli.1.ronn | 6 +----- usr/bin/dist-installer-cli | 6 +++--- usr/share/bash-completion/completions/dist-installer-cli | 2 +- usr/share/zsh/vendor-completions/_dist-installer-cli | 1 - 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/man/dist-installer-cli.1.ronn b/man/dist-installer-cli.1.ronn index 292ebb8..bb9c4fc 100644 --- a/man/dist-installer-cli.1.ronn +++ b/man/dist-installer-cli.1.ronn @@ -62,7 +62,7 @@ format . `-l`, `--log-level`= Define the logging level. Options: debug, info, notice (default), warn, error. - Log messages below the specified level are displayed. + Log messages at or above the specified level are displayed. `-k`, `--no-boot` @@ -116,10 +116,6 @@ format . Enable dirty mode, where the program continues despite errors. -`--no-show-errors` - - Suppress error messages. - `--ci` Enable CI mode for testing within Continuous Integration (CI) environments. diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index b2d87f0..bca0bd5 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -1917,7 +1917,8 @@ If that doesn't resolve the issue, consider reaching out to your operating syste #install_pkg torsocks #fi - install_signify signify-openbsd torsocks + install_signify signify-openbsd + install_pkg torsocks } @@ -4039,7 +4040,6 @@ User Options: -h, --help Show this help message and exit. Developer options: - --no-show-errors Suppress error messages. --allow-errors Continue execution despite errors. Dirty mode. Use with caution. --mirror= Choose a download mirror by index. Defaults to mirror 0 for clearnet and mirror 0 for onion if unspecified. @@ -4497,7 +4497,7 @@ Reboot into sysmaint session and rerun this installer." else local log_entries log_entries=( "${log_dir_main}"/* ) - last_run_integer="$(printf '%s\0' "${log_entries[@]}" | sort -zrn | tr '\0' '\n' | head --lines=1)" || true + last_run_integer="$(printf '%s\n' "${log_entries[@]##*/}" | sort -rn | head --lines=1)" || true if [ -z "${last_run_integer}" ] \ || ! is_whole_number "${last_run_integer}"; then last_run_integer='1' diff --git a/usr/share/bash-completion/completions/dist-installer-cli b/usr/share/bash-completion/completions/dist-installer-cli index 21ffcc1..8e6cef9 100644 --- a/usr/share/bash-completion/completions/dist-installer-cli +++ b/usr/share/bash-completion/completions/dist-installer-cli @@ -15,7 +15,7 @@ _dist_installer_cli() --guest-version | --socks-proxy | --onion | --non-interactive | \ --no-import | --no-boot | --redownload | \ --destroy-existing-guest | --dev | --ci | --dry-run | \ - --getopt | --no-show-errors | --allow-errors | --testers | \ + --getopt | --allow-errors | --testers | \ --noupdate | --noupgrade | --virtualbox-only | --oracle-repo | \ --version | --help ) return diff --git a/usr/share/zsh/vendor-completions/_dist-installer-cli b/usr/share/zsh/vendor-completions/_dist-installer-cli index 0643f90..518d778 100644 --- a/usr/share/zsh/vendor-completions/_dist-installer-cli +++ b/usr/share/zsh/vendor-completions/_dist-installer-cli @@ -28,7 +28,6 @@ args=( '(--destroy-existing-guest)'--destroy-existing-guest'[Delete and re-import. Danger! Risk of data loss!]' '(-n --non-interactive)'{-n,--non-interactive}'[Set non-interactive mode]' '(--allow-errors)'--allow-errors'[Set dirty mode]' - '(--no-show-errors)'--no-show-errors'[Hide errors]' '(--testers)'--testers'[Set testers mode]' '(-D --dev)'{-D,--dev}'[Set dev mode]' '(--noupdate)'--noupdate'[Skip package manager list update (dev only)]' From b8261176a14e179364919b38589ec106b54d451f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 11:41:13 +0000 Subject: [PATCH 3/5] fix: handle --import-only=both when VMs already exist When --import-only=both was used without --destroy-existing-guest and both VMs already existed, the code silently fell through without error instead of telling the user to pass --destroy-existing-guest. This was marked with a FIXME comment. https://claude.ai/code/session_01GD1tL2UN9BxWya2mz812cc --- usr/bin/dist-installer-cli | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index bca0bd5..ad25894 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -1178,8 +1178,9 @@ vm_delete_maybe() { die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'gateway', but it already exists and '--destroy-existing-guest' option was not set." elif [ "${workstation_exists}" = "1" ] && [ "${import_only}" = "workstation" ] ; then die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'workstation', but it already exists and '--destroy-existing-guest' option was not set." + elif [ "${import_only}" = "both" ] && [ "${gateway_exists}" = "1" ] && [ "${workstation_exists}" = "1" ]; then + die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'both', but both VMs already exist and '--destroy-existing-guest' option was not set." fi - ## FIXME: Shouldn't import_only=both be handled here? else log info "Existing VM Check: Neither '--destroy-existing-guest' nor '--import-only' option was set, ok." fi From 044de5b7e0dece886f1f870b446635b51b2ceb2f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 11:48:22 +0000 Subject: [PATCH 4/5] fix: three more bugs in dist-installer-cli - Fix missing closing quote in check_hash log message (line 3850): "Checking SHA512 checksum: '${shafile}" was missing trailing quote. - Add hypervisor/virtualbox-only guards to check_vm_running_general: function called VirtualBox-specific vboxmanage commands even when hypervisor was KVM. Matches the guards in check_vm_exists_general. - Add missing 'both' option to --import-only in usage() output: the code, man page, and completions all accept 'both' but --help only showed 'workstation, gateway'. https://claude.ai/code/session_01GD1tL2UN9BxWya2mz812cc --- usr/bin/dist-installer-cli | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index ad25894..515566a 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -984,6 +984,13 @@ test_pkg() { check_vm_running_general() { + if [ "${virtualbox_only}" = "1" ]; then + return 0 + fi + if [ "${hypervisor}" = "kvm" ]; then + return 0 + fi + case "${guest}" in whonix) check_vm_running_virtualbox "${guest_full_vm_name_gateway}" @@ -3847,7 +3854,7 @@ check_hash() { shafile="${1}" dir="$(dirname -- "${shafile}")" - log info "Checking SHA512 checksum: '${shafile}" + log info "Checking SHA512 checksum: '${shafile}'" ## $checkhash needs to be executed on the same folder as the compared file. log info "Changing to directory: '${dir}'" if [ -n "${target_user}" ]; then @@ -4050,7 +4057,7 @@ Developer options: 2 [HU] quantum-mirror.hu --redownload Re-download the guest image, even if previously successful. --import-only= Select specific VM to import. Only if guest is Whonix. - Options: workstation, gateway. + Options: workstation, gateway, both. --no-import Skip guest import. Default behavior is to import. --destroy-existing-guest Deletes any existing virtual machine(s) and re-imports them. Warning: This action poses a risk of data loss as it involves From 1bc4215cb726930350e4bb40e411ef3e48dc81b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 12:01:01 +0000 Subject: [PATCH 5/5] fix: deb822 parser misses last stanza, vboxusers group check unreliable - Fix deb822 parser (get_pattern_sources_deb822_debian): the match check only triggered on empty lines (stanza separators). If the last stanza in a .sources file had no trailing blank line, it was never checked, so existing repository configurations could go undetected and get re-added. - Fix add_user_to_vbox_group grep pattern: the '\$' end-of-line anchor meant the group was only detected if vboxusers was the last group in 'id --groups' output. If any group was added after vboxusers, the check failed and tried to re-add the user. The -w flag alone is sufficient for whole-word matching. https://claude.ai/code/session_01GD1tL2UN9BxWya2mz812cc --- usr/bin/dist-installer-cli | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index 515566a..1d6aed3 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -1643,6 +1643,26 @@ get_pattern_sources_deb822_debian() { fi done < "${file}" + ## Check the last stanza in case the file does not end with an empty line. + match_hit='yes' + if [ -n "${types_pattern}" ] \ + && ! [[ "${current_types}" =~ ${types_pattern} ]]; then + match_hit='no' + elif [ -n "${uris_pattern}" ] \ + && ! [[ "${current_uris}" =~ ${uris_pattern} ]]; then + match_hit='no' + elif [ -n "${suites_pattern}" ] \ + && ! [[ "${current_suites}" =~ ${suites_pattern} ]]; then + match_hit='no' + elif [ -n "${components_pattern}" ] \ + && ! [[ "${current_components}" =~ ${components_pattern} ]]; then + match_hit='no' + fi + + if [ "${match_hit}" = 'yes' ]; then + return 0 + fi + return 1 } @@ -1931,7 +1951,7 @@ If that doesn't resolve the issue, consider reaching out to your operating syste add_user_to_vbox_group() { - if id --name --groups "${id_of_user}" | grep -w -- "${virtualbox_linux_user_group}\$" >/dev/null; then + if id --name --groups "${id_of_user}" | grep -w -- "${virtualbox_linux_user_group}" >/dev/null; then log info "Linux Group Configuration: Account '${id_of_user}' is already a member of the Linux group 'vboxusers'." return 0 fi