Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idkwtf list_issues = curl: (6) Could not resolve host: api.github.com<https ?? #66

Closed
dubiouscript opened this issue Nov 22, 2018 · 4 comments
Labels

Comments

@dubiouscript
Copy link
Contributor

./ok.sh list_issues nixos/nix

...

bash -x ./ok.sh -vvv list_issues nixos/nix 2>&1 | tee "$log_file"
..

<= Recv header, 153 bytes (0x99)
0000: Link: <https://api.github.com/repositories/3386088/issues?page=2
0040: >; rel="next", <https://api.github.com/repositories/3386088/issu
0080: es?page=33>; rel="last"
+ read -r hdr val
+ '[' Link = $'\r' ']'
+ val='<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?p
age=33>; rel="last"'
+ case "$hdr" in
++ printf %s '<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?page=33>; rel="last"'
++ awk '
                BEGIN { RS=", "; FS="; "; OFS=": " }
                {
                    sub(/^rel="/, "", $2); sub(/"$/, "", $2)
                    sub(/^[[:space:]]*</, "", $1); sub(/>$/, "", $1)
                    print "Link_" $2, $1
                }'
+ headers='http_version: 1.1
status_code: 200
status_text: OK
Server: GitHub.com
Date: Thu, 22 Nov 2018 16:02:38 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 93284
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1542905660
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: 9dc7bc9fda118e6e7066512ebc3da67d
X-GitHub-Media-Type: github.v3; format=json
Link_next: <https://api.github.com/repositories/3386088/issues?page=2
Link_last: <https://api.github.com/repositories/3386088/issues?page=33
realpath $(which awk )
/usr/bin/mawk

mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan

messing about abit
i guess this is the expected result !!

printf %s '<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?page=33>; rel="last"' | awk '
                BEGIN { RS=", "; FS="; "; OFS=": " }
                {
                    sub(/^rel="/, "", $2); sub(/"$/, "", $2)
                    sub(/^ *</, "", $1); sub(/>$/, "", $1)
                    print "Link_" $2, $1
                }'
Link_next: https://api.github.com/repositories/3386088/issues?page=2
Link_last: https://api.github.com/repositories/3386088/issues?page=33

... so this appears a
problem with mawk /^[[:space:]]*</

@dubiouscript
Copy link
Contributor Author

dubiouscript commented Nov 23, 2018

..
edit : just found
https://github.com/whiteinge/ok.sh/blob/master/.github/ISSUE_TEMPLATE/bug_report.md
...

lubuntu 18.10
curl -V
curl 7.61.0 (x86_64-pc-linux-gnu) ...
realpath $(which awk )
/usr/bin/mawk
mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
jq -V
jq-1.5-1-a5b5cbe
bash --help
GNU bash, version 4.4.19(1)-release-(x86_64-pc-linux-gnu)
./ok.sh from git clone https://github.com/whiteinge/ok.sh.git =S

ok.sh -vvv -x list_issues nixos/nix 2> ok-shdebug.log
ok-shdebug.log git cloned
./ok.sh-0.3.0/ok.sh -vvv -x list_issues nixos/nix 2> ok-shdebug.log
ok-shdebug.log

@whiteinge
Copy link
Owner

Interesting. Thanks a lot for the solid sleuthing! The version of mawk in Homebrew doesn't exhibit the same problem -- maybe it's compiled against a different regex lib than in Nix 🤷‍♂️.

That said, replacing [[:space:]] is a fine change and works as expected with mawk, gawk and BSD awk on OSX. Do you want to send in a PR?

@dubiouscript
Copy link
Contributor Author

  • maybe it's compiled against a different regex lib than in Nix

this was with the mawk from lubuntu 18.10.
*was just attempting view list the issues from nixos/nix
... in fact nix-shell -p jq -p mawk appears to work

sudo apt-get source mawk
says
mawk 1.3.3-17ubuntu3 - https://launchpad.net/ubuntu/+source/mawk/1.3.3-17ubuntu3
https://launchpad.net/ubuntu/cosmic/+source/mawk
... i didnt see any regex lib listed in the deps so..
idk..but some patch is applied to fix some thing regarding regexp so it could be that ?

just for reference .. im guessing this is the homebrew mawk build-config
https://github.com/Homebrew/homebrew-core/blob/master/Formula/mawk.rb

Do you want to send in a PR?

i guess ! . .
( not that familiar with PR process though tbh ... )
done?

@whiteinge
Copy link
Owner

Thank you for tracking down the problem and then fixing it! Awesome work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants