Uh oh!
There was an error while loading. Please reload this page.
fix(make): drop xargs -r so make lint runs on BSD xargs (backend#2200) - #879
Conversation
The parse, shellcheck and lint-warnings recipes passed `xargs -0 -r`. GNU xargs accepts `-r`; older BSD/macOS xargs rejects it outright (`illegal option -- r`), so `make lint` died at the first recipe on macOS -- the platform the surrounding arch work targets. (Current macOS added a no-op `-r` compat shim, which is why the break only shows on older boxes, but the flag is still non-portable.) `-r` only suppresses xargs' one run on empty input, and every recipe already refuses empty input upstream: parse exits on its zero-count guard, shellcheck/lint-warnings bail when sh-files.sh exits non-zero on a zero-file classification. So xargs always receives >=1 item and `-r` was dead code on GNU too -- dropping it is behaviour-preserving on Linux and fixes older BSD. The recipe comments already describe the loop as `xargs -0 -n1`, so this also restores code/comment agreement. Fixed all three occurrences, not just the two named in the ticket (lint-warnings carried the same flag and the same bug). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
saqlainsyed007
left a comment
There was a problem hiding this comment.
Reviewed at 655cabf. Correct and safe — no findings; holding only on CI (PENDING).
Dropping xargs -r (a GNU-only --no-run-if-empty, absent on BSD/macOS xargs) is a pure portability fix here, and I checked the one thing that could bite — behavior on an EMPTY file list, since without -r xargs would otherwise run the command once with no operands. It can't reach that state in any of the three targets: sh-files.sh exits non-zero on a zero-file classification (per the SH_FILES comment), and shellcheck/lint-warnings both gate on if ! $(SH_FILES) …; then exit 1; fi before the xargs line, while parse has its own explicit ZERO-refusal (found ZERO shell scripts … exit 1). So the list is always non-empty by the time xargs runs — the -r was redundant and removing it changes nothing but the BSD breakage. -0 is retained, so NUL-delimited paths are still safe.
Once CI is green I'll approve on the next pass.
aptracebloc
commented
Aug 27, 2026
CI is green now — all required checks pass (Lint, quality/shellcheck, closing-ref, version-bump-gate) and Bugbot is clean. Re-requesting your review per your note. Thanks for the independent empty-input check — matches the guard analysis exactly. |
saqlainsyed007
left a comment
There was a problem hiding this comment.
Approving at 655cabf — CI is green now, which was the only thing I was holding on.
Verified last pass: dropping the GNU-only xargs -r is a pure BSD/macOS portability fix, and the empty-input case it guarded can't be reached — sh-files.sh exits non-zero on a zero-file classification and all three targets gate on if ! $(SH_FILES) …; then exit 1; fi (parse also has its own ZERO-refusal) before the xargs line, with -0 retained. No behaviour change, no findings, no threads, mergeable. LGTM.
Uh oh!
There was an error while loading. Please reload this page.
Closes tracebloc/backend#2200
Problem
client/Makefile'sparse,shellcheckandlint-warningsrecipes passxargs -0 -r. GNU xargs accepts-r; older BSD/macOS xargs rejects it outright (xargs: illegal option -- r), somake lintdies at the very first recipe on macOS — the platform the surrounding arch work targets.(Current macOS shipped a no-op
-rGNU-compat shim, so the break only reproduces on older boxes — but the flag is still non-portable, and CI/dev machines shouldn't depend on which macOS you're on.)Fix
Drop
-rfrom all three recipes.-ronly suppresses xargs' single run on empty input, and every recipe already refuses empty input upstream:parseexits on its explicit zero-count guard before reaching xargs;shellcheck/lint-warningsbail whensh-files.shexits non-zero on a zero-file classification.So xargs always receives ≥1 item and
-rwas dead code on GNU too — removing it is behaviour-preserving on Linux/CI and fixes older BSD/macOS. The recipe comments already describe the loop asxargs -0 -n1(no-r), so this also restores code/comment agreement.Fixed all three occurrences, not just the two named in the ticket —
lint-warningscarried the same flag and the same bug (fix the class, not the instance).Verification
Run on macOS 26.3.1 (Darwin 25.3.0), genuine BSD
/usr/bin/xargs, shellcheck 0.11.0:make linton this box (BSD xargs)-r) under a-r-rejecting xargs shim (old macOS)make: *** [parse] Error 1— reproduces #2200-r) under the same shimsh-files.shpath)Linux/GNU is exercised by the required
Lintcheck on ubuntu-latest here.Note
Low Risk
Makefile-only portability tweak to lint recipes; no runtime, auth, or data-path changes, with empty-input behavior already guarded upstream.
Overview
Fixes
make linton BSD/macOS wherexargsrejects the GNU-only-rflag (xargs: illegal option -- r), which blockedparseand everything downstream on older macOS dev boxes.The
parse,shellcheck, andlint-warningsrecipes now usexargs -0instead ofxargs -0 -r. Removing-ris intended to be behavior-preserving: each recipe already fails closed beforexargswhen there are zero files or classification fails, soxargsalways gets at least one path. This also aligns the commands with existing comments that describexargs -0 -n1without-r.Reviewed by Cursor Bugbot for commit 655cabf. Bugbot is set up for automated code reviews on this repo. Configure here.