[
https://issues.apache.org/jira/browse/THRIFT-6302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6302.
--------------------------------
Fix Version/s: 0.26.0
Assignee: Jens Geyer
Resolution: Fixed
> veralign.sh: jsonReplace reports failures as OK, and the file loop is not
> sorted
> --------------------------------------------------------------------------------
>
> Key: THRIFT-6302
> URL: https://issues.apache.org/jira/browse/THRIFT-6302
> Project: Thrift
> Issue Type: Bug
> Components: Build Process
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Three smaller defects in {{build/veralign.sh}}, noticed while working on
> THRIFT-6301. None of them changes what a bump writes when it succeeds, but
> the first one hides a failure.
> h3. jsonReplace reports a failure as OK
> {noformat}
> result=$?
> if [ $? -ne 0 ]; then
> {noformat}
> The second {{$?}} is the status of the assignment {{result=$?}}, which is
> always 0, so the error branch never runs. With a malformed
> {{lib/js/package.json}}, veralign prints {{OK}} for that file and exits 0;
> the file keeps the old version, and a {{tmp.<pid>.json}} is left behind in
> the source root. The error branch would also print {{$count}}, which
> {{jsonReplace}} never sets.
> h3. The file loop is not sorted
> {noformat}
> for file in $(echo "${!FILES[@]}" | sort); do
> {noformat}
> {{echo}} prints all keys on one line, so {{sort}} gets a single line, and the
> files are processed in the associative array's hash order. The table veralign
> prints comes out unsorted. Since the script stops at the first failure, which
> files have already been rewritten at that point depends on that order as
> well. Printing one key per line with {{printf}} before {{sort}} would fix it.
> h3. Typos in comments
> "hilighted", "hilighting", and "striing" (twice).
> _Drafted with AI assistance (Claude Opus 5); filed on behalf of Jens Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)