Skip to content

ci: the license guard's CR handling explains itself with two false claims - #1019

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/license-guard-crlf-comment
Aug 19, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/license-guard-crlf-comment

Conversation

@vyncint

@vyncint vyncint commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

check-dependency-licenses.sh justifies a pipeline stage like this:

# The file uses CRLF, hence the `tr -d '\r'`.
recorded="$(tail -n +2 "${CSV}" | cut -d, -f1 | tr -d '\r' | ...)"

Both halves are wrong.

1. The file is not CRLF. dependency-licenses.csv has zero CR bytes. It was CRLF when the guard was written — 111 of them at 642eacf5 — and 8eb0dcf2 (#917) normalized it to LF while touching it for something unrelated, so the sentence has been stale since that landed.

2. The tr would not be needed even if it were. A CR sits immediately before the newline, which puts it in the CSV's last field. cut -d, -f1 reads the first. The strip has never had anything to remove on this path.

So the stage goes, and the comment now records why no CR handling belongs there.

How the second error came to light

I first wrote this PR claiming the opposite — that dropping the strip would make the guard report every crate as missing — and built a mutation to demonstrate it. The mutation refused to reproduce it. Converting the committed CSV to CRLF (117 CR bytes) and running the guard with the strip removed passes exactly as it does today. Both line endings, with and without the strip: all four combinations agree.

That is the whole finding, and I would not have got it right by reading.

Scope

The same reasoning applies to the .strip("\r") in the example-workspace half further down, which reads line.split(",")[0]. That one is left alone — one concern per change.

Happy to keep the tr as belt-and-braces and only fix the comment; it costs nothing at runtime. I removed it because a line whose stated purpose is false and whose effect is nil teaches the next reader something untrue about the file format, which is how it survived this long.

Testing

Local, no GPU.

  • Guard passes on the tree as committed (57 declared crates, plus the example-workspace half)
  • Guard passes identically with the CSV converted to CRLF
  • cargo oxide run <example> — not applicable, CI script only

…aims

`check-dependency-licenses.sh` justifies a pipeline stage like this:

    # The file uses CRLF, hence the `tr -d '\r'`.
    recorded="$(tail -n +2 "${CSV}" | cut -d, -f1 | tr -d '\r' | ...)"

Both halves are wrong.

**The file is not CRLF.** `dependency-licenses.csv` has zero CR bytes. It was
CRLF when the guard was written -- 111 of them at 642eacf -- and 8eb0dcf
(NVIDIA#917) normalized it to LF while touching it for something unrelated, so the
sentence has been stale since that landed.

**And the `tr` would not be needed even if it were.** A CR sits immediately
before the newline, which puts it in the CSV's *last* field. `cut -d, -f1`
reads the first. The strip has never had anything to remove on this path.

Verified rather than reasoned: converting the committed CSV to CRLF (117 CR
bytes) and running the guard with the strip removed passes exactly as it does
today. I first wrote this commit claiming the opposite -- that dropping the
strip would report every crate as missing -- and the mutation refused to
reproduce it, which is how the second error came to light. Both directions,
both line endings, all four combinations agree.

So the stage goes, and the comment now records why no CR handling belongs
there. The same reasoning applies to the `.strip("\r")` in the example-workspace
half further down, which reads `line.split(",")[0]`; that one is left alone as
one concern per change.

Happy to keep the `tr` as belt-and-braces instead and only fix the comment --
it costs nothing at runtime. I removed it because a line whose stated purpose is
false and whose effect is nil teaches the next reader something untrue about the
file format, which is how it survived this long.

Verified: guard passes on the tree as committed (57 declared crates, plus the
example-workspace half), and passes identically with the CSV converted to CRLF.

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added refactor Internal restructuring with no behavior change documentation Improvements or additions to documentation build-related Build scripts, toolchain discovery, or compilation setup labels Aug 19, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

@nihalpasham
nihalpasham merged commit bf0d16a into NVIDIA:main Aug 19, 2026
112 of 114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup documentation Improvements or additions to documentation refactor Internal restructuring with no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants