1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00
Commit Graph

1508 Commits

Author SHA1 Message Date
Nicolas Williams
f64ef1a7d7 Fix --stream-errors w/o --stream, and doc+test (close #2748) 2023-07-23 03:33:28 -05:00
itchyny
123c780607 Enable significand on macOS 2023-07-23 03:28:07 -05:00
itchyny
99a381b5aa Improve --help to mention all the command options 2023-07-23 03:26:44 -05:00
itchyny
575372222a Add importlib_resources dependency for older Python (fix #2753) (#2754) 2023-07-23 15:01:16 +09:00
itchyny
34629ed223 Fix manual source code to follow the schema definition 2023-07-22 19:00:16 -05:00
itchyny
9044f540bb Validate manual schema 2023-07-22 19:00:16 -05:00
itchyny
c9c45d7f03 Add tests for --arg, --argjson, and similar options 2023-07-22 12:29:24 -05:00
itchyny
649d6b5f5e Update AUTHOR for the next release 2023-07-22 11:53:43 -05:00
itchyny
e0e1b2293e Enable verbose output of make check 2023-07-21 19:49:48 -05:00
itchyny
3ed928954a Fail quickly if not in git repository in scripts/version 2023-07-21 08:59:17 -05:00
itchyny
4732dd82c0 Remove AppVeyor configuration (#2741) 2023-07-21 22:45:45 +09:00
pkoppstein
3553a9d617 manual.yml: some clarifications plus fixes for markdown bloopers (#2737) 2023-07-21 21:33:03 +09:00
itchyny
7c2bf9bd17 Clarify the Docker image location (close #1864) (#2740) 2023-07-21 20:42:11 +09:00
itchyny
99a77f724b Add a regression test for #2000 2023-07-21 09:01:28 +09:00
William Langford
515260213c Increment nlocals when compiling STORE_GLOBAL ops (#2000)
These are stored in vars, so we need to make sure that nlocals is large
enough to account for that
2023-07-21 09:01:16 +09:00
pkoppstein
3ec66c858c manual.yml: revise section on identity, clarifying what is subject to change
Mostly clarifications w.r.t. numbers.

The anomalous behavior of leading minus signs is documented, with an explicit notice that this will probably change.
2023-07-19 22:32:24 -05:00
Robert Aboukhalil
a192e647c5 Move options to main and pass it to process 2023-07-19 13:07:46 -05:00
Robert Aboukhalil
4c25cf3f7c Reset options to 0 so can call main() multiple times in a row 2023-07-19 13:07:46 -05:00
itchyny
f1c49473a3 Avoid getpwuid for static linking 2023-07-19 09:56:41 -05:00
itchyny
f0306405c1 Add notes on NO_COLOR environment variable to the manual 2023-07-19 09:56:01 -05:00
itchyny
0615d4982c Respect NO_COLOR environment variable to disable color output 2023-07-19 00:05:41 -05:00
itchyny
87e3dfddb8 Enable valgrind in oniguruma workflow 2023-07-19 06:45:09 +02:00
itchyny
0b558f6ed4 Make object key color configurable (close #1739, #1791, #2638)
Co-authored-by: David Haguenauer <ml@kurokatta.org>
Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
2023-07-18 17:53:29 -05:00
Emanuele Torre
62d65a8a9c Fix memory leaks in --with-oniguruma=no implementation of f_match
Found by LeakSanitizer running  ./jq -n '"" | test("")'  in a
--with-oniguruma=no --enable-ubsan --enable-asan  build.
2023-07-18 14:45:20 -05:00
itchyny
0e3c3913d8 Add oniguruma workflow to test regex options 2023-07-18 14:28:16 -05:00
Emanuele Torre
7ffb7943d4 Fix signed integer overflow undefined behaviour in decNumber.c
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60691

  $ ./jq <<< 0E2202012202
  src/decNumber/decNumber.c:598:18: runtime error: signed integer overflow: 440402440 + 1761609760 cannot be represented in type 'int'
  0E+999999999

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60683

  $ ./jq <<< 5E7657765755
  src/decNumber/decNumber.c:598:18: runtime error: left shift of 765776575 by 3 places cannot be represented in type 'int'
  src/decNumber/decNumber.c:598:18: runtime error: signed integer overflow: 1531553150 + 1831245304 cannot be represented in type 'int'
  1.7976931348623157e+308
2023-07-18 14:03:40 -05:00
Emanuele Torre
15fd31de78 Define examples in the "examples" field instead of "example"
Only examples defined in the "examples" field are generated, if they are
defined in "example", they are just ignored.

Also fix a bunch of incorrect tests.
2023-07-18 12:12:50 -05:00
Emanuele Torre
01dfd8b86d Populate captures also for zero-width matches
Instead of just using {"captures":[]}.

sub functions are use captures for replacement expressions.
If we don't populate, captures for empty matches, the replacement
expression is run with an empty object as input instead of an object
containing the named captures with "" as value:

* before:

  $ jq -n '"123foo456bar" | gsub("[^a-z]*(?<x>[a-z]*)"; "Z\(.x)")'
  "ZfooZbarZnull"

* after:

  $ jq -n '"123foo456bar" | gsub("[^a-z]*(?<x>[a-z]*)"; "Z\(.x)")'
  "ZfooZbarZ"

---

I also removed a redundant

  result = NULL;
  if (result) {
    ...
  }
2023-07-18 12:12:50 -05:00
Emanuele Torre
bb0f898c01 Initialise jq_state->debug_cb{,_data} to NULL
To make debug/0 not call an uninitialised function pointer when using
--run-tests or when using a jq_state on which jq_set_debug_cb() has not
been called.
2023-07-18 12:12:50 -05:00
itchyny
9e4c71558a Split man.test to make tests pass without oniguruma (#2722) 2023-07-18 08:17:21 +09:00
Emanuele Torre
4b3090a9ab Make stream parser error when a non-empty object or array is used as key
Fixes #2463
2023-07-17 13:15:55 -05:00
Emanuele Torre
e79335e3a5 Initialise jq_state->input_cb{,_data} to NULL in jq_init()
To avoid causing segmentation faults when  input/1  is called in a
jq_state on which  jq_set_input_cb()  has not been called; e.g. the one
used by  jq --run-tests.

That segfault could also be fixed in run_jq_tests() by calling:

  jq_set_input_cb(jq, NULL, NULL);

But I think it makes sense to just make jq_init() initialise those
values to NULL.

Ref: https://github.com/jqlang/jq/pull/2717#discussion_r1264338841
2023-07-16 00:03:46 -05:00
itchyny
1cb9ba3533 Fix autoreconf warnings 2023-07-16 00:02:46 -05:00
Emanuele Torre
1915b689f7 Fix indices/1 and rindex/1 in case of overlapping matches in strings
Fixes #2433
2023-07-14 23:40:37 -05:00
Emanuele Torre
bf4390562f Add workflow that runs tests with valgrind on linux
To hopefully detect when we introduce new memory leaks. :-)
2023-07-15 01:29:13 +02:00
itchyny
24871fb4a3 Fix memory leak on halt_error/1 2023-07-14 13:39:21 +02:00
pkoppstein
07ef97c414 debug/1 (#2710)
* debug/1

This def ensures the output of debug(m1,m2) is kept together.

Closes #2709 #2111 #2112
2023-07-14 00:17:42 +02:00
Emanuele Torre
4b1ac7c95f Parse nan in JSON as NaN instead of triggering a parse error (#2712)
* Fix memory leak for has(nan)

jv_array_get() used to be responsible of freeing the input array, but
since b5c4c3d67d, it is no longer called
if the key is nan. We need to free it manually to avoid leaking the
array.

* Parse  nan  in JSON as NaN instead of triggering a parse error

Fixes #2021
2023-07-14 07:12:27 +09:00
itchyny
092fef740a Make sure distcheck passes and run dist job on Pull Request 2023-07-13 10:20:04 -05:00
itchyny
481167c8f1 Update jinja2 to fix deprecation warnings on building website (#2711) 2023-07-14 00:06:53 +09:00
itchyny
689a4e660b Fix uri format to follow RFC 3986 (#2157) 2023-07-13 23:23:23 +09:00
Emanuele Torre
55249e29be Also run manpage.yml workflow on pull requests that modify the manual 2023-07-13 06:20:11 +02:00
Emanuele Torre
ab2779e2e5 Mark src/decNumber/** as vendored files
This excludes those files from the Languages statistics on github.
2023-07-12 11:14:39 -05:00
itchyny
b5c4c3d67d Fix has(nan) on arrays to output false 2023-07-12 09:40:05 -05:00
itchyny
14e5e630ed Revert unexpected changes in decNumber code (ref #2031) 2023-07-11 18:36:36 -05:00
Emanuele Torre
c99981c5b2 Update "tests/man.test" and remove superflous whitespace in manual.yml
tests/man.test was generated incorrectly and had some duplicate tests,
the new CI workflow didn't like that.
2023-07-11 00:24:50 -05:00
Emanuele Torre
c049061084 Fix build_manpage.py with newer markdown versions
The markdown python changed its API for markdown extensions.

Bumping the markdown package version in previous commits broke
docs/build_manpage.py since it was using registering an extension with
the old API.
2023-07-11 00:24:50 -05:00
Emanuele Torre
83d4dd16ad Add CI workflow to make sure the man page and man.test can be built
And that man.test is up to date.
2023-07-11 00:24:50 -05:00
Owen Ou
4ff63d9365 Add checksums.txt for release
Add checksums.txt for release
2023-07-10 23:59:07 -05:00
itchyny
4c125c7ca6 Do not remove manpage prebuild file on build failure 2023-07-10 18:47:14 -05:00