Skip to content

Stop the PowerShell Install When Its Non-Apt Path Check Refuses #4172

Description

@ptr727

Problem

host-setup/linux/install-tools.sh reads powershell_non_apt_paths through a process substitution:

readarray -t paths < <(powershell_non_apt_paths)
[[ ${#paths[@]} -eq 0 ]] && return 0

That function can end the run two ways. It runs resolved=$(unowned_command_path pwsh) || exit 1. It also calls die when a non-apt pwsh sits outside the known cleanup paths, asking the operator to remove it before installing.

A process substitution runs in a subshell, and bash does not hand its exit status to the caller. So either ending stops only the subshell. paths comes back empty, powershell_remove_non_apt returns 0, and the PowerShell install goes on. The refusal prints and is then ignored.

How to Reproduce

Construct the case rather than a real host: a stub unowned_command_path that prints a path outside the two known ones, such as /opt/example/pwsh. Call powershell_remove_non_apt. The die message prints, and the function returns 0.

The Class

The same file holds eight readarray reads fed by a process substitution. The functions read that way are dotnet_sdk_packages, apt_missing, python_packages, sudo_implementations, and powershell_non_apt_paths. Only the last is measured here as able to die or exit. Each of the others needs the same check, since a function that can fail is silent when read this way.

Fix Direction

Read the function into a variable first, so its status is seen, then split it. Or have the function return its status through a file or a nameref. A test should hold the refusal, with the stub above.

Found while reviewing #4161. It predates that change.

Activity

  1. ptr727 commented on Nov 22, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-22): the branch merged as #4352 and was cleaned up, so this claim holds no files.

    Backlog burndown claim (round 4, group 7, 2026-11-22): branch burndown/r4-install-tools-defects, issues #4172, #4124, #2596.

    Predicted files: host-setup/linux/install-tools.sh, tests/test_install_tools.py, host-setup/linux/README.md.

    The stale branch feature/wsl-2299 also edits these files. The maintainer ruled on 2026-11-22 that its claim is released and that he deletes that branch himself, so this group does not wait on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions