Page MenuHomeFreeBSD

git-arc: Make patch with reviewers more portable
ClosedPublic

Authored by jlduran on Sep 25 2024, 6:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 29, 1:44 AM
Unknown Object (File)
Nov 24 2024, 11:34 PM
Unknown Object (File)
Nov 24 2024, 11:58 AM
Unknown Object (File)
Nov 22 2024, 9:33 AM
Unknown Object (File)
Nov 18 2024, 7:00 PM
Unknown Object (File)
Nov 15 2024, 4:13 PM
Unknown Object (File)
Nov 15 2024, 4:11 PM
Unknown Object (File)
Nov 3 2024, 8:38 AM
Subscribers

Details

Summary

Avoid an ArcanistUsageException:

Provide method parameters on stdin as a JSON blob.

Due to an invalid JSON input on strict POSIX-compliant shells (macOS):

echo '{
        "constraints": {"phids": [-n,"PHID-USER-xxx",]}
      }'                          ^^^               ^

Change the non-portable "echo -n" to a printf.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59591
Build 56478: arc lint + arc unit

Event Timeline

jlduran created this revision.

I see a couple of other uses of echo -n, in gitarc__list().

Fix other occurrences of "echo -n" while here.

This revision is now accepted and ready to land.Sep 25 2024, 7:20 AM
0mp added a subscriber: 0mp.

I'll commit it soon.

This revision was automatically updated to reflect the committed changes.
des added inline comments.
tools/tools/git/git-arc.sh
331

you can just use echo here, the shell will strip the newline.

tools/tools/git/git-arc.sh
331

Yes, the problem I see with using echo is that the trailing new line will also be translated to a ,, as it is also considered a [:space:]:

% userids="emaste imp markj 0mp"
% echo "$userids" | tr '[:space:]' ','
emaste,imp,markj,0mp,%
                    ^extra ','
% printf "%s" "$userids" | tr '[:space:]' ','
emaste,imp,markj,0mp%
tools/tools/git/git-arc.sh
331

Use [:blank:] instead.

Please, feel free to commit the changes from that branch if you should consider so:
https://github.com/jlduran/freebsd-src/tree/fix-git-arc-consolidated

I do not yet have the appropriate permissions to do it.

tools/tools/git/git-arc.sh
331

Given this review has already been committed, present the suggestion on a separate patch:
https://github.com/jlduran/freebsd-src/commit/2c542e64d49252427c944ea43b2fc4eb35ad802c

I do not yet have the appropriate permissions to do it.

I believe everything should be set now.

I do not yet have the appropriate permissions to do it.

I believe everything should be set now.

Thank you!