profile: only run resize on interactive non-SSH logins (WinSCP fix) - #143
Merged
Conversation
Stock's /etc/profile ends with a bare `resize >/dev/null`. That is the BusyBox applet: it writes a cursor-position query to stderr and reads the terminal's reply from stdin under a 3 s alarm. Clients that open the login shell without a pty (WinSCP's SCP mode and its terminal window) get the escape bytes on stderr and lose their first command to resize's scanf, which WinSCP surfaces as "Error skipping startup message. Your shell is probably incompatible with the application". SFTP, PuTTY and command-line scp were unaffected. Reported on the forum against v2026.09.02-beta: https://misterfpga.org/viewtopic.php?p=113698#p113698 Stock has the identical defect (verified on release_20250402's linux.img by running its own busybox under qemu-arm on a pty). Deliberate deviation: guard the call so it only runs for an interactive shell outside SSH, i.e. the serial console, the one place nothing else reports the window size. SSH_CONNECTION rather than SSH_TTY because sshd sets it for every session, pty or not. Verified on a board: no-pty login shell, pty login shell and `bash -l` are clean; a simulated console login still runs resize. Fixes #142 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vq3yLoYntjiJ1wUaAdruLU
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is a minimal, well-scoped guard in /etc/profile with corresponding documentation, and it directly addresses the confirmed no-PTY SSH failure mode without affecting console behavior.
Pull request overview
This PR fixes WinSCP SCP-mode / “Open Terminal” failures by preventing BusyBox resize from running in SSH sessions where no PTY is allocated (which causes escape bytes on stderr and consumes the first stdin line). The change is implemented in the rootfs overlay’s /etc/profile and documented as an additional intentional stock deviation in docs/init-parity.md.
Changes:
- Guard
/etc/profile’s trailingresizeso it runs only for interactive, non-SSH logins ([ "$PS1" ] && [ -z "$SSH_CONNECTION" ]). - Add an explanatory comment in
/etc/profiledescribing the WinSCP no-PTY failure mode and rationale. - Update
docs/init-parity.mdto record the new/etc/profiledeviation (now 2 deviations).
File summaries
| File | Description |
|---|---|
board/mister/de10nano/rootfs-overlay/etc/profile |
Adds a guard and documentation to avoid running resize in SSH/no-PTY sessions (WinSCP fix) while preserving serial-console behavior. |
docs/init-parity.md |
Updates the /etc/profile parity row to document the new intentional deviation from stock. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #142 — forum report: https://misterfpga.org/viewtopic.php?p=113698#p113698 (WinSCP could not open a shell window on v2026.09.02-beta; PuTTY was fine).
What
One-line guard in the rootfs overlay's
/etc/profile:plus an explanatory comment in the file and a second documented deviation in the
/etc/profilerow ofdocs/init-parity.md.Why
resizeis the BusyBox applet. It writes a cursor-position escape query to stderr andscanfs the reply from stdin with a 3 s alarm. WinSCP's SCP mode and its terminal window open the login shell without a pty, so nothing answers: the escape bytes hit WinSCP's stderr and WinSCP's first command is eaten as the "reply". WinSCP reportsError skipping startup message. Your shell is probably incompatible with the application.Over SSH
resizeis redundant anyway (sshd propagates the client's window size through the pty). It only does real work on the serial console, which the guard preserves.SSH_CONNECTIONis used rather thanSSH_TTYbecause sshd sets it for every session, pty or not; a first attempt withSSH_TTYdid not fix WinSCP.Stock parity
Stock has the identical line and the identical BusyBox applet (checked on
release_20250402'slinux.img; its own armhf busybox run underqemu-armon a pty emits the same bytes and swallows the next input line). So this is inherited, and the change is recorded as a deliberate deviation.Verification (on a DE10-nano running 260902, change applied live)
ssh -Tno-pty login shell, two commands fed: both echo back, no escape bytes (before: escape bytes, first command lost).ssh -ttpty login shell: clean prompt.bash -las login shell, no pty: clean.resizestill runs.scpandsftpunchanged.Not touched: root's login shell stays BusyBox
sh(stock uses bash); it is not part of this failure.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vq3yLoYntjiJ1wUaAdruLU