Repository navigation
Conversation
magicant
force-pushed
the
notify-without-job-control
branch
from
November 9, 2026 15:03
74f1142 to
f5472f4
Compare
POSIX.1-2024 requires the -b option of the set built-in to have no effect when job control is disabled. The shell previously reported job status changes asynchronously whenever the notify option was set, regardless of the monitor option. The notify and notifyle options are now ignored unless job control is enabled in the current shell environment. Since job control is never performed in subshells, the options have no effect there either. The notifyle option, a yash extension, follows the notify option for consistency: without job control, job status is not reported before prompts, either. The existing test of \j in PS1 with the -b option assumed the old behavior and is now rewritten to test that the finished job remains in the job list until waited for. Fixes #265 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
magicant
force-pushed
the
notify-without-job-control
branch
from
November 9, 2026 15:35
f5472f4 to
cf3d7ee
Compare
This branch has not been deployed
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.
[AI-generated]
Fixes #265.
POSIX.1-2024 requires the
-boption of thesetbuilt-in to have no effect when job control is disabled. This PR makes the shell stop reporting job status changes asynchronously for-b(notify) and--notifyleunless job control is in effect.No design decision needed the author's input, so every decision below was made without asking. Each entry gives its classification, the strongest alternative, and where it landed. They are ordered by how likely they are to be disputed.
Decisions
doing_job_control_now, notdo_job_control(derivable: job control is never performed in subshells). Subshells therefore no longer report their own jobs even with-m -b; before this change,(sleep 0& wait)under-bimprinted[2] + Done.Alternative: use
do_job_control, matching the report before prompts ininput.c:260, and keep the in-subshell notification.Where: the condition in
handle_sigchld(sig.c:704), the notifyle check at the end ofhandle_traps(sig.c:809), and the report after the external editor inlineedit/editing.c(lineedit/editing.c:2970).--notifyleis ignored without job control too (derivable: without job control, job status is not reported before prompts either, so reporting only during line editing would be inconsistent).Alternative: keep the current behavior because
--notifyleis a yash extension that POSIX doesn't cover.Where: the same three conditions as above.
handle_sigchld, it goes into theifafterdo_wait(), because reaping must still happen.Alternative: return early at the top of
handle_sigchldafter reaping.Where:
sig.c:704.\j in PS1 and -b optionis rewritten for the new behavior (content). It now checks that a finished job stays in the\jcount until waited for, and the comment about flakiness is gone because the result no longer depends on timing.Alternative: switch it to
-mto keep its original intent. With-m, though, jobs are also reported and removed before prompts, so-bwould make no visible difference.Where:
\j in PS1 and -b option without job control(tests/prompt-y.tst:175).tests/job-y.tst(content). They are a control case that-bimdoes notify,-bi +mdoes not, and a subshell under-bimdoes not. All three fail without the fix.Each test starts the job inside the redirection that captures the notification, because the shell may notice the job's termination at any time after starting it. An earlier version started the job on a separate line and failed on CI when the notification was printed before the redirection.
Alternative: put them in
job-p.tstsince this is a POSIX requirement.Where:
tests/job-y.tst:64,:71,:79.Alternative: add a separate sentence saying the option has no effect when the monitor option is disabled to both entries, or mention it only in the section on notification timing in
job.txt.Where: the notify entries in
doc/_set.txt:178anddoc/ja/_set.txt:120.Alternative: list it as a behavior change ahead of the bug fixes.
Where:
NEWS:14,NEWS.ja:13.Testing
make test: OK 20310, ERROR 0, SKIPPED 4.The new tests in
tests/job-y.tstalso pass when a busy loop is inserted right after starting the job, which reproduced the earlier CI failure.🤖 Generated with Claude Code