Skip to content

fetch-all-upstreams: error output from jq suppressed? #96

@salewski

Description

@salewski
    $ ads-github-fetch-all-upstreams --version
    ads-github-fetch-all-upstreams 0.3.5  (built: 2022-10-26 03:00:34)
    Copyright (C) 2016, 2017, 2019, 2020 Alan D. Salewski
    License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Alan D. Salewski.

Issue description
When cloning two explicitly-named GitHub forks (and probably in other scenarios), there is the possibility of a parse error from jq(1) whose diagnostic error message gets suppressed, resulting in a less-than-helpful error message from ads-github-fetch-all-upstreams. The message is visible, though, when you request trace-level output (e.g., by using three -v options):

$ ads-github-fetch-all-upstreams -vvvcu --cache-mode=online -- repo-A repo-B 2>&1 | less +F
...
++ /usr/bin/rm -f -r -v /tmp/ads-github-cache.WeTP9aWR
+ let idx=0-1
+ test -1 -ge 0
+ test 0 -ne 0
+ test -s /tmp/ads-github-fetch-all-upstreams.wNm89bvg/gh-data-from-cache-user-repos-FULL.pgt8MOpizGi4
+ :
+ /usr/bin/jq --raw-output '.[] | select( .owner.type == "User" ) | .name + ":" + .full_name + ":" + .default_branch + ":" + if (.fork) then "true" else "false" end'
parse error: Invalid numeric literal at line 1, column 12028398
+ test 4 -ne 0
+ printf 'ads-github-fetch-all-upstreams (error): Was unable to extract data from /user/repos output; bailing out\n'
ads-github-fetch-all-upstreams (error): Was unable to extract data from /user/repos output; bailing out
+ exit 1
+ f_cleanup
...

When not running in trace mode, the user sees only a generic error message stating that the second repo named on the command line was not cloned; no indication of the jq parse error is emitted.

Expectation: The program either completes successfully, else gives a clear indication of what the error was.

Impact: The clone of the first repo named on the command line is created, but the clone of the second repo named is not created.

Speculation: This issue may have something to do with a GitHub fork named with a . (full stop/period/dot) in its name. When I tripped over this issue, I had just created such a repo using the GitHub webUI, and then attempted to use ads-github-fetch-all-upstreams to create a local clone of that repo and one other.

EDIT: The earlier-noted scenario requiring two named repos on the command line has been ruled-out as a primary contributing factor. The error shown to the user reflected a typo in the second repo name, which was not detected earlier.

EDIT: The earlier-noted speculation about repo names with a . (full stop/period/dot) character in their names has been ruled-out as a primary contributing factor for this issue.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions