zjncs opened a new pull request, #5602:
URL: https://github.com/apache/rocketmq-dashboard/pull/5602
Closes #5601
## Problem
`license-binary.go` splits the repository LICENSE/NOTICE at an LF-only
marker (`"\nThird-party source materials\n"`) to keep the web source-package
attribution out of the binary package. On a CRLF checkout — **the Git for
Windows default** (`core.autocrlf=true`) — the marker never matches and the
entire file (web attribution included) becomes the binary package's
LICENSE/NOTICE. The repo's own packaging test pins this contract and fails:
```
--- FAIL: TestBinaryLicensePackagingTest/linux
license-binary_test.go:116: the binary must carry the ASF NOTICE and
must not mix in the web
source-package attribution
```
CI (ubuntu, LF checkout) never sees it; Windows contributors with default
Git config get a red `go test ./...`, and release materials generated on such a
checkout would be non-compliant.
## Fix
Normalize CRLF before splitting (restores the canonical LF content of the
repo files):
```go
normalized := strings.ReplaceAll(text, "\r\n", "\n")
return strings.Split(normalized, "\nThird-party source materials\n")[0]
```
## Verification
- `go test ./scripts/ -run 'TestBinaryLicensePackagingTest/linux' -count=1`:
**FAIL on master, PASS with this change** (run on a CRLF checkout; note
`-count=1` — the scripts are executed via `go run`, so Go's test cache can mask
the red/green)
- Mutation check: reverting the normalization makes the linux subtest fail
again; restoring it passes
- `go vet ./scripts/` clean
- The windows subtest of the same test remains red on Windows for an
unrelated reason — the packaging script's `python3` fallback hits the Windows
Store stub (silent exit 49) and its zip fallback writes backslash entry names;
that is a separate defect I'll file next so this change stays minimal
## Collision note
No open PR touches `rmqctl/scripts/license-binary.go` or
`license-binary_test.go` (the nearest, #5432, only touches `build-windows.ps1`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]