Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ while pgrep -af 'python3 -m pytest' | grep -v pgrep >/dev/null; do sleep 20; don
It NEVER WAITED — under the harness `grep` is a shell function whose status is 1
when its stdout is `/dev/null`, even where it matched, so four suites ran at
once — and the pattern is unanchored, so it also matches the guard's own command
line. Read `command grep` wherever an exit status matters. A poll ALONE is the
second defect: every waiter starts the instant the run it watched ends, which is
the same collision one step later. Anchored, split so it cannot match itself,
and locked:
line. Read `command grep` in your shell wherever an exit status matters, never
in a `set -e` script: bash 3.2 exits (#292). A poll ALONE is the second defect:
every waiter starts the instant the run it watched ends, which is the same
collision one step later. Anchored, split so it cannot match itself, and locked:

```sh
pat='^python3 -m pyt'"est" # split so it cannot match itself
Expand Down
8 changes: 7 additions & 1 deletion lane-end
Original file line number Diff line number Diff line change
Expand Up @@ -1371,10 +1371,16 @@ DUPES
# `dh_settle_gone` polls up to two seconds (twenty tries, 0.1s apart) and
# returns the instant both checks agree the pid is gone, so the common,
# unloaded case still resolves in one pass.
#
# `ps` IN A SUBSHELL OF ITS OWN (opensoft/openRepoTools#292): macOS's bash
# 3.2 ends a `set -e` script where a utility run through `command` fails,
# even after `!` in an `if`, and `ps -p` fails exactly when the pid is
# gone, so this act ended at the moment it had its answer. The subshell's
# status is ps's either way, and `command -p` keeps its bypass.
dh_settle_gone() { # <pid> — 0 once confirmed gone, 1 if still found
dsg_tries=0
while [ "$dsg_tries" -lt 20 ]; do
if ! kill -0 "$1" 2>/dev/null && ! command -p ps -p "$1" >/dev/null 2>&1; then
if ! kill -0 "$1" 2>/dev/null && ! (command -p ps -p "$1" >/dev/null 2>&1); then
return 0
fi
dsg_tries=$((dsg_tries + 1))
Expand Down
8 changes: 6 additions & 2 deletions lanes
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,12 @@ if [ "$wt_mode" = 1 ]; then
out="$("$LANES_EDIT" worktrees ${idx_args[@]+"${idx_args[@]}"} "${wt_args[@]}" 2>"$wt_err_file")" || rc=$?
wt_err="$(cat -- "$wt_err_file" 2>/dev/null || printf '')"
# `-e` AND NO `--` AFTER THE PATTERN: BSD's `grep` stops at its first
# operand, so a `--` there is a FILE it cannot open on macOS.
command grep -v -e 'not fetching; reading origin/' "$wt_err_file" >&2 || :
# operand, so a `--` there is a FILE it cannot open on macOS. A BARE
# `grep`, NOT `command grep` (opensoft/openRepoTools#292): this one exits
# 1 whenever the helper said nothing else, and macOS's bash 3.2 ends a
# `set -e` script where a utility run through `command` fails, `|| :`
# or not, which left `lanes --worktrees` at exit 1 with no output.
grep -v -e 'not fetching; reading origin/' "$wt_err_file" >&2 || :
rm -f -- "$wt_err_file"
else
out="$("$LANES_EDIT" worktrees ${idx_args[@]+"${idx_args[@]}"} "${wt_args[@]}")" || rc=$?
Expand Down
7 changes: 5 additions & 2 deletions openRepoTools
Original file line number Diff line number Diff line change
Expand Up @@ -4007,11 +4007,14 @@ WIP_HYGIENE_LINES=(
)

# The hygiene block, less every line `$1` already carries; nothing at all when
# it carries them all.
# it carries them all. A bare `grep`, never `command grep`
# (opensoft/openRepoTools#292): its failure IS the missing line, and macOS's
# bash 3.2 ends a `set -e` script where a utility run through `command` fails,
# even on the left of `||`.
wip_hygiene_lines() { # <the .gitignore as it stands>
local line missing=""
for line in "${WIP_HYGIENE_LINES[@]}"; do
command grep -Fqx -- "$line" "$1" 2>/dev/null || missing="$missing$line
grep -Fqx -- "$line" "$1" 2>/dev/null || missing="$missing$line
"
done
[ -n "$missing" ] || return 0
Expand Down
Loading
Loading