Fix help50 bugs and add smoke test - #244
Merged
Merged
Conversation
- cli.sh: only start help50 in interactive shells with a terminal, else non-interactive login shells (bash --login -c) hang on script - lib/cli: _ansi and _fold take arguments by $#, not -t 0, so messages aren't dropped when stdin is redirected; _fold falls back to 80 columns - valgrind: source lib and use _alert/_ansi instead of undefined _help - help50.sh: fix _rhetocial typo; cap _helpless payload at 8 KiB - help50/python: handle python dir/file.py, use realpath --canonicalize-missing - Dockerfile: install bsdextrautils explicitly for col
tests/smoke.sh checks a built image under timeouts: non-interactive login shells exit, help50 deps are installed, wrappers print with stdin redirected. Run via make smoke, and in CI before pushing to Docker Hub.
rongxin-liu
added a commit
that referenced
this pull request
Sep 30, 2026
Reimplements help50 in Bash, running locally and automatically per login shell, without a server. Usage is inspired by systemctl: - help50 start/stop/status/enable/disable/is-enabled control a session that logs the shell's I/O via script to /tmp/help50.$PPID - help50 COMMAND [ARGS...] runs COMMAND as though typed directly, with the same exit status - HELP50_DISABLED in the environment is a kill switch, so that as a Codespaces secret help50 can be turned off fleet-wide without a rebuild /etc/profile.d/help50.sh installs a PROMPT_COMMAND hook that, after a failed command, strips the typescript of ANSI/control characters and terminal echo, bounds the read (first 64K + last 1M) and the output (first 64 + last 1,024 lines), and passes it to each executable helper in /opt/cs50/lib/help50/ under a 5-second timeout. Helper output is shown via _helpful; otherwise _helpless receives the output and command line (a no-op here, overridden in cs50/codespace to relay to the CS50 Duck). Also adds /opt/cs50/lib/cli helper functions (_alert, _ansi, _find, _fold, _sure) used by the make, sqlite3, http-server, and valgrind wrappers; helpers for bash, cd, clang, make, and python; tests/smoke.sh (make smoke), run in CI against each architecture's build before pushing to Docker Hub; and installs bsdextrautils, colorized-logs, file, expect, and fzf, dropping the Python help50 package. Squashed from 99 commits, including #244, #245, #246, #247, and #248. Co-authored-by: Rongxin Liu <10591665+rongxin-liu@users.noreply.github.com>
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 for #210 found while testing the branch, plus a smoke test so they stay fixed. Targets
help50, to be merged before #210 lands.Main changes
Non-interactive login shells hung.
cli.shranhelp50 startin every login shell, sobash --login -c ...blocked onscriptwaiting for input. Now only starts in interactive shells with a terminal.Messages were dropped when stdin was redirected.
_ansiand_foldchose between arguments and stdin with-t 0, sovalgrind python foo.py < fileprinted nothing. They now check$#._foldalso falls back to 80 columns whentput colsfails.Smoke test.
tests/smoke.shruns against a built image under timeouts and checks that non-interactive shells exit, help50's dependencies are installed, and wrappers print with stdin redirected. Runs viamake smokeand in CI before the image is pushed. It fails oncs50/cli:latesttoday (missing ansi2txt), so the checks are live.Smaller fixes
valgrindwrapper called_help, which no longer exists; now sources the lib and uses_alert/_ansi_rhetocial->_rhetoricaltypo, so answeringyto a suggestion workshelp50/python: thepython dir/file.pybranch was dead code; now suggests the right path.realpathneeded--canonicalize-missingsince the file doesn't exist_helplesspayload capped at 8 KiB (downstream ddb50 rejects > 10,000 chars)bsdextrautilsinstalled explicitly forcol(was only transitive)runuses$(IMAGE)Testing
Overlaid the changes on
cs50/cli:latestand drove an interactive login shell under a pty through1s,make foo.c,cd..,python bar/baz.py,./foo.c,check 50,y,help50 stop, Ctrl-D.make smokepasses on that image.Note: the pip
help50currently shipped oncs50/cli:latestfails to import (No module named 'pkg_resources'on Python 3.13), so productionhelp50is already broken.