]>
granicus.if.org Git - jq/log
Mike Fletcher [Thu, 9 Jul 2015 18:59:37 +0000 (14:59 -0400)]
Fixing missing D in LIBM_DDD_NO macro name
David Tolnay [Sat, 4 Jul 2015 21:56:07 +0000 (14:56 -0700)]
Make jq.h usable from C++
Previously, with clang++:
jq.h:46:37: error: typedef redefinition with different
types ('struct jq_util_input_state *' vs 'jq_util_input_state')
With g++:
jq.h:46:37: error: conflicting declaration
‘typedef struct jq_util_input_state* jq_util_input_state’
This typedef was added to libjq by commit
0d41447 which was
after the 1.4 release, so although it is a public API, this
is not a backcompat break because it has never been in a
release.
Specifying the "*" at all uses of jq_util_input_state is
slightly tedious, but jq_state already works that way, so at
least it will be consistent.
Nicolas Williams [Sat, 4 Jul 2015 18:45:24 +0000 (13:45 -0500)]
Fix Windows build
Nicolas Williams [Sat, 4 Jul 2015 02:19:01 +0000 (21:19 -0500)]
Document math support
Nicolas Williams [Sat, 4 Jul 2015 02:13:13 +0000 (21:13 -0500)]
Remove `pow10` for now; CHECK_MATH_FUNC needs work
The CHECK_MATH_FUNC() m4 macro needs work. It should use
AC_RUN_IFELSE(), not just AC_LINK_IFELSE(), and it should #define
_GNU_SOURCE and/or other such feature macros in the prologue to get
non-standard math functions (alternatvely jq should only support
standard math functions).
David Tolnay [Fri, 3 Jul 2015 06:46:31 +0000 (23:46 -0700)]
docs and diagram for exec_stack
David Tolnay [Tue, 30 Jun 2015 15:24:26 +0000 (08:24 -0700)]
strftime wrong day-of-week (fix #838)
Nicolas Williams [Sun, 28 Jun 2015 18:57:02 +0000 (13:57 -0500)]
Document --run-tests
Nicolas Williams [Sun, 28 Jun 2015 18:39:32 +0000 (13:39 -0500)]
Make --run-tests' jv_test() quiet
Nicolas Williams [Sun, 28 Jun 2015 04:31:44 +0000 (23:31 -0500)]
Make --run-tests less verbose by default
Adding --debug-trace or --debug-dump-disasm before --run-tests now makes
it verbose.
Nicolas Williams [Sun, 28 Jun 2015 04:15:16 +0000 (23:15 -0500)]
Add more basic number tests
Nicolas Williams [Sun, 28 Jun 2015 04:14:46 +0000 (23:14 -0500)]
Add `pow`, better libm detection (fix #443)
David Tolnay [Sat, 27 Jun 2015 20:48:54 +0000 (13:48 -0700)]
gcov exclusions
David Tolnay [Sat, 27 Jun 2015 17:16:13 +0000 (10:16 -0700)]
flag to enable gcov and coveralls
David Tolnay [Sat, 27 Jun 2015 16:52:12 +0000 (09:52 -0700)]
add configure option to run tests without valgrind
Nicolas Williams [Sat, 27 Jun 2015 18:00:41 +0000 (13:00 -0500)]
Fix braino in merging the previous commit
There's a mantest that shows how to use `env`. Well, we need to set the
env var as expected then, else it will fail.
David Tolnay [Sun, 21 Jun 2015 05:44:09 +0000 (22:44 -0700)]
get Travis CI working
Nicolas Williams [Sat, 27 Jun 2015 04:40:37 +0000 (23:40 -0500)]
Restore import into caller's namespace
Nicolas Williams [Sat, 27 Jun 2015 04:38:24 +0000 (23:38 -0500)]
Slight re-phrasing of module docs
Nicolas Williams [Sat, 27 Jun 2015 04:36:34 +0000 (23:36 -0500)]
Use set -u in tests/setup
Nicolas Williams [Sat, 27 Jun 2015 02:24:01 +0000 (21:24 -0500)]
Fix #830
Nicolas Williams [Sat, 27 Jun 2015 02:19:29 +0000 (21:19 -0500)]
Update Adavanced section of manual
Nicolas Williams [Sat, 27 Jun 2015 02:18:58 +0000 (21:18 -0500)]
Document `{$var}`
Nicolas Williams [Sat, 27 Jun 2015 01:29:04 +0000 (20:29 -0500)]
Add `{$var}` `. as {$var}` syntax (fix #831)
Nicolas Williams [Sat, 27 Jun 2015 01:16:23 +0000 (20:16 -0500)]
Add streaming utilities (fix #827)
Nicolas Williams [Sat, 27 Jun 2015 01:15:04 +0000 (20:15 -0500)]
Alternative implementation of tovalues
Santiago Lapresta [Thu, 4 Jun 2015 16:30:38 +0000 (18:30 +0200)]
Add combinations/0 and combinations/1
Nicolas Williams [Mon, 22 Jun 2015 23:15:51 +0000 (18:15 -0500)]
WriteFile() on WIN32 when stdout isatty (fix #824)
Use WriteFile() and bypass stdio IFF stdout isatty and we're on Windows.
Nicolas Williams [Mon, 22 Jun 2015 23:32:28 +0000 (18:32 -0500)]
Fix test failure introduced by previous commit
David Tolnay [Fri, 19 Jun 2015 17:33:35 +0000 (10:33 -0700)]
fix errors flagged by clang static analyzer
builtin.c: bug - free of uninitialized jv
compile.c: missing assertion
jq_test.c: buggy logic / unreachable code
jv.c: missing assertion
jv_alloc.c: false positive - intentional read of uninitialized memory
jv_file.c: dead code
Nicolas Williams [Fri, 19 Jun 2015 22:10:45 +0000 (17:10 -0500)]
Fix #811: use CommandLineToArgvW() and _wfopen()
David Tolnay [Fri, 19 Jun 2015 05:15:41 +0000 (22:15 -0700)]
fix use after free in f_strptime
David Tolnay [Fri, 19 Jun 2015 02:38:25 +0000 (19:38 -0700)]
separate jq, oniguruma, sh, and man tests
Nicolas Williams [Fri, 19 Jun 2015 02:24:41 +0000 (21:24 -0500)]
argv[] may not be UTF-8 (fix #811)
Doug Luce [Thu, 18 Jun 2015 18:07:16 +0000 (11:07 -0700)]
Add alloca() discovery to configure.ac
The build failed on FreeBSD as there is no alloca.h. This patch is
lifted from the autoconf documentation.
Nicolas Williams [Thu, 18 Jun 2015 15:14:52 +0000 (10:14 -0500)]
Fix `finites`
David Tolnay [Thu, 18 Jun 2015 04:49:56 +0000 (21:49 -0700)]
fix broken tests in manual.yml
Nicolas Williams [Thu, 18 Jun 2015 05:03:46 +0000 (00:03 -0500)]
Fix #802
Nicolas Williams [Thu, 18 Jun 2015 04:14:26 +0000 (23:14 -0500)]
Add isnormal and related, rename *inf
Nicolas Williams [Thu, 18 Jun 2015 00:46:57 +0000 (19:46 -0500)]
Fix #814: raise on div-0, add inf isinf nan isnan
Nicolas Williams [Thu, 18 Jun 2015 00:46:15 +0000 (19:46 -0500)]
Fix infinite loop on error in sequence parser
Nicolas Williams [Wed, 17 Jun 2015 16:24:34 +0000 (11:24 -0500)]
Sequence parser: wait for RS on startup (fix #687)
Per-RFC7464.
Nicolas Williams [Wed, 17 Jun 2015 16:23:58 +0000 (11:23 -0500)]
Fix infinite loop on EOF bug
Aaron Peschel [Tue, 9 Jun 2015 23:45:06 +0000 (16:45 -0700)]
Add Missing Makefile Dependency
main.c requires version.h, but there is no logic marking this dependency
in the Makefile. This commit adds the dependency to the Makefile
template.
Nicolas Williams [Tue, 9 Jun 2015 22:29:37 +0000 (17:29 -0500)]
Clarify array destructuring docs
David Tolnay [Mon, 8 Jun 2015 04:45:14 +0000 (21:45 -0700)]
array and object destructuring (fix #533)
`. as [$i, $j, $k] | ...`
`. as {a: $i, b: $j} | ...`
`. as [[[$i]], {a: $j}] | ...`
`foreach . as [$i, $j, $k] (...)`
`reduce . as {a: $i, b: $j} (...)`
cdnbacon [Tue, 2 Jun 2015 19:00:14 +0000 (15:00 -0400)]
Remove extension from links
The downloads are available without an extension.
Nicolas Williams [Thu, 4 Jun 2015 01:20:11 +0000 (20:20 -0500)]
Add --tab and -indent n options
Nicolas Williams [Fri, 29 May 2015 20:35:30 +0000 (15:35 -0500)]
Improve usage message
Nicolas Williams [Fri, 29 May 2015 20:25:30 +0000 (15:25 -0500)]
Fixup --slurpfile/argile docs
Nicolas Williams [Fri, 29 May 2015 19:19:23 +0000 (14:19 -0500)]
Add --slurpfile
Nicolas Williams [Fri, 29 May 2015 16:50:08 +0000 (11:50 -0500)]
Better handling of stdout errors
Nicolas Williams [Fri, 29 May 2015 16:49:45 +0000 (11:49 -0500)]
Fix --argfile memleak (fix #799 part 2)
Nicolas Williams [Fri, 29 May 2015 16:48:10 +0000 (11:48 -0500)]
Fix jv_load_file() (partial fix #799)
Nicolas Williams [Fri, 29 May 2015 15:38:08 +0000 (10:38 -0500)]
Revert "Fix #705 (--argfile weirdness)"
This reverts commit
3d2ab93b116f966b071e835a6656452cafc61aef .
Nicolas Williams [Fri, 29 May 2015 15:37:58 +0000 (10:37 -0500)]
Revert "Better argfile fix (#705, fix #736)"
This reverts commit
4f8567476d3a6e8b5b422d05190f777221b984fb .
Nicolas Williams [Tue, 26 May 2015 02:12:29 +0000 (21:12 -0500)]
Add jv_mem_strdup*() and callocs too
Nicolas Williams [Tue, 26 May 2015 02:19:56 +0000 (21:19 -0500)]
Add ./configure --enable-all-static instead
Nicolas Williams [Mon, 25 May 2015 19:14:53 +0000 (14:14 -0500)]
Always add -all-static when --enable-static
Nicolas Williams [Mon, 25 May 2015 18:17:22 +0000 (13:17 -0500)]
Update parser.c
Nicolas Williams [Mon, 25 May 2015 18:16:45 +0000 (13:16 -0500)]
Keywords should be OK as object keys (fix #794)
With this change it's now OK to use keywords as object keys like so:
{if:0}
Nicolas Williams [Mon, 25 May 2015 07:06:44 +0000 (02:06 -0500)]
Fix Windows build: util.c
Steven Penny [Sun, 24 May 2015 14:42:13 +0000 (09:42 -0500)]
Fix #793
Travis Gockel [Thu, 5 Mar 2015 04:09:00 +0000 (21:09 -0700)]
Add wrapping and clamping to jv_array_slice
Fix #716. Fix #717.
Assaf Gordon [Fri, 17 Apr 2015 22:18:33 +0000 (18:18 -0400)]
Print offending object in runtime error messages
When reporting an error to the user, add information about the offending
object/value (possibly truncated).
The goal is to give a user some context regarding which input object
caused the runtime error.
Examples:
$ echo '"hello"' | ./jq '-.'
jq: error: string ("hello") cannot be negated
$ echo '"very-long-string"' | ./jq '-.'
jq: error: string ("very-long-...) cannot be negated
$ echo '["1",2]' | ./jq '.|join(",")'
jq: error: string (",") and number (2) cannot be added
$ echo '["1","2",{"a":{"b":{"c":33}}}]' | ./jq '.|join(",")'
jq: error: string (",") and object ({"a":{"b":{...) cannot be added
$ echo '{"a":{"b":{"c":33}}}' | ./jq '.a | @tsv'
jq: error: object ({"b":{"c":33}}) cannot be tsv-formatted, only array
(Fix #754)
Nicolas Williams [Thu, 21 May 2015 23:20:05 +0000 (18:20 -0500)]
Fix error message for @tsv
Nicolas Williams [Thu, 21 May 2015 22:47:01 +0000 (17:47 -0500)]
Don't test input_filename/line_number yet
Assaf Gordon [Fri, 17 Apr 2015 20:08:10 +0000 (16:08 -0400)]
Add filename/line functions to jq (fix #753)
This adds `input_filename` and `input_line_number` built-in functions
for use in, for example, `error` messages.
Example:
$ printf '{"a":1}\n{"a":2}\n' > 4.json
$ printf '{"a":"hello"}\n' > 5.json
$ ./jq '{ "file":input_filename, "line":input_line_number, "value":.a }' 4.json 5.json
{
"file": "4.json",
"line": 1,
"value": 1
}
{
"file": "4.json",
"line": 2,
"value": 2
}
{
"file": "5.json",
"line": 1,
"value": "hello"
}
Nicolas Williams [Thu, 21 May 2015 05:11:11 +0000 (00:11 -0500)]
Fix formatting error in manual.yml
Assaf Gordon [Fri, 17 Apr 2015 19:28:00 +0000 (15:28 -0400)]
Report filename:line on runtime errors (fix #752)
With this patch, jq run-time errors printed to stderr will contain the
filename and line of the offending input.
But note that the JSON text parser does (yet) print the input filename
on parse error. A jq run-time error is a jq program error, not
including syntax errors nor JSON text input format errors.
Examples:
With stdin and multiple lines:
$ printf '{"a":43}\n{"a":{"b":66}}\n' | ./jq '.a+1'
44
jq: error (at stdin:2): object and number cannot be added
With multiple files:
$ printf '{"a":43}' > 1.json
$ printf '{"a":"hello"}\n' > 2.json
$ printf '{"a":{"b":66}}\n' > 3.json
$ ./jq '[.a]|@tsv' 1.json 2.json 3.json
"43"
"hello"
jq: error (at 3.json:1): object is not valid in a csv row
With very long lines (spanning multiple `fgets` calls):
$ ( printf '{"a":43}\n' ;
printf '{"a":{"b":[' ; seq 10000 | paste -d, -s | tr -d '\n' ;
printf ']}}\n' ;
printf '{"a":"hello"}\n' ) | ./jq '[.a] | @tsv'
"43"
jq: error (at stdin:2): object is not valid in a csv row
"hello"
With raw input:
$ seq 1000 | ./jq --raw-input 'select(.=="700") | . + 10'
jq: error (at stdin:700): string and number cannot be added
Caveat:
The reported line will be the last line of the (valid) parsed JSON data.
Example:
$ printf '{\n"a":\n"hello"\n\n\n}\n' | ./jq '.a+4'
jq: error (at stdin:6): string and number cannot be added
Nicolas Williams [Wed, 20 May 2015 15:21:30 +0000 (10:21 -0500)]
Fix spelling
Nicolas Williams [Tue, 19 May 2015 06:19:51 +0000 (01:19 -0500)]
Document gsub/3
Nicolas Williams [Tue, 19 May 2015 04:02:11 +0000 (23:02 -0500)]
Fix gsub, add gsub/3 (fix #782)
Nicolas Williams [Mon, 18 May 2015 17:07:29 +0000 (12:07 -0500)]
Add -all-static when --enable-static
Nicolas Williams [Tue, 12 May 2015 02:29:50 +0000 (21:29 -0500)]
Fix --stream assertion
Nicolas Williams [Mon, 4 May 2015 00:23:37 +0000 (19:23 -0500)]
Add error injection library
Nicolas Williams [Tue, 28 Apr 2015 22:27:12 +0000 (17:27 -0500)]
Report read errors too (and fix #772)
Nicolas Williams [Sat, 2 May 2015 22:36:33 +0000 (17:36 -0500)]
Fix README
Nicolas Williams [Sat, 2 May 2015 22:34:52 +0000 (17:34 -0500)]
README: send questions to SO and Freenode
Nicolas Williams [Tue, 28 Apr 2015 15:39:34 +0000 (10:39 -0500)]
usage() should check fprintf() result (fix #771)
Nicolas Williams [Tue, 28 Apr 2015 15:37:37 +0000 (10:37 -0500)]
Use jv_mem_alloc() in compile.c (fix #771)
Nicolas Williams [Tue, 28 Apr 2015 15:36:21 +0000 (10:36 -0500)]
Fix header guards (fix #770)
Nicolas Williams [Fri, 24 Apr 2015 15:42:19 +0000 (10:42 -0500)]
--raw-input wrongly adds NULs (fix #761)
Nicolas Williams [Fri, 24 Apr 2015 04:37:11 +0000 (23:37 -0500)]
With `inputs` builtin, -n and -R can now coexist
Nicolas Williams [Thu, 23 Apr 2015 23:27:53 +0000 (18:27 -0500)]
--raw-input ought to read NULs (partial fix #760)
We can't know how many bytes fgets() read when we reach EOF and fgets()
didn't see a newline; we can only assume that at least strlen(buf) bytes
were read. This is quite obnoxious if one wants to use NULs in raw
input, but at least we can make reading "a\0b\0c\0" with no newline
yield "a\0b\0c", losing only the final sequence of NULs.
We can't use getline() either, since it will want to allocate a buffer
big enough for an entire line, and we might not have any newlines in our
input. A complete fix will have to use getc() or read(), preferably the
latter.
Nicolas Williams [Thu, 23 Apr 2015 23:26:57 +0000 (18:26 -0500)]
--slurp --raw-input is broken (fix #761)
Nicolas Williams [Thu, 23 Apr 2015 23:25:32 +0000 (18:25 -0500)]
from_entries is broken (fix #767)
Assaf Gordon [Wed, 22 Apr 2015 21:34:49 +0000 (17:34 -0400)]
regex functions: report informative error if not available.
When trying to use the new regex functions (match/test/sub/capture/etc)
in a JQ that was compiled without the ONIGURAMA regex library,
report an informative error message instead of a 'not defined' error.
Before:
$ echo '"foo"' | ./jq-old 'test("foo")'
jq: error: test/1 is not defined at <top-level>, line 1:
test("foo")
jq: 1 compile error
After:
$ echo '"foo"' | ./jq 'test("foo")'
jq: error: jq was compiled without ONIGURAMA regex libary. match/test/sub and related functions are not available.
Andrew O'Brien [Tue, 21 Apr 2015 12:00:28 +0000 (08:00 -0400)]
Fixes manual generation with psych
When running `make` I ran into a couple of problems building the manual. While
I'm not entirely sure that this is the root cause, it appears to have been
related to the fact that ruby 2.0 dropped syck completely in favor of psych
(which was introduced in 1.9.2) for YAML processing. I'm currently using ruby
2.1.0p0.
I'm assuming that the fact that the YAML engine was explicitly set to syck in
the Rakefile was an attempt to work around some incompatibility between the two
libraries, so I looked into what would be necessary to get it to work with the
newer one. The changes to `manual.yml` ended up being pretty minor: I ran it
through `iconv` to convert some ISO-8859-1 characters to UTF-8 and added some
quotes in places (apparently you can't start a string value with '`').
Assaf Gordon [Mon, 20 Apr 2015 20:51:48 +0000 (16:51 -0400)]
Handle NUL in escaped-string output
When escaping string (e.g. for `@tsv` or `@csv` outputs),
escape NULs as '\0'.
Existing behaviour, unchanged by this patch:
$ echo '"a\u0000b"' | ./jq '.'
"a\u0000b"
$ echo '"a\u0000b"' | ./jq -r '.' | od -a
0000000 a nul b nl
0000004
When using `@tsv`, escape NUL to `\0`:
$ echo '"a\u0000b"' | ./jq -r '[.]|@tsv'
a\0b
$ echo '"a\u0000b"' | ./jq '[.]|@tsv'
"a\\0b"
tal@whatexit.org [Fri, 3 Apr 2015 13:53:51 +0000 (13:53 +0000)]
manual.yml: Clarify how to specify keys with ":" and special chars.
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
Assaf Gordon [Thu, 16 Apr 2015 03:24:24 +0000 (23:24 -0400)]
docs: expand @tsv section - add escape sequences.
Assaf Gordon [Wed, 15 Apr 2015 19:55:27 +0000 (15:55 -0400)]
@tsv: escape \r, \n, \\
When using '@tsv' output format with '-r' option,
escape \r, \n and \\ in addition to \t.
Example:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' | jq .
{
"id": "hello\ttab\nworld",
"x": 43
}
Before: newlines are not escaped, generating invalid TSV output:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' \
| ./jq-old -r '[.id,.x] | @tsv'
hello\ttab
world 43
After: newlines are properly escaped:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' \
| ./jq-new -r '[.id, .x] | @tsv'
hello\ttab\nworld 43
Before: backslashes themselves are not escaped, so there's no way to
distinguish between escaped characters and 'real' backslashes
(in the example below, there is should not be newline, despite the
output containing "\n".
$ printf '{"x":"hello\\ttab\\\\new world"}' \
| ./jq-old -r '[.x]|@tsv'
hello\ttab\new world
After: backslashes are escaped:
$ printf '{"x":"hello\\ttab\\\\new world"}' \
| ./jq-new -r '[.x]|@tsv'
hello\ttab\\new world
Nicolas Williams [Tue, 31 Mar 2015 15:03:35 +0000 (10:03 -0500)]
Test fix for mktime
Nicolas Williams [Mon, 30 Mar 2015 20:55:54 +0000 (15:55 -0500)]
Add `$__loc__` (fix #740)
Nicolas Williams [Mon, 30 Mar 2015 00:12:23 +0000 (19:12 -0500)]
Include filename and lineno in error messages
Nicolas Williams [Tue, 24 Mar 2015 20:05:06 +0000 (15:05 -0500)]
Tweak fix for #719
Assaf Gordon [Fri, 6 Mar 2015 18:54:53 +0000 (13:54 -0500)]
detect and report output writing errors
Detect output errors when the program exits.
Currently:
$ echo '{}' | jq . > /dev/full && echo ok
ok
with the patch:
$ echo '{}' | jq . > /dev/full && echo ok
Error: writing output failed: No space left on device
also apply to hardware/network/other I/O errors.
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
Santiago Lapresta [Wed, 18 Mar 2015 00:12:08 +0000 (01:12 +0100)]
Adds Dockerfile
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
Assaf Gordon [Tue, 10 Mar 2015 21:02:02 +0000 (17:02 -0400)]
partial handling of input errors
Signed-off-by: Nicolas Williams <nico@cryptonector.com>