Jq: OSX: segfault on select(.value|test("pattern"))'

Created on 9 Mar 2020  路  1Comment  路  Source: stedolan/jq

Describe the bug

segfault with jq on osx when using select(...test).
The exact same jq command works on linux.

To Reproduce

Sample input file test.json:

[
  {
    "key": "CertificateArn",
    "value": "arn:aws:acm:eu-west-1:REDACTED:certificate/FOO"
  },
  {
    "key": "DomainName",
    "value": "pattern.example.com"
  }
]
[
  {
    "key": "CertificateArn",
    "value": "arn:aws:acm:eu-west-1:REDACTED:certificate/BAR"
  },
  {
    "key": "DomainName",
    "value": "baz.example.com"
  }
]
$ cat test.json | jq '.[] | select(.value|test("pattern"))'
Segmentation fault: 11
````

**Expected behavior**

cat test.json | jq '.[] | select(.value|test("pattern"))'

{
"key": "DomainName",
"value": "pattern.example.com"
}
```

Environment (please complete the following information):

  • Bug on OSX 10.15.1 (homebrew jq 1.6)
  • Works on alpine-3.11.3, and ubuntu/centos (via downloading the 64bit binary for 1.6)
  • jq version 1.6
not a bug

Most helpful comment

Ahh.

I ran brew uninstall jq; brew install jq, and it worked.

Further digging revealed the problem:

https://github.com/kkos/oniguruma/issues/159#issuecomment-543341100

tl;dr: If you installed jq before upgrading to Catalina, any regexp will segfault.

I'm not sure how homebrew is supposed to handle OS upgrades, but seems to me that OS upgrades need to be factored in, especially if the desired version of an installed brew application remains the same but the dependency was bumped (in this case oniguruma)

I hope this helps someone!

>All comments

Ahh.

I ran brew uninstall jq; brew install jq, and it worked.

Further digging revealed the problem:

https://github.com/kkos/oniguruma/issues/159#issuecomment-543341100

tl;dr: If you installed jq before upgrading to Catalina, any regexp will segfault.

I'm not sure how homebrew is supposed to handle OS upgrades, but seems to me that OS upgrades need to be factored in, especially if the desired version of an installed brew application remains the same but the dependency was bumped (in this case oniguruma)

I hope this helps someone!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rokka-n picture rokka-n  路  4Comments

kaihendry picture kaihendry  路  4Comments

rubensayshi picture rubensayshi  路  3Comments

sloanlance picture sloanlance  路  3Comments

lbrader picture lbrader  路  3Comments