Repository navigation
install.sh, setup.sh: apply the no-tty consent fix to the remaining sites - #7470
Merged
Merged
Conversation
…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.
Member
Author
|
@codex review |
danielhanchen
added a commit
to shimmyshimmer/unsloth-staging-4
that referenced
this pull request
Jul 26, 2026
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.shpattern verbatim: it probes withtest -r /dev/tty, assumesREPLY="y"when that fails, and then runs the elevatedapt-getwith stdin left open.Its own guard comment states the problem:
So this is exactly the scenario from #7307, and
install.shinvokessetup.shin 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:After this change:
It gets the same treatment #7435 gave
install.sh: a real open probe,-n -kwith stdin closed on the headless path, and the manual command plus the block's existing_SKIP_GGUF_BUILD=truedegradation on failure. Degrading rather than aborting matches what the no-sudo branch a few lines below already does._can_read_ttyis defined locally becausesetup.shruns as its own process rather than being sourced.install.shautostart promptStill used
test -r /dev/tty, the check #7435's own helper comment calls unreliable, and printed the question before checking, leaving a danglingStart Unsloth Studio now? [Y/n]in container logs. Now reuses_can_read_ttywith theprintfmoved inside the branch. It already failed safe (_reply="n"), so this is consistency and log hygiene rather than a behaviour fix.install.shinteractive escalationWith 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.shgains adeniedsudo mode and an assertion for the interactive failure path; it fails against currentmainand 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), underbash,dashandbusybox ash, withsudoandapt-getreplaced by PATH shims so nothing privileged runs. Against currentmainthat matrix reports 2 problems ininstall.shand 19 insetup.sh; with this change both are zero, with no hangs.install.shandsetup.shparse cleanly underbash -n,dash -nandbusybox ash -n.