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

1343 Commits

Author SHA1 Message Date
94e87c9377 Fixed typos 2022-05-26 15:43:55 -05:00
f9afa950e2 Update AUTHORS 2022-04-04 12:04:12 -05:00
6c24c71ddb Update my contributor info
My GitHub profile is at https://github.com/owenthereal
2022-04-04 12:04:12 -05:00
a9f97e9e61 Fix accidentally quadratic behavior in _modify
We need to be careful to not grab an extra reference when mutating data
structures because that means we make extra copies.  Doing that every
time in `_modify` is really painful, as that function implements `|=`
and all modify-assign operators.

`jv_setpath()` also grabs additional references, so this is not the only
fix needed for the modify-assign operators to not be accidentally
quadratic.

We have to use `LOADVN` in order to make this fix possible, so we should
really byte-code `_modify` rather than jq-code it.  However, as a
stop-gap to make this fix easier, I'm adding syntax for referring to a
`$binding` such that you get `LOADVN` instead of `LOADV`.

This syntax is not meant to be used outside jq's internals!  Therefore
it is not documented.  I promise to break it later, so don't use it!

TBD, but later:

 - Optimize `_modify` for the case where `update` outputs more than one
   value.

   This is trivial: add a `setpath($p; null)` in the middle of `_modify`
   before calling `update`.  But unfortunately the VM retains a
   reference to `value_at_path` for path expression checking, and fixing
   that will require more work.
2021-10-24 16:23:26 -05:00
0c3455d329 Fix accidentally quadratic behavior in setpath
We need to be careful to not grab an extra reference when mutating
data structures because that means we make extra copies.  Doing that
every time in `jv_setpath()` is really painful, as that function is used
in `_modify/2`, which is used in `|=` and all modify-assign operators.

`_modify` also grabs additional references, so this is not the only fix
needed for the modify-assign operators to not be accidentally quadratic.
2021-10-24 16:23:26 -05:00
1a1804afcb Fix LOADV/LOADVN refcount printing 2021-10-24 16:23:26 -05:00
582717a7b4 Fix crash in LOADVN when stack grows
This `stack_push()` call in LOADVN invalidates `var`:

       jv* var = frame_local_var(jq, v, level);
       jv_free(stack_popn(jq));
------>stack_push(jq, *var);
       *var = jv_null();
       ^^^^^^

We have to re-compute `var`:

       jv* var = frame_local_var(jq, v, level);
       jv_free(stack_popn(jq));
       stack_push(jq, *var);
------>var = frame_local_var(jq, v, level);
       *var = jv_null();
2021-10-24 16:23:26 -05:00
07dc653ae1 Appveyor: Get Appveyor building again 2021-10-24 16:23:26 -05:00
d79fe7fd58 Update docs/Pipenv.lock 2021-10-24 16:23:26 -05:00
a9ce7244b4 Fix Windows build for 1.7 release (moar) 2021-09-06 22:17:57 -05:00
34182cca7b Fix Windows build for 1.7 release (pthread stuff) 2021-09-03 14:18:18 -05:00
d18b2d078c Fix msys2 installation on AppVeyor
Ref: https://www.msys2.org/news/#2020-06-29-new-packagers
2021-05-01 14:34:26 -04:00
cc4efc49e1 Fix incorrect if empty string example 2021-05-01 14:33:01 -04:00
e615bdc407 update the version available through Chocolatey 2021-05-01 14:32:38 -04:00
9600a5c781 Re-apply patch from ff8924ce16e58f to dev manual 2021-05-01 14:19:45 -04:00
d57d9737d7 Remove decimal number text from v1.6 manual 2021-05-01 14:19:45 -04:00
2de3bc3732 Add large file support for 32-bit systems to fix issue 2167 2021-05-01 14:17:41 -04:00
77417c1335 Clean up compile warnings on macOS 2020-12-19 15:18:29 -05:00
e660003abf Use AX_PTHREAD to properly detect pthread and flags 2020-12-19 15:18:29 -05:00
80052e5275 Fix #2197 extended regex pattern example 2020-12-18 00:01:19 -05:00
a17dd3248a Add some missing code quoting to the manual 2020-06-08 12:35:13 -04:00
6306ac8966 Reduce allocation on string multiplication 2020-05-26 12:30:27 -04:00
9163e09605 Fix multiple string multiplication 2020-05-26 12:30:27 -04:00
15fa1dec99 Fix error handling in strftime 2020-05-26 12:29:34 -04:00
ccc79e592c Makefile: prepend srcdir to jq.1.prebuilt to fix out of source compilation 2020-03-03 11:50:04 -05:00
50a7022ea6 Rework pipenv requirement to be more relaxed
Keep a cached copy of the man tests that we can use when no manpage
changes are made. This allows automated systems that might not have
easy access to a pipenv to build and run tests.
2020-03-02 11:05:43 -05:00
8c61ebad0a Minor fixes to website generation 2020-03-02 10:55:51 -05:00
d24c3d2263 Change Homebrew version in docs to 1.6 2020-03-02 10:10:08 -05:00
63b5c7b553 compatibiltiy->compatibility 2020-03-02 10:05:32 -05:00
5b9e63e4af fix typos 2020-01-14 10:18:22 -06:00
503fae5dc9 remove unused conditional branch
It has no effect after the change c4524da.

Bug reported by the clang static analyzer.

Description: Value stored to 'value' is never read
File: jq/src/util.c
Line: 439
2020-01-10 12:01:08 -06:00
087100183c Add information on how to install on OS X with MacPorts 2020-01-07 23:35:19 -06:00
baecf2ce9e docs: --indent value has maximum of 7, not 8
Test Plan:
To verify that this is in fact the behavior:

```
$ jq --indent 7 -n '[1]'
[
       1
]
$ jq --indent 8 -n '[1]'
jq: --indent takes a number between -1 and 7
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq
```

This patch was generated by running `git grep "no more than"` and fixing
up appropriate results.

wchargin-branch: docs-fix-indent-bounds
2020-01-07 23:34:52 -06:00
e7d37983c4 outputing -> outputting 2020-01-03 09:56:04 -06:00
07b18a33fe Update other manual and source to use ;37 2020-01-02 15:47:26 -06:00
cf615152e1 correct the default JQ_COLORS to use 37, not undefined color 39 2020-01-02 15:47:26 -06:00
fa3733cc4c fix typos 2020-01-02 10:52:12 -06:00
82987df98d Improve formatting of flags and link to specific wiki article for cross-compilation. 2020-01-02 10:33:35 -06:00
839316e66b compile-ios.sh: realpath is not a default command. 2019-12-30 17:48:45 -06:00
d235e97f5e compile-ios.sh: Update grammar 2019-12-30 17:48:45 -06:00
4c2e63a658 Updated compile-ios.sh script. 2019-12-30 17:48:45 -06:00
24564b2d34 Add -0 / --nul-output option for processing values containing newlines
Closes: https://github.com/stedolan/jq/issues/1271
2019-12-30 15:37:14 -06:00
707022b0e5 Rephrase doc "A string B is contained in A" ...
Minor rephrasing to prevent read/brain backtracking when using capital letter A as an article and a variable term.
2019-12-29 23:52:47 -06:00
2065d6c3aa Differentiate WIN32 / Cygwin in configure script
shlwapi.h is present on both systems
2019-12-29 19:24:04 -06:00
e74eab828e Fix nesting try/catch inside internal errors 2019-11-21 17:53:12 -05:00
bda75c3142 Ensure travis has a python version we expect 2019-10-23 21:31:05 -04:00
9b51a0852a Remove an accidentally committed debug file 2019-10-22 14:11:04 -04:00
74c44bc9a3 Add configure guards around literal jv_numbers
Allow building jq in a mode that doesn't use decnumber for benchmarking
purposes. decnumber support is enabled by default, and this option is
meant to be removed once we're happy with the performance.
2019-10-22 14:11:04 -04:00
4860ed4396 [tests] print test # from the start of the tests file to help with skip and take 2019-10-22 14:11:04 -04:00
cf4b48c7ba Save literal value of the parsed number to preserve it for the output
Extend jv_number to use decNumber for storing number literals. Any math
operations on the numbers will truncate them to double precision.
Comparisons when both numbers are literal numbers will compare them
without truncation.

Delay conversion of numbers to doubles until a math operation is performed,
to preserve precision. A literal jv_number will only need conversion to
double once, and will reuse the resultant double on subsequent
conversions.

Outputting literal jv_numbers preserves the original precision.

Add strong pthread requirement to manage contexts/allocations for
converting numbers between their decNumber, string, and double formats.
2019-10-22 14:11:04 -04:00