org
stringclasses
3 values
repo
stringclasses
3 values
number
int64
637
4.6k
state
stringclasses
1 value
title
stringlengths
6
114
body
stringlengths
9
3.59k
base
stringlengths
90
96
resolved_issues
listlengths
1
2
fix_patch
stringlengths
413
131k
test_patch
stringlengths
387
120k
fixed_tests
stringlengths
61
151k
p2p_tests
stringlengths
1.1k
165k
f2p_tests
stringlengths
61
3.26k
s2p_tests
stringclasses
0 values
n2p_tests
stringlengths
55
151k
run_result
stringlengths
130
74.6k
test_patch_result
stringlengths
119
74.6k
fix_patch_result
stringlengths
130
74.7k
instance_id
stringlengths
15
20
facebook
zstd
1,243
closed
fix #1241
Ensure that first input position is valid for a match even during first usage of context by starting reference at 1 (avoiding the problematic 0).
{"label": "facebook:dev", "ref": "dev", "sha": "df09d4318f0f4f06d76c1e288732f5f9b1d9f59a"}
[ { "body": "It appears that since commit 9d65a5c, compressing the same input data twice in a row while using the same compression context - even if the context is reset between compressions - results in different outputs when using certain compression levels. We were relying on the guarantees that @Cyan4973 desc...
diff --git a/appveyor.yml b/appveyor.yml index 742f612069d..2b674ce3ca1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -181,15 +181,15 @@ - COMPILER: "gcc" HOST: "mingw" PLATFORM: "x64" - SCRIPT: "make allzstd" + SCRIPT: "CPPFLAGS=-DDEBUGLEVEL=2 CFLAGS=-Werror make -j allzstd DEBUG...
diff --git a/tests/Makefile b/tests/Makefile index 813380cc2e1..81e6857802d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -27,6 +27,9 @@ DEBUGLEVEL ?= 1 DEBUGFLAGS = -g -DDEBUGLEVEL=$(DEBUGLEVEL) CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(...
{"all tests": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
{"all tests": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 1, "failed_count": 0, "skipped_count": 0, "passed_tests": ["all tests"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 1, "skipped_count": 0, "passed_tests": [], "failed_tests": ["all tests"], "skipped_tests": []}
{"passed_count": 1, "failed_count": 0, "skipped_count": 0, "passed_tests": ["all tests"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1243
facebook
zstd
1,107
closed
Add ZSTD_CCtx_resetParameters() function
* Fix docs for `ZSTD_CCtx_reset()`. * Add `ZSTD_CCtx_resetParameters()`. Fixes #1094.
{"label": "facebook:dev", "ref": "dev", "sha": "3c3f59e68f1771dabeb020c0aa0f30b8c9c59936"}
[ { "body": "From `zstd.h`:\r\n\r\n```\r\n/*! ZSTD_CCtx_reset() :\r\n * Return a CCtx to clean state.\r\n * Useful after an error, or to interrupt an ongoing compression job and start a new one.\r\n * Any internal data not yet flushed is cancelled.\r\n * Dictionary (if any) is dropped.\r\n * All parameters a...
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 590e92c8e8c..7a504328420 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -72,9 +72,11 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem) { ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_calloc(s...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 33d27cda79a..9b49ddd080e 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -433,6 +433,12 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK_EQ(value, 7); CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value)); CHEC...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1107
facebook
zstd
1,106
closed
Enforce pledgeSrcSize whenever known
The test fails before the patch and passes after. Fixes #1095.
{"label": "facebook:dev", "ref": "dev", "sha": "1f25b17c7da7640cb3ce06f99e28b87811fddd26"}
[ { "body": "It appears that `ZSTD_CCtx_setPledgedSrcSize()` doesn't always validate the input size matches the pledged size: `ZSTD_compressContinue_internal()` only applies the check if the content size is being written into the frame header.\r\n\r\nI'm not sure if that is a feature or a bug. (I don't have a str...
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 13ac747c55a..590e92c8e8c 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2152,6 +2152,7 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, BYTE const frameHeaderDecriptionByte = (BYTE...
diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index b94f282f580..14412f4b9e4 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -460,6 +460,21 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "OK (error detected : %s) \n", ZSTD_getErrorName(r)); } + D...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1106
facebook
zstd
1,105
closed
Add ZSTD_CCtx(Param)?_getParameter() function
Closes #1096.
{"label": "facebook:dev", "ref": "dev", "sha": "04212178b50131ecbbf7bc2ffcce4d5ddcfd8e11"}
[ { "body": "Internally, `ZSTD_CCtx` tracks its state via `ZSTD_compressionStage_e` and `ZSTD_cStreamStage` enums. `ZSTD_DDctx` does something similar with `ZSTD_dStage` and `ZSTD_dStreamStage`. There are also parameters and dictionaries associated with instances.\r\n\r\nThe state of the context is currently hidd...
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 36b91030f54..13ac747c55a 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -477,6 +477,98 @@ size_t ZSTD_CCtxParam_setParameter( } } +size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param,...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 589a4aca436..33d27cda79a 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -117,6 +117,13 @@ static unsigned FUZ_highbit32(U32 v32) #define CHECK(fn) { CHECK_V(err, fn); } #define CHECKPLUS(var, fn, more) { CHECK_V(var, fn); more; } +#define CHECK_EQ(lhs, rhs) ...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1105
facebook
zstd
1,080
closed
added ZSTD_getFrameHeader_advanced()
fix #1078 Improved code documentation of `ZSTD_getFrameHeader()` Added `ZSTD_getFrameHeader_advanced()`, which makes it possible to request detailed frame header information from a magic-less frame. Added a test to check it works.
{"label": "facebook:dev", "ref": "dev", "sha": "99e8063d40c38355f26f97249c8ef3f30e15d5b4"}
[ { "body": "`ZSTD_frameHeaderSize()` can return an error. However, the docstring for this function - unlike most other docstrings in `zstd.h` - does not state that it can return an error. The docstring of `ZSTD_frameHeaderSize_internal()` does say it can return an error though.", "number": 1078, "title":...
diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 3ec6a1cb328..103dcc6483c 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -298,20 +298,21 @@ static size_t ZSTD_frameHeaderSize_internal(const void* src, size_t srcSize, ZST /** ZSTD_frameHea...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index e97b841e853..589a4aca436 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1085,9 +1085,13 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "OK : %s \n", ZSTD_getErrorName(decodeResult)); } - DISPLAYLEVEL(...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1080
facebook
zstd
1,008
closed
Fix hashLog3 size when copying cdict tables
Fixes #1004. The window log can't shrink so far as to shrink the `hashLog3`, but we can allow it to grow, and increase `hashLog3`.
{"label": "facebook:dev", "ref": "dev", "sha": "823a28a1f4cb89be7ec22ee5d34754b54e9f2b6e"}
[ { "body": "I have some other questions about dictionaries…\r\nZSTD_createCDict uses data generated by the cli \"zstd --train\", right?\r\nIs there any incidence of the compression level used in --train?\r\n\r\nWith release 1.3.3, I get crashes after having called ZSTD_createCDict with a compression level >= 14;...
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 5211384e050..19589553fe6 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -659,6 +659,24 @@ ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, u return ZSTD_adjustCParams_intern...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 0a6cf61d2e3..3982f8bbc2b 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -763,28 +763,31 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : compress with static CDict : ", testNb++...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_1008
facebook
zstd
983
closed
Increase windowLog from CDict based on the srcSize when known
During compression with a CDict, when the source size is known, we want to increase the window log to fit the dictionary and the source. However, since we don't know the compression level at this point, we need to limit how large we make the window size. Since dictionary compression is meant for small sources, we can p...
{"label": "facebook:dev", "ref": "dev", "sha": "04c00f9388b5d57665792571fe46a7eadc973c8d"}
[ { "body": "I just found a regression when using dictionaries with zstd 1.3.3 and c-blosc2. Here you can see the performance with zstd 1.3.0 and c-blosc2:\r\n\r\n```\r\n$ tests/test_dict_schunk \r\nSTARTING TESTS for tests/test_dict_schunk\r\n[blocksize: 1 KB] cratio w/o dict: 3.5x (compr @ 554.0 MB/s, decompr ...
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index b9e0ec44ddd..d11fbeb3c48 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2453,6 +2453,15 @@ size_t ZSTD_compressBegin_usingCDict_advanced( if (cdict==NULL) return ERROR(dictionary_wrong); { ZSTD_C...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 024a583ba40..21d7d21a38e 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1206,6 +1206,28 @@ static int basicUnitTests(U32 seed, double compressibility) if (strcmp("No error detected", ZSTD_getErrorName(ZSTD_error_GENERIC)) != 0) goto _output_error; DISPL...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_983
facebook
zstd
938
closed
Use util.h for timing
Fixes #935. @mestia can you verify that this patch fixes the tests on GNU Hurd?
{"label": "facebook:dev", "ref": "dev", "sha": "b3d76e0a94502e2f484d7495c88ca3a21d44155b"}
[ { "body": "tests/Makefile defines `FUZZERTEST ?= -T200s` which is passed then to fuzzer tool.\r\n`fuzzer -T200s` just never finishes.\r\nBy running `fuzzer -v -T200s` on a hurd system I see incrementing count of test.\r\nTest runs for more than 18 hours:\r\n```\r\ntests# ./fuzzer -v -T200s\r\nStarting zstd test...
diff --git a/programs/bench.c b/programs/bench.c index 1df8aeb0d01..63b98e53220 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -34,7 +34,6 @@ #include <stdlib.h> /* malloc, free */ #include <string.h> /* memset */ #include <stdio.h> /* fprintf, fopen */ -#include <time.h> /* clock_t, ...
diff --git a/tests/decodecorpus.c b/tests/decodecorpus.c index e697e519cfc..407653119dd 100644 --- a/tests/decodecorpus.c +++ b/tests/decodecorpus.c @@ -14,8 +14,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> +#include "util.h" #include "zstd.h" #include "zstd_internal.h" #in...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_938
facebook
zstd
836
closed
Decoding buffer size min
fix #835 : gives ability to users of bufferless streaming API `ZSTD_decompressContinue()` to size their own decoding buffer, using same methodology as `ZSTD_decompressStream()`, aka a round buffer of minimal size, taking into consideration current limitations of reference decoder. To this end, add prototype `ZST...
{"label": "facebook:dev", "ref": "dev", "sha": "3128e03be69b9d3db054a3765ae1310c7b3666f6"}
[ { "body": "I am trying to add `zstd` decompression support to an existing state-machine based stream parser. Basically I am trying to handle all of the frame and block headers and checksums myself and only use `ZSTD_decompressBlock()`\r\n\r\nI have this basically working, but one question remains: how to size ...
diff --git a/doc/zstd_manual.html b/doc/zstd_manual.html index 83b75fd868d..1c298726ca1 100644 --- a/doc/zstd_manual.html +++ b/doc/zstd_manual.html @@ -703,40 +703,53 @@ <h3>Buffer-less streaming compression functions</h3><pre></pre><b><pre>size_t ZS A ZSTD_DCtx object can be re-used multiple times. First typi...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 108eeaf48b7..2bc5c9dfe61 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1384,6 +1384,16 @@ static int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, U32 const maxD } /* streaming decompression test */ + /* ensure memory requirem...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_836
facebook
zstd
809
closed
[cover] Fix divide by zero
Divide by zero occurred when the maximum dictionary size was less than 2048. Fixes #792.
{"label": "facebook:dev", "ref": "dev", "sha": "4912fc2acc3a957723dd5644a6c6075873a8c4f2"}
[ { "body": "Division by zero exception instead of ZSTD_error_dstSize_tooSmall in `COVER_buildDictionary` at https://github.com/facebook/zstd/blob/dev/lib/dictBuilder/cover.c#L611 in case of small maxdict param value provided\r\n```\r\nzstd --train sample.json --maxdict=1024\r\n```\r\nsample.json\r\n\r\n```\r\n['...
diff --git a/lib/dictBuilder/cover.c b/lib/dictBuilder/cover.c index 3d445ae8b81..cc4b1337609 100644 --- a/lib/dictBuilder/cover.c +++ b/lib/dictBuilder/cover.c @@ -479,11 +479,16 @@ static COVER_segment_t COVER_selectSegment(const COVER_ctx_t *ctx, U32 *freqs, * Check the validity of the parameters. * Returns non-...
diff --git a/tests/playTests.sh b/tests/playTests.sh index bc8584e7a9f..706cef2da69 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -291,8 +291,10 @@ $ECHO "- Create dictionary with wrong dictID parameter order (must fail)" $ZSTD --train *.c ../programs/*.c --dictID -o 1 tmpDict1 && die "wrong order : --di...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_809
facebook
zstd
637
closed
Zstdmt
fix #634
{"label": "facebook:dev", "ref": "dev", "sha": "e8e1e13d4fcd6495ba17fb0eafa414d5df7c00b6"}
[ { "body": "Upon upgrading to 1.1.4, python-zstandard's test suite raised a few failures related to the content size not being written into the frame header when using the multi-threaded compression APIs. You can see the test failures by following links to Travis or AppVeyor in indygreg/python-zstandard#17.\r\n\...
diff --git a/build/VS2008/fuzzer/fuzzer.vcproj b/build/VS2008/fuzzer/fuzzer.vcproj index 72540d2431c..f1719e8acfd 100644 --- a/build/VS2008/fuzzer/fuzzer.vcproj +++ b/build/VS2008/fuzzer/fuzzer.vcproj @@ -44,7 +44,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="$(Sol...
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 111ca82436c..fed87584348 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -28,6 +28,7 @@ #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressContinue, ZSTD_compressBlock */ #include "zstd.h" /* ZSTD_VERSION_STRING */ #include "zstd_errors.h" /* ZSTD_getEr...
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
null
null
null
{"testInvalid": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "testOrder": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 2, "failed_count": 0, "skipped_count": 0, "passed_tests": ["testInvalid", "testOrder"], "failed_tests": [], "skipped_tests": []}
facebook__zstd_637
jqlang
jq
3,238
closed
Non-matched optional capture group should be null and offset -1
Fixes #3093
{"label": "jqlang:master", "ref": "master", "sha": "31dac287cce2d15357c3b78a90009007e9c21493"}
[ { "body": "**Describe the bug**\r\nI've just upgraded from JQ version 1.6 to 1.7, and noticed that the `capture` function is returning an empty string instead of `null` for an optional named group that doesn't match, but only when no other part of the regex matches.\r\n\r\nFor example, if your regex contains `(...
diff --git a/src/builtin.c b/src/builtin.c index 717a07528a..d9553775a6 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1006,8 +1006,13 @@ static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) { jv captures = jv_array(); for (int i = 1; i < region->num_regs; ++i) { ...
diff --git a/tests/onig.test b/tests/onig.test index 5b6dab6a36..87aae375ea 100644 --- a/tests/onig.test +++ b/tests/onig.test @@ -1,7 +1,7 @@ # match builtin [match("( )*"; "g")] "abc" -[{"offset":0,"length":0,"string":"","captures":[{"offset":0,"string":"","length":0,"name":null}]},{"offset":1,"length":0,"string":...
{"tests/onigtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/onigtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 30, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8tes...
{"passed_count": 30, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_3238
jqlang
jq
3,165
closed
Implement `_experimental_snapshot/2`
Enables writing to files from within jq scripts. Resolves #3153 The scary name and lack of documentation should serve to inform users that its behavior is subject to breaking changes, and should therefore not be used in production scripts for the time being. At the moment, this builtin performs a dry run by de...
{"label": "jqlang:master", "ref": "master", "sha": "37f4cd2648faa2a4c78c3d4caf5d61cb491c7d22"}
[ { "body": "I would like to propose a new builtin, say `output_file(\"filename\"; \"contents\")`, which copies its input to its output while saving its arguments as a file. [It's similar in principle to the `debug` builtin.](https://jqlang.github.io/jq/manual/#debug)\r\n\r\nIf [`--sandbox`](https://github.com/jq...
diff --git a/src/builtin.c b/src/builtin.c index da4a770fac..29a6e4e21e 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1346,7 +1346,38 @@ static jv f_input(jq_state *jq, jv input) { return v; return jv_invalid_with_msg(jv_string("break")); } +static jv f_snapshot(jq_state *jq, jv input, jv filename, jv dat...
diff --git a/tests/shtest b/tests/shtest index 4aa27823ce..a325a5dde6 100755 --- a/tests/shtest +++ b/tests/shtest @@ -275,6 +275,28 @@ grep "Expected string key after '{', not '\\['" $d/err > /dev/null echo '{"x":"y",["a","b"]}' | $JQ --stream > /dev/null 2> $d/err || true grep "Expected string key after ',' in obje...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 30, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 30, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_3165
jqlang
jq
3,161
closed
feat: uri decode function
hi! i love this tool and have been using it for years, but recently noticed it doesn't have built in uri decoding. i didn't feel like writing a bash script or installing another program for something this trivial, plus i thought it'd be a nice addition to jq, so i thought i'd try adding it! I didn't add too many te...
{"label": "jqlang:master", "ref": "master", "sha": "0b5ae30f19d71ca6cc7b5867f3c988c570ecd579"}
[ { "body": "**Describe the bug**\r\nThe `@uri` string formatter percent-escapes it's input, but there is no filter to reverse the process.\r\n\r\n**To Reproduce**\r\n```\r\n$ echo '\"=\"' | jq -r '@uri'\r\n%3D\r\n```\r\nIt seems that perhaps `@text` would convert it back, but it passes the string unmodified:\r\n...
diff --git a/Makefile.am b/Makefile.am index 0b4b81e78e..a183477fde 100644 --- a/Makefile.am +++ b/Makefile.am @@ -141,7 +141,7 @@ endif ### Tests (make check) -TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base64test +TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base...
diff --git a/tests/jq.test b/tests/jq.test index d249bc1936..88cd5d8b9f 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -61,7 +61,7 @@ null null "interpolation" -@text,@json,([1,.]|@csv,@tsv),@html,@uri,@sh,(@base64|.,@base64d) +@text,@json,([1,.]|@csv,@tsv),@html,(@uri|.,@urid),@sh,(@base64|.,@base64d) "!()<>&'...
{"tests/uritest": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
{"tests/uritest": {"run": "NONE", "test": "NONE", "fix": "PASS"}}
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 30, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_3161
jqlang
jq
2,919
closed
Allow passing the inline jq script after --
jq previously only allowed passing the inline script before `--` (as if they were options) even though one would expect the inline script to be a positional argument. Since jq previously also refused to run with a usage error if the script was passed after `--` (It was not assuming `.` as script as it does when no a...
{"label": "jqlang:master", "ref": "master", "sha": "7f547827e47b5ade563a293329deb4226496d72f"}
[ { "body": "**Describe the bug**\r\n`jq` has the somewhat surprising behavior of recognizing additional options after a non-option argument has been encountered. While I won't suggest changing that behavior (due to compatibility concerns), it would be nice if `jq` at least recognized `--` as an indication to sto...
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml index 242cf510e4..842c937349 100644 --- a/docs/content/manual/manual.yml +++ b/docs/content/manual/manual.yml @@ -313,9 +313,8 @@ sections: * `--`: - Terminates argument processing. Remaining arguments are - positiona...
diff --git a/tests/shtest b/tests/shtest index 8a7ba07700..d854f3d90e 100755 --- a/tests/shtest +++ b/tests/shtest @@ -579,4 +579,14 @@ if ( ! $msys && ! $mingw ) && locale -a > /dev/null; then fi fi +# Allow passing the inline jq script before -- #2919 +if ! r=$($JQ --args -rn -- '$ARGS.positional[0]' bar) || [ ...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2919
jqlang
jq
2,840
closed
Fix negative index double wrapping and add a test (fix #2826)
I would like to fix #2826 by removing the code to make `path(last)` work. New feature should be added carefully not to change the behavior of this kind of core features. Currently, as mentioned in the manual clearly as `For arrays, negative indices and .[m:n] specifications should not be used.`, we disallow negative in...
{"label": "jqlang:master", "ref": "master", "sha": "4cf1408e0bbac8fc714b051fe420921905128efd"}
[ { "body": "**Describe the bug**\r\nNegative indices should wrap only once, not twice.\r\n\r\n**To Reproduce**\r\n`jq -n '[0,1,2] | .[-5]'` produces `1`.\r\n\r\n**Expected behavior**\r\nSince the array in the reproduction example has length 3, `.[-5]` can be `.[3-5]`, but still out of index so should produce `nu...
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml index 6382d8354a..e6edbc7ba0 100644 --- a/docs/content/manual/manual.yml +++ b/docs/content/manual/manual.yml @@ -1048,10 +1048,11 @@ sections: - title: "`pick(pathexps)`" body: | - Emit the projection of the input o...
diff --git a/tests/jq.test b/tests/jq.test index de38e4def6..1dcb2542c8 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -248,9 +248,9 @@ null 2 3 -.[-2] +[.[-4,-3,-2,-1,0,1,2,3]] [1,2,3] -2 +[null,1,2,3,1,2,3,null] [range(0;10)] null @@ -1052,9 +1052,9 @@ pick(first|first) [[10]] # negative indices in pa...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2840
jqlang
jq
2,839
closed
Fix crash on numeric comparison again (ref #2825)
The decNumber library subtracts the exponents of two numbers, we make sure to limit the number of digits not to make it overflows. Since the maximum adjusted exponent is `emax` and the minimum is `emin - digits + 1`, we follow `emax - (emin - digits + 1) <= INT32_MAX`. Resolves #2825.
{"label": "jqlang:master", "ref": "master", "sha": "f31c180e8f38c085c4366a91f9bfffc2dd7c2bc2"}
[ { "body": "OSS-fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61166\r\n(It results fixed because the reproducer is `3E506760210+63E-6855002263`, and now constant folding doesn't call `jv_cmp()` unnecessarily for number addition, but the problem still exists)\r\n\r\nEven with the fix from #28...
diff --git a/src/jv.c b/src/jv.c index ddc2948a79..b763272bcf 100644 --- a/src/jv.c +++ b/src/jv.c @@ -528,7 +528,7 @@ static decContext* tsd_dec_ctx_get(pthread_key_t *key) { if (key == &dec_ctx_key) { decContextDefault(ctx, DEC_INIT_BASE); - ctx->digits = DEC_MAX_DIGITS - 1; + ctx->digits =...
diff --git a/tests/jq.test b/tests/jq.test index eff15e0009..de38e4def6 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -556,8 +556,24 @@ null null 1e+17 -5E500000000>5E-5000000000 +9E999999999, 9999999999E999999990, 1E-999999999, 0.000000001E-999999990 null +9E+999999999 +9.999999999E+999999999 +1E-999999999 +1...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2839
jqlang
jq
2,824
closed
Change the default color of null to Bright Black
There have been multiple reports about the default color of `null` on dark background (#1252, #1972, #2113). Currently `null` is colored by `\e[1;30m`, which means bold (or increased intensity) black, and is totally invisible on some terminals (e.x. Terminal.app with Homebrew/Pro profile). I think we could improve the ...
{"label": "jqlang:master", "ref": "master", "sha": "f94a9d463ffb3422861a0da140470dbf5ce76632"}
[ { "body": "<!--\r\nREAD THIS FIRST!\r\n\r\nIf you have a usage question, please ask us on either Stack Overflow (https://stackoverflow.com/questions/tagged/jq) or in the #jq channel (http://irc.lc/freenode/%23jq/) on Freenode (https://webchat.freenode.net/).\r\n\r\n-->\r\n\r\n**Describe the bug**\r\n\r\n`null` ...
diff --git a/NEWS.md b/NEWS.md index b8e4c6828e..e2235dc735 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,8 +26,8 @@ Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.6...j - Make object key color configurable using `JQ_COLORS` environment variable. @itchyny @haguenau @ericpruitt #2703 ```sh ...
diff --git a/tests/shtest b/tests/shtest index ea6bc9001f..ee6cb36e34 100755 --- a/tests/shtest +++ b/tests/shtest @@ -417,7 +417,7 @@ unset JQ_COLORS ## Default colors, null input $JQ -Ccn . > $d/color -printf '\033[1;30mnull\033[0m\n' > $d/expect +printf '\033[0;90mnull\033[0m\n' > $d/expect cmp $d/color $d/expe...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2824
jqlang
jq
2,821
closed
Improve handling of non-integer numeric indices (fix #2815)
- require slice indices to be integers when writing - output `null` when using slices with non-integer numeric indices to read - require indices to be integers when writing
{"label": "jqlang:master", "ref": "master", "sha": "70807e2b1b3643019f3283b94d61998b9b35ee0e"}
[ { "body": "```\r\n$ jq -n '[1,2,3] | .[1.5]'\r\nnull\r\n$ jq -n '[1,2,3] | .[1.5] = 42'\r\n[1,42,3]\r\n```\r\n\r\n**Environment (please complete the following information):**\r\n\r\n- jq version: 1.7rc1\r\n", "number": 2815, "title": "Get/set inconsistency for fractional array indices" } ]
diff --git a/src/jv_aux.c b/src/jv_aux.c index 133fb54ccb..0b7d169df5 100644 --- a/src/jv_aux.c +++ b/src/jv_aux.c @@ -1,6 +1,8 @@ +#include <assert.h> +#include <limits.h> +#include <math.h> #include <string.h> #include <stdlib.h> -#include <assert.h> #include "jv_alloc.h" #include "jv_private.h" @@ -13,7 +15,7 ...
diff --git a/tests/jq.test b/tests/jq.test index e35722fd49..9d0b59285b 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -2024,3 +2024,61 @@ walk(1) walk(select(IN({}, []) | not)) {"a":1,"b":[]} {"a":1} + +# #2815 +[range(10)] | .[1.2:3.5] +null +[1,2,3] + +[range(10)] | .[1.5:3.5] +null +[1,2,3] + +[range(10)] | ....
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2821
jqlang
jq
2,728
closed
Respect NO_COLOR environment variable to disable color output
This PR implements `NO_COLOR` support. The `NO_COLOR` environment variable is recognized by various command line tools to disable their color output in terminal. See https://no-color.org for the list of commands and example implementation in C. When `--color-output` (`-C`) is used, the color output is enabled regardles...
{"label": "jqlang:master", "ref": "master", "sha": "0b558f6ed498717546406b5367483b976578a9b2"}
[ { "body": "It would be nice to control the coloring via an environment variable. My use case is that I have `jq` running inside [wasm-terminal](https://github.com/wasmerio/wasmer-js) and would like to suppress its ansi_coloring when wasm-terminal detects that jq's input is being piped to another program (WASI's...
diff --git a/src/main.c b/src/main.c index 97f3844401..3c5133d700 100644 --- a/src/main.c +++ b/src/main.c @@ -588,6 +588,11 @@ int main(int argc, char* argv[]) { dumpopts |= JV_PRINT_COLOR; } #endif + if (dumpopts & JV_PRINT_COLOR) { + char *no_color = getenv("NO_COLOR"); + if (no_color != ...
diff --git a/tests/shtest b/tests/shtest index 0a0ddcf7cc..d681ab45ad 100755 --- a/tests/shtest +++ b/tests/shtest @@ -414,4 +414,28 @@ JQ_COLORS="0123456789123:0123456789123:0123456789123:0123456789123:0123456789123 cmp $d/color $d/expect cmp $d/warning $d/expect_warning +# Check $NO_COLOR +if command -v script >/...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2728
jqlang
jq
2,674
closed
Fix nth/2 to emit empty on index out of range
This PR fixes `nth/2` to emit empty on index out of range. `nth(10; 1,2,3)` should not emit `3`. Fixes #1867.
{"label": "jqlang:master", "ref": "master", "sha": "cac3ea37262c3fdf77d6947b136873b12d3794ea"}
[ { "body": "`def nth(n; g): last(limit(n + 1; g));` does not match my intuition for what \"the nth output of g\" means when there are fewer than n+1 outputs of g.\r\n\r\n**Expected behavior**\r\n\r\n`nth($n; exp)` should probably be analogous to `[exp][$n]` (i.e. `([exp]|.[$n])`), except less expensive and witho...
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml index 1a82ec9626..58db48fde6 100644 --- a/docs/content/manual/manual.yml +++ b/docs/content/manual/manual.yml @@ -2832,10 +2832,8 @@ sections: The `first(expr)` and `last(expr)` functions extract the first and last values...
diff --git a/tests/jq.test b/tests/jq.test index 193025da6c..4e693452bd 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -319,9 +319,13 @@ null "badness" [1] -[first(range(.)), last(range(.)), nth(0; range(.)), nth(5; range(.)), try nth(-1; range(.)) catch .] +[first(range(.)), last(range(.))] 10 -[0,9,0,5,"nth d...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2674
jqlang
jq
2,658
closed
Validate JSON for --jsonarg
Fixes #2572
{"label": "jqlang:master", "ref": "master", "sha": "c077b95ba2dcaafee39e302cc086bf99fa9248d0"}
[ { "body": "Reproduction:\r\n```sh\r\n$ ./jq --version\r\njq-1.6-159-gcff5336\r\n\r\n$ ./jq -n --jsonargs '$ARGS' 123 'invalid json'\r\n{\r\n \"positional\": [\r\n 123,\r\nAssertion failed: (0 && \"Invalid value\"), function jv_dump_term, file jv_print.c, line 221.\r\n [1] 9056 abort ./jq -n --jso...
diff --git a/src/main.c b/src/main.c index 45f61d0bba..6d65911047 100644 --- a/src/main.c +++ b/src/main.c @@ -317,7 +317,12 @@ int main(int argc, char* argv[]) { if (further_args_are_strings) { ARGS = jv_array_append(ARGS, jv_string(argv[i])); } else if (further_args_are_json) { - ARGS = ...
diff --git a/tests/shtest b/tests/shtest index 4cffb1f821..84aa69e808 100755 --- a/tests/shtest +++ b/tests/shtest @@ -207,6 +207,19 @@ fi echo '{"a":1,"b",' | $JQ --stream > /dev/null 2> $d/err grep 'Objects must consist of key:value pairs' $d/err > /dev/null +## Regression test for issue #2572 assert when using ...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2658
jqlang
jq
2,654
closed
Fix exit code on JSON parse error
This PR fixes #2146. The exit code 4, which jq 1.6 emits on invalid input, is used to indicate no valid result for `--exit-status` option. It's better to be able to distinguish no valid result and JSON parse error. I think 5 is the only appropriate exit code considering the existing exit codes of jq.
{"label": "jqlang:master", "ref": "master", "sha": "c077b95ba2dcaafee39e302cc086bf99fa9248d0"}
[ { "body": "**Describe the bug**\r\nPrior to commit 6d3d2750, a syntax error in the JSON input would cause a nonzero return code. After this change, the error code is zero.\r\n\r\nIt is not clear to me from the description and linked issues #1139 and #1142 whether this is intentional or not, but in any case I fi...
diff --git a/src/main.c b/src/main.c index 45f61d0bba..ebe0e9d971 100644 --- a/src/main.c +++ b/src/main.c @@ -688,12 +688,12 @@ int main(int argc, char* argv[]) { // Parse error jv msg = jv_invalid_get_msg(value); if (!(options & SEQ)) { - // --seq -> errors are not fatal - ret = JQ_...
diff --git a/tests/shtest b/tests/shtest index 4cffb1f821..6594a906db 100755 --- a/tests/shtest +++ b/tests/shtest @@ -143,6 +143,15 @@ if $VALGRIND $Q $JQ -e . $d/input; then exit 2 fi +# Regression test for #2146 +if echo "foobar" | $JQ .; then + printf 'Issue #2146 is back?\n' 1>&2 + exit 1 +elif [ $? -ne 5 ...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/shtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2654
jqlang
jq
2,646
closed
implode: Better invalid input validation and handling
Error on non-number codepoint, asserted before Replace negative codepoint and surrogate range with unicode replacement character, asserted before Fixes #1160
{"label": "jqlang:master", "ref": "master", "sha": "a29ac81de117a6bad625bc4ff75bbb395a58f7d6"}
[ { "body": "Was experimenting with jq and came up accross this crash. I have no idea if `implode` is supposed to work like that, but I think the crash is worth fixing.\n\n**Reproduction steps**\n\n``` sh\n$ jq implode <<< '[{\"key\": \"x\",\"value\": 0}]'\n```\n\n**output**\n\n```\njq: jv.c:717: jv_string_implod...
diff --git a/src/builtin.c b/src/builtin.c index 3e99c37615..8e1de2b56f 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1201,7 +1201,28 @@ static jv f_string_implode(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_ARRAY) { return ret_error(a, jv_string("implode input must be an array")); } - return j...
diff --git a/tests/jq.test b/tests/jq.test index 466d185099..95b5136620 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1914,3 +1914,14 @@ any(keys[]|tostring?;true) {"a":"1","b":"2","c":"3"} true + +# explode/implode +# test replacement character (65533) for outside codepoint range and 0xd800 (55296) - 0xdfff (...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 28, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
{"passed_count": 29, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "tests/manonigtest", "test_regset", "testcu", "count", "syntax", "test_option...
jqlang__jq_2646
jqlang
jq
2,624
closed
revamp sub/3 to resolve most issues with gsub (and sub with "g")
The primary purpose of this commit is to rectify most problems with gsub (and also sub with "g"), and in particular #1425 (\b), #2354 (lookahead), and #2532 (regex == "^(?!cd ).*$|^cd "; "")) The revision also partly resolves #2148 and #1206 in that gsub no longer loops infinitely, but because the new gsub depends ...
{"label": "jqlang:master", "ref": "master", "sha": "9a590427db237d0aed5efe7eeaf13eb2bb3299d6"}
[ { "body": "**Describe the bug**\r\nWhen you pass the pattern `\"^\"` or `\"\"` to gsub, it loops forever and eventually runs out of memory.\r\n\r\n**To Reproduce**\r\n```\r\n$ echo '{\"key\": \"value\"}' | jq '.key|=gsub(\"^\";\"\")'\r\nerror: cannot allocate memory\r\nAborted (core dumped)\r\n$ echo '{\"key\":...
diff --git a/src/builtin.jq b/src/builtin.jq index a102fd51a0..4d54bc95b3 100644 --- a/src/builtin.jq +++ b/src/builtin.jq @@ -99,8 +99,10 @@ def scan(re): # # If input is an array, then emit a stream of successive subarrays of length n (or less), # and similarly for strings. -def _nwise(a; $n): if a|length <= $n th...
diff --git a/tests/onig.test b/tests/onig.test index daacae9cd7..aff4c6e605 100644 --- a/tests/onig.test +++ b/tests/onig.test @@ -75,6 +75,40 @@ gsub( "(.*)"; ""; "x") "" "" +gsub( ""; "a"; "g") +"" +"a" + +gsub( "^"; ""; "g") +"a" +"a" + + +# The following is a regression test and should not be construed as a ...
{"tests/onigtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/onigtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test", "simple", "tests/...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2624
jqlang
jq
2,157
closed
Fix uri format to follow RFC 3986
It seems that the current implementation is based on [RFC 2396 - 2.3. Unreserved Characters](https://tools.ietf.org/html/rfc2396#section-2.3). However, this RFC is obsoleted by [RFC 3986](https://tools.ietf.org/html/rfc3986). At [RFC 3986 - 2.3. Unreserved Characters](https://tools.ietf.org/html/rfc3986#section-2.3), t...
{"label": "jqlang:master", "ref": "master", "sha": "f88c4e5888d6d125695444d044df4bb55ad75888"}
[ { "body": "@uri documentation in manual:\r\n```Applies percent-encoding, by mapping all reserved URI characters to a %XX sequence.```\r\n\r\nHowever, it does not percent-encode certain reserved characters like `! ( ) *`.\r\n\r\n```\r\necho '\"!()*#$&+,/:;=?@[]\"' | jq -r '@uri' \r\n!()*%23%24%26%2B%2C%2F%3A%3B%...
diff --git a/src/builtin.c b/src/builtin.c index 9b2d9a23fc..79e96367fc 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -642,7 +642,7 @@ static jv f_format(jq_state *jq, jv input, jv fmt) { input = f_tostring(jq, input); int unreserved[128] = {0}; - const char* p = CHARS_ALPHANUM "-_.!~*'()"; + cons...
diff --git a/tests/jq.test b/tests/jq.test index ca8e27059f..b8364f2a77 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -61,17 +61,17 @@ null null "interpolation" -@text,@json,([1,.] | (@csv, @tsv)),@html,@uri,@sh,@base64,(@base64 | @base64d) -"<>&'\"\t" -"<>&'\"\t" -"\"<>&'\\\"\\t\"" -"1,\"<>&'\"\"\t\"" -"1\t<>&...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2157
jqlang
jq
2,133
closed
Fix deletion using assigning empty against arrays
This pull request fixes #2051, by delaying path deletions. Also fixes #2397, fixes #2422 and fixes #2440. ```sh % ./jq -c '(.[] | select(. >= 2)) |= empty' <<< '[1,5,3,0,7]' [1,0] % ./jq -c '.[] |= select(. >= 4)' <<< '[1,5,3,0,7]' [5,7] % ./jq -c '.[] |= select(. == 2)' <<< '[1,5,3,0,7]' [] ```
{"label": "jqlang:master", "ref": "master", "sha": "6944d81bc874da1ada15cbb340d020b32f9f90bd"}
[ { "body": "<!--\r\nREAD THIS FIRST!\r\n\r\nIf you have a usage question, please ask us on either Stack Overflow (https://stackoverflow.com/questions/tagged/jq) or in the #jq channel (https://web.libera.chat/#jq) on Libera.Chat (https://libera.chat/).\r\n\r\n-->\r\n\r\n**Describe the bug**\r\n\r\nIn `(.[].childr...
diff --git a/src/builtin.jq b/src/builtin.jq index c608555227..192a1e2ab3 100644 --- a/src/builtin.jq +++ b/src/builtin.jq @@ -12,24 +12,24 @@ def add: reduce .[] as $x (null; . + $x); def del(f): delpaths([path(f)]); def _assign(paths; $value): reduce path(paths) as $p (.; setpath($p; $value)); def _modify(paths; u...
diff --git a/tests/jq.test b/tests/jq.test index 8a7ccc0eeb..f2a0d352d5 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1048,6 +1048,19 @@ def inc(x): x |= .+1; inc(.[].a) {"a":[{"b":5}]} {"a":[{"c":3,"b":5}]} +# #2051, deletion using assigning empty against arrays +(.[] | select(. >= 2)) |= empty +[1,5,3,0,7] +...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"test_options": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "regset": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "callback_each_match": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "te...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 27, "failed_count": 1, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
{"passed_count": 28, "failed_count": 0, "skipped_count": 0, "passed_tests": ["regset", "callback_each_match", "names", "test_utf8", "testc", "test_syntax", "sql", "bug_fix", "scan", "tests/onigtest", "encode", "listcap", "tests/optionaltest", "test_regset", "testcu", "count", "syntax", "test_options", "tests/utf8test",...
jqlang__jq_2133
jqlang
jq
1,793
closed
Fix built-in function contains for strings
This is meant to fix #1732. In the existing code, the libc function underlying `contains` on strings was `strstr`, which only works properly on C strings (i.e., arrays of characters, where the first null is an end marker). This is not suitable for JSON strings, which can embed null bytes; for example `"xx\u0000yy"`...
{"label": "jqlang:master", "ref": "master", "sha": "4b4fefa254346524c787b862e35e4fbb70e01e95"}
[ { "body": "### Description\r\n\r\nThe `contains(needle)` filter does not match an input that contains\r\n`needle` only after a NUL character. In JSON (and Unicode), NUL is a\r\nnormal character, not an end-of-string marker.\r\n\r\n### To reproduce\r\n\r\njqplay link: <https://jqplay.org/s/ufUZAtLeHn>\r\n\r\nFil...
diff --git a/src/jv.c b/src/jv.c index 979d188e85..c5f26ace63 100644 --- a/src/jv.c +++ b/src/jv.c @@ -1342,7 +1342,12 @@ int jv_contains(jv a, jv b) { } else if (jv_get_kind(a) == JV_KIND_ARRAY) { r = jv_array_contains(jv_copy(a), jv_copy(b)); } else if (jv_get_kind(a) == JV_KIND_STRING) { - r = strstr(j...
diff --git a/tests/jq.test b/tests/jq.test index 7e2dd430a2..c1ed4719de 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1091,6 +1091,81 @@ null {} [true, true, false] +0 +0 +0 + +## The string containing a single null character +contains("") +"\u0000" +true + +contains("\u0000") +"\u0000" +true + +## A string co...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
{"tests/utf8test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "names": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "simple": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/base64test": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "tests/mantest": {"run": "PASS", "test": "PASS", "fix": "PASS"}, "test...
{"tests/jqtest": {"run": "PASS", "test": "FAIL", "fix": "PASS"}}
null
null
{"passed_count": 19, "failed_count": 0, "skipped_count": 0, "passed_tests": ["names", "testc", "bug_fix", "tests/onigtest", "encode", "listcap", "testp", "tests/optionaltest", "testcu", "syntax", "tests/utf8test", "simple", "tests/base64test", "tests/mantest", "tests/jqtest", "tests/shtest", "posix", "user_property", "...
{"passed_count": 18, "failed_count": 1, "skipped_count": 0, "passed_tests": ["tests/onigtest", "tests/shtest", "posix", "encode", "tests/utf8test", "names", "listcap", "simple", "testp", "user_property", "tests/optionaltest", "tests/base64test", "testcu", "testc", "tests/mantest", "syntax", "sql", "bug_fix"], "failed_t...
{"passed_count": 19, "failed_count": 0, "skipped_count": 0, "passed_tests": ["names", "testc", "bug_fix", "tests/onigtest", "encode", "listcap", "testp", "tests/optionaltest", "testcu", "syntax", "tests/utf8test", "simple", "tests/base64test", "tests/mantest", "tests/jqtest", "tests/shtest", "posix", "user_property", "...
jqlang__jq_1793