Skip to content

install.sh, setup.sh: apply the no-tty consent fix to the remaining sites - #7470

Merged
danielhanchen merged 1 commit into
mainfrom
followup-7307-remaining-consent-sites
Jul 26, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
followup-7307-remaining-consent-sites

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up to #7435, which fixed _smart_apt_install. Three sites in the same install run were left with the old behaviour.

studio/setup.sh (the one that matters)

The WSL GGUF build-deps block is the pre-#7435 install.sh pattern verbatim: it probes with test -r /dev/tty, assumes REPLY="y" when that fails, and then runs the elevated apt-get with stdin left open.

Its own guard comment states the problem:

# On WSL, sudo requires a password and can't be entered during GGUF export
# (runs in a non-interactive subprocess). Install build deps here instead.

So this is exactly the scenario from #7307, and install.sh invokes setup.sh in the same install (bash "$SETUP_SH" </dev/null), meaning one run can reach both. Driven headless against a password-requiring host, the current code reproduces the original report:

STEP: gguf deps sudo required for: libcurl4-openssl-dev
                 accept? [Y/n] sudo: a terminal is required to read the password
EXIT_STATUS=1

After this change:

STEP: gguf deps needs sudo, no terminal -- run manually:
SUBSTEP: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev
EXIT_STATUS=0

It gets the same treatment #7435 gave install.sh: a real open probe, -n -k with stdin closed on the headless path, and the manual command plus the block's existing _SKIP_GGUF_BUILD=true degradation on failure. Degrading rather than aborting matches what the no-sudo branch a few lines below already does. _can_read_tty is defined locally because setup.sh runs as its own process rather than being sourced.

install.sh autostart prompt

Still used test -r /dev/tty, the check #7435's own helper comment calls unreliable, and printed the question before checking, leaving a dangling Start Unsloth Studio now? [Y/n] in container logs. Now reuses _can_read_tty with the printf moved inside the branch. It already failed safe (_reply="n"), so this is consistency and log hygiene rather than a behaviour fix.

install.sh interactive escalation

With a terminal present and consent given, a sudoers denial, a wrong password or an apt error aborted on the raw message, while the headless branch printed what to run by hand. The two are now symmetric.

Testing

tests/sh/test_apt_distro_prompt.sh gains a denied sudo mode and an assertion for the interactive failure path; it fails against current main and passes here. 30 assertions pass.

Also exercised the extracted functions from both files across a matrix of tty state (real pty, no controlling terminal, unopenable /dev/tty, EOF, and answered prompts) x sudoers policy (NOPASSWD, password-required, apt-specific PASSWD, cached timestamp, denied, no sudo binary, update-only NOPASSWD), under bash, dash and busybox ash, with sudo and apt-get replaced by PATH shims so nothing privileged runs. Against current main that matrix reports 2 problems in install.sh and 19 in setup.sh; with this change both are zero, with no hangs.

install.sh and setup.sh parse cleanly under bash -n, dash -n and busybox ash -n.

…ites

Follow-up to #7435, which fixed _smart_apt_install. Three sites were left.

studio/setup.sh: the WSL GGUF build-deps block is the pre-#7435 install.sh
pattern verbatim. It probes with 'test -r /dev/tty', assumes REPLY=y when that
fails, and then runs the elevated apt-get with stdin open. Its own guard
comment says a password is needed on WSL, so this is exactly the scenario from
issue #7307, and install.sh runs setup.sh in the same install. Give it the same
treatment: a real open probe, -n -k with stdin closed on the headless path, and
the manual command plus the existing _SKIP_GGUF_BUILD degradation on failure.
The helper is defined locally because setup.sh runs as its own process.

install.sh autostart prompt: still used 'test -r /dev/tty' and printed the
question before checking, leaving a dangling prompt in container logs. Reuse
_can_read_tty and move the printf inside the branch.

install.sh interactive escalation: a sudoers denial, a wrong password or an apt
error aborted on the bare message while the headless branch printed what to run
by hand. Make both symmetric.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Jul 26, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: dd55e9d66c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit dc24bba into main Jul 26, 2026
55 of 57 checks passed
@danielhanchen
danielhanchen deleted the followup-7307-remaining-consent-sites branch July 26, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants