]> granicus.if.org Git - jq/log
jq
6 years agoadd automake as build dependency to README.md 1768/head
Haochen Xie [Mon, 12 Nov 2018 21:00:53 +0000 (16:00 -0500)]
add automake as build dependency to README.md

6 years agoMinor website fixes for 1.6
William Langford [Fri, 2 Nov 2018 12:15:18 +0000 (08:15 -0400)]
Minor website fixes for 1.6

6 years agoRelease jq-1.6 jq-1.6
William Langford [Fri, 2 Nov 2018 01:49:29 +0000 (21:49 -0400)]
Release jq-1.6

6 years agoUpdate website with details for jq-1.6
William Langford [Sun, 28 Oct 2018 23:18:48 +0000 (19:18 -0400)]
Update website with details for jq-1.6

6 years agoFix website whitespace
William Langford [Mon, 22 Oct 2018 03:11:37 +0000 (23:11 -0400)]
Fix website whitespace

6 years agoAdd documentation for destructuring alternation
William Langford [Mon, 22 Oct 2018 02:58:28 +0000 (22:58 -0400)]
Add documentation for destructuring alternation

6 years agoBugfix: Math function checking
Alex Ozdemir [Thu, 2 Aug 2018 07:25:07 +0000 (00:25 -0700)]
Bugfix: Math function checking

We had config machinery that determined which math functions are
available in libc. If a c math function was missing on the host system,
then the corresponding jq function would be removed from the source,
enabling the build to proceed anyway. The detection machinery was broken
in a subtle way, as was shown after glibc updated to 2.27, dropping the
`pow10` function. This caused compilation to fail.

The essential problem was that we detected whether a math function was
available by compiling and linking a small program evaluating that
function on constants. However, since gcc's optimization machinery has
special knowledge of some math functions (e.g. `pow10`), it can
optimize them away, even if they don't exist in the library and are not
linkable. That is, the following example compiles and links against
glibc 2.27, even though `pow10` has been removed:
```
int main () {
  printf("%f", pow10(0.5));
  return 0;
}
```

What?!
On the other hand, this program does not link:
```

int main () {
  double f;
  printf("%f", &f);
  printf("%f", pow10(f));
  return 0;
}
```

In the first program the call to `pow10` can be optimized away as a
constant expression. This requires GCC to know about `pow10` (which it
does!), but it does not require `pow10` to be in the library (and
actually linkable).

The solution is to use autoconf's machinery for detecting function
presence, instead of our own (buggy) machinery. This has the added
benefit of simplifying the code.

The bug was reported in issue #1659

6 years agoFix osx travis build
William Langford [Fri, 31 Aug 2018 02:03:32 +0000 (22:03 -0400)]
Fix osx travis build

6 years agofix memory leak
William Langford [Fri, 31 Aug 2018 01:09:04 +0000 (21:09 -0400)]
fix memory leak

6 years agoRestore JV_PRINT_COLOUR as an alias 1.6rc2
William Langford [Sat, 18 Aug 2018 03:23:10 +0000 (23:23 -0400)]
Restore JV_PRINT_COLOUR as an alias

JV_PRINT_COLOUR was part of the public libjq headers and was removed as
part of 2d05b54. While JV_PRINT_COLOR is definitely the preferred
spelling this side of the pond, we shouldn't just remove otherwise
exposed enum values.

6 years agoFix destructuring alternation fix-destructuring-alternation
William Langford [Sat, 18 Aug 2018 02:47:13 +0000 (22:47 -0400)]
Fix destructuring alternation

Attempting to use the existing FORK_OPT opcode resulted in difficulty
knowing when to pop an error message off the stack and when not to. This
commit makes DESTRUCTURE_ALT a real opcode that is identical to
FORK_OPT, except for never pushing the error message onto the stack when
continuing from an error backtrack.

Some small changes were necessary to the DUP/POP behavior surrounding
destructuring to accomodate this.

6 years agoCreate issue template
William Langford [Fri, 17 Aug 2018 13:15:08 +0000 (09:15 -0400)]
Create issue template

6 years agojv_file.c: check to see if the file is a directory and fail
Roland C. Dowdeswell [Wed, 9 May 2018 04:39:11 +0000 (00:39 -0400)]
jv_file.c: check to see if the file is a directory and fail

Not all stdio implementations disallow one to open a directory with
fopen(3) and so we specifically check for directories as it is also
in the standard search path.

6 years agoMake limit/2 more efficient
Nicolas Williams [Tue, 6 Mar 2018 19:55:16 +0000 (13:55 -0600)]
Make limit/2 more efficient

Contributed by @pkoppstein.

6 years agolimit/2 evals exp one time too many
Nicolas Williams [Tue, 6 Mar 2018 17:28:38 +0000 (11:28 -0600)]
limit/2 evals exp one time too many

6 years agosrc/main.c: fix issue #1587 by using jv_dumpf in the raw-output and ascii-output...
rain1 [Thu, 1 Mar 2018 19:16:11 +0000 (19:16 +0000)]
src/main.c: fix issue #1587 by using jv_dumpf in the raw-output and ascii-output case. retain fwrite in the raw-output case.

6 years agoFix "provides" typo
Riley Avron [Fri, 23 Feb 2018 19:31:14 +0000 (11:31 -0800)]
Fix "provides" typo

6 years agoChange backticks to the more legible $()
David Fetter [Sat, 28 Oct 2017 14:51:59 +0000 (10:51 -0400)]
Change backticks to the more legible $()

6 years agoBuild static binaries and deploy to GH Releases from Travis
Jakub Jirutka [Thu, 8 Feb 2018 23:44:13 +0000 (00:44 +0100)]
Build static binaries and deploy to GH Releases from Travis

6 years agoBuild and run tests against musl libc using Alpine Linux on Travis
Jakub Jirutka [Thu, 8 Feb 2018 23:26:55 +0000 (00:26 +0100)]
Build and run tests against musl libc using Alpine Linux on Travis

6 years agoChange Travis config to utilize Build Stages
Jakub Jirutka [Thu, 8 Feb 2018 23:03:44 +0000 (00:03 +0100)]
Change Travis config to utilize Build Stages

See: https://docs.travis-ci.com/user/build-stages/

7 years agofix FreeBSD install instructions
Paul Chvostek [Thu, 4 Jan 2018 19:35:46 +0000 (14:35 -0500)]
fix FreeBSD install instructions

7 years agoUpdated the compile-ios.sh script to fix issues with local oniguruma path.
Larry Aasen [Wed, 13 Dec 2017 00:12:54 +0000 (19:12 -0500)]
Updated the compile-ios.sh script to fix issues with local oniguruma path.

7 years agoUpdate AUTHORS jq-1.6rc1
Nicolas Williams [Mon, 11 Dec 2017 18:22:02 +0000 (12:22 -0600)]
Update AUTHORS

7 years agoAdded rawfile
David Fetter [Fri, 27 Oct 2017 22:46:57 +0000 (18:46 -0400)]
Added rawfile

In passing, clean remnants of argfile from slurpfile docs.

7 years agoRevert "reduce: handle empty updates (fix #1313)"
Nicolas Williams [Mon, 11 Dec 2017 17:20:16 +0000 (11:20 -0600)]
Revert "reduce: handle empty updates (fix #1313)"

This reverts commit e24af3c78e78a3aab05a2800d825d56f1d842b1b.

While the semantics are desirable, there is no way to implement them
efficiently.  The reason is that in order to handle backtracking (empty)
from the state update expression, we have to retain a reference to the
reduction state value in order to restore it upon backtracking.
Retaining a reference to the reduction state kills performance by
causing lots of additional memory allocations and garbage because the
input to the update expression will always have at least two references,
thus no changes to it can be done in-place, and all changes end up being
CoW changes.

Avoiding this is the very reason for the LOADVN instruction (leaving
`null` in the variable loaded from).

7 years agoFix import as $data linking
Nicolas Williams [Wed, 8 Nov 2017 05:09:20 +0000 (23:09 -0600)]
Fix import as $data linking

7 years agoFix hang for slurped inputs with trailing newline
William Langford [Tue, 5 Dec 2017 01:10:56 +0000 (20:10 -0500)]
Fix hang for slurped inputs with trailing newline

7 years agoFix #1534
William Langford [Tue, 5 Dec 2017 00:20:58 +0000 (19:20 -0500)]
Fix #1534

7 years agoActually fix the strptime tests macos-strptime
William Langford [Thu, 30 Nov 2017 01:40:36 +0000 (20:40 -0500)]
Actually fix the strptime tests

This has been a complicated issue to fix for a number of reasons.
The core of it is that the behavior is different between different
versions of macOS, some of which set possible-but-incorrect values.

This commit addresses the issue by always using our computation for
tm_wday and tm_yday on macOS. As a side-effect, strptime format
strings that specify %u and %j will no longer work on macOS.

7 years agoKeep object keys in parsing order in `tostream` output
Eric Bréchemier [Wed, 29 Nov 2017 17:26:56 +0000 (18:26 +0100)]
Keep object keys in parsing order in `tostream` output

As noted by @nicowilliams, `tostream` used `keys`,
which sorts the keys in alphabetical order, instead
of `keys_unsorted`, which preserves the parsing order.

Fixes #1541.

7 years agoUse rvm to install ruby 1.9.3
Andrew Speed [Tue, 31 Oct 2017 21:23:01 +0000 (21:23 +0000)]
Use rvm to install ruby 1.9.3

7 years agoFix strptime tests on macOS 10.12
William Langford [Tue, 28 Nov 2017 03:57:50 +0000 (22:57 -0500)]
Fix strptime tests on macOS 10.12

Dates in 1900 are before the Unix epoch. We shouldn't make any promises
about how well they are supported, especially given that our time
support is a thin wrapper over the libc functions.

This changes the test to use dates after the epoch, which should fit
within both a signed and an unsigned 32-bit time_t.

7 years agoFix memory leaks in various c-coded builtins
William Langford [Tue, 28 Nov 2017 01:37:14 +0000 (20:37 -0500)]
Fix memory leaks in various c-coded builtins

7 years agoFix leak on error in strptime
Nicolas Williams [Thu, 23 Nov 2017 07:51:22 +0000 (01:51 -0600)]
Fix leak on error in strptime

7 years agoTypo correction
trantor [Mon, 13 Nov 2017 11:49:51 +0000 (12:49 +0100)]
Typo correction

Suppresion -> Suppression

7 years agoMerge pull request #1403 from Argoday/master
William Langford [Mon, 19 Jun 2017 14:55:26 +0000 (10:55 -0400)]
Merge pull request #1403 from Argoday/master

Use unsorted keys in walk

7 years agoDeal with strptime() on OS X and *BSD (fix #1415)
Nicolas Williams [Sun, 21 May 2017 21:24:48 +0000 (16:24 -0500)]
Deal with strptime() on OS X and *BSD (fix #1415)

strptime() on OS X and *BSDs (reputedly) does not set tm_wday and
tm_yday unless corresponding %U and %j format specifiers were used.
That can be... surprising when one parsed year, month, and day anyways.
Glibc's strptime() conveniently sets tm_wday and tm_yday in those cases,
but OS X's does not, ignoring them completely.

This commit makes jq compute those where possible, though the day of
week computation may be wrong for dates before 1900-03-01 or after
2099-12-31.

7 years agoAttempt to fix #1415
Nicolas Williams [Sun, 21 May 2017 06:58:18 +0000 (01:58 -0500)]
Attempt to fix #1415

OS X (and *BSD) strptime() does not set tm_wday nor tm_yday unless
corresponding format options are used.  That means we must call timegm()
to set them.

7 years agoAdd private my_timegm()
Nicolas Williams [Sun, 21 May 2017 06:57:55 +0000 (01:57 -0500)]
Add private my_timegm()

7 years agoFix HAVE_TM_TM_GMT_OFF usage
Nicolas Williams [Sun, 21 May 2017 06:53:00 +0000 (01:53 -0500)]
Fix HAVE_TM_TM_GMT_OFF usage

7 years agoUse AC_CHECK_MATH_FUNC() for all math functions
Nicolas Williams [Sun, 21 May 2017 06:22:39 +0000 (01:22 -0500)]
Use AC_CHECK_MATH_FUNC() for all math functions

7 years agoFix jv_load_file() assertion (fix #1410)
Nicolas Williams [Sat, 20 May 2017 20:47:41 +0000 (15:47 -0500)]
Fix jv_load_file() assertion (fix #1410)

7 years agoImproved git build instructions.
Daniel Lange [Wed, 3 May 2017 18:37:21 +0000 (20:37 +0200)]
Improved git build instructions.

7 years agoUse unsorted keys in walk 1403/head
Jonathan Word [Wed, 3 May 2017 19:49:21 +0000 (15:49 -0400)]
Use unsorted keys in walk

Preserve key sorting order when executing in walk, if sorted keys is desired `--sort-keys` should be used to explicitly obtain sorted keys.

7 years agoAdd JQ_COLORS env var for color config (fix #1252)
Nico Williams [Sat, 29 Apr 2017 18:00:52 +0000 (13:00 -0500)]
Add JQ_COLORS env var for color config (fix #1252)

7 years agoFix build
Nicolas Williams [Thu, 27 Apr 2017 01:55:43 +0000 (20:55 -0500)]
Fix build

7 years agoAlways use jv_mem_*alloc()
Nicolas Williams [Fri, 21 Apr 2017 23:40:39 +0000 (18:40 -0500)]
Always use jv_mem_*alloc()

7 years agodef isempty(g) # Testing 'isempty(empty)' at line number 1364
pkoppstein [Sun, 26 Feb 2017 07:35:49 +0000 (02:35 -0500)]
def isempty(g)  # Testing 'isempty(empty)' at line number 1364

7 years agoUpdate oniguruma to fix #1370
William Langford [Sun, 2 Apr 2017 18:58:59 +0000 (14:58 -0400)]
Update oniguruma to fix #1370

7 years agoDon't require java to build gh-pages
William Langford [Fri, 31 Mar 2017 22:48:28 +0000 (18:48 -0400)]
Don't require java to build gh-pages

7 years agoAdd collect example with pipeline
William Langford [Fri, 31 Mar 2017 22:48:05 +0000 (18:48 -0400)]
Add collect example with pipeline

7 years agoAdd missing close-backtick in docs
William Langford [Fri, 31 Mar 2017 02:23:47 +0000 (22:23 -0400)]
Add missing close-backtick in docs

7 years agoAlso fix `jn/2` and `yn/2`
Nicolas Williams [Thu, 30 Mar 2017 16:46:03 +0000 (11:46 -0500)]
Also fix `jn/2` and `yn/2`

7 years agoFix frexp, modf, lgamma_r (fix #1374)
Nicolas Williams [Wed, 29 Mar 2017 05:07:42 +0000 (00:07 -0500)]
Fix frexp, modf, lgamma_r (fix #1374)

7 years agoAllow . as {$a:$b} destructuring
Nicolas Williams [Tue, 21 Feb 2017 01:24:22 +0000 (19:24 -0600)]
Allow . as {$a:$b} destructuring

7 years agoAdd flex/bison outputs
Nicolas Williams [Tue, 21 Feb 2017 01:15:23 +0000 (19:15 -0600)]
Add flex/bison outputs

7 years agoAdd more destructuring tests
Nicolas Williams [Tue, 21 Feb 2017 01:15:05 +0000 (19:15 -0600)]
Add more destructuring tests

7 years agoAdd --debug-trace=all for detailed debug output
William Langford [Mon, 20 Feb 2017 05:49:28 +0000 (00:49 -0500)]
Add --debug-trace=all for detailed debug output

When tracing execution, print the whole stack, not just the items used by the
current opcode

7 years agoFix a tripped assertion when generating reduces
William Langford [Fri, 17 Feb 2017 05:40:26 +0000 (00:40 -0500)]
Fix a tripped assertion when generating reduces

A noop body, while useless, should still compile successfully

7 years agoAdd alternation destructuring operator `?//`
William Langford [Fri, 17 Feb 2017 05:35:26 +0000 (00:35 -0500)]
Add alternation destructuring operator `?//`

This is a first pass to show the implementation.
It needs tests and evaluation, but doesn't break any existing tests.

NOT READY FOR MERGING

7 years agoConditional exprs are not path exprs (fix #1368)
Nicolas Williams [Wed, 15 Mar 2017 06:07:37 +0000 (01:07 -0500)]
Conditional exprs are not path exprs (fix #1368)

The conditional expression in if-then-elif-else-end cannot contribute to
path expressions because it doesn't change the input to any of the then/
elif/else expressions.  These must be generated via gen_subexp().

See also #1366.

7 years agoMake and build dist in travis-CI (#1356)
Nicolas Williams [Fri, 3 Mar 2017 18:04:46 +0000 (12:04 -0600)]
Make and build dist in travis-CI (#1356)

7 years agoMake configure.ac work for shallow clones
Nicolas Williams [Sun, 5 Mar 2017 04:57:14 +0000 (22:57 -0600)]
Make configure.ac work for shallow clones

7 years agoMake scripts/version work in shallow clones
Nicolas Williams [Fri, 3 Mar 2017 20:28:58 +0000 (14:28 -0600)]
Make scripts/version work in shallow clones

Shallow clones don't have tags.  Use git describe --always --dirty in
such cases.

XXX Add branch name.

7 years agoFix make dist
Nicolas Williams [Thu, 2 Mar 2017 05:01:08 +0000 (23:01 -0600)]
Fix make dist

7 years agoFix off-by-one bug in #1108 fix
Nicolas Williams [Thu, 2 Mar 2017 04:45:02 +0000 (22:45 -0600)]
Fix off-by-one bug in #1108 fix

7 years agoArray slice overflows (fix #1108)
Nicolas Williams [Wed, 1 Mar 2017 23:35:08 +0000 (17:35 -0600)]
Array slice overflows (fix #1108)

7 years agogetpath/1 should be a path expression (fix #1358) 1359/head
Nicolas Williams [Wed, 1 Mar 2017 03:39:54 +0000 (21:39 -0600)]
getpath/1 should be a path expression (fix #1358)

It needs to be possible to do something like

    getpath($paths[]) += 1

meaning: increment all the paths in . that are listed in $paths[].

In order to do this getpath() needs to update the jq->path and
jq->value_at_path as necessary.

7 years agoFix name of builtins in the builtins/0 output
William Langford [Mon, 27 Feb 2017 00:50:10 +0000 (19:50 -0500)]
Fix name of builtins in the builtins/0 output

7 years agoFix warning about environ
Nicolas Williams [Mon, 27 Feb 2017 00:22:30 +0000 (18:22 -0600)]
Fix warning about environ

7 years agoFix --without-oniguruma build
Nicolas Williams [Mon, 27 Feb 2017 00:22:23 +0000 (18:22 -0600)]
Fix --without-oniguruma build

7 years agoFix environ Win32 build problem
Nicolas Williams [Mon, 27 Feb 2017 00:06:35 +0000 (18:06 -0600)]
Fix environ Win32 build problem

7 years agoAdd `halt`, `halt_error` builtins (fix #386) 1348/head
Nicolas Williams [Thu, 23 Feb 2017 05:01:56 +0000 (23:01 -0600)]
Add `halt`, `halt_error` builtins (fix #386)

7 years agoDocument `stderr`
Nicolas Williams [Thu, 23 Feb 2017 05:01:39 +0000 (23:01 -0600)]
Document `stderr`

7 years agoFix memory leak
Nicolas Williams [Sun, 26 Feb 2017 22:32:43 +0000 (16:32 -0600)]
Fix memory leak

7 years agoFix Appveyor for non-master branches 1353/head
Nicolas Williams [Sun, 26 Feb 2017 22:13:22 +0000 (16:13 -0600)]
Fix Appveyor for non-master branches

7 years agofixup
Nicolas Williams [Sun, 26 Feb 2017 22:12:57 +0000 (16:12 -0600)]
fixup

7 years agoAdd $ENV builtin variable to access environment
Nicolas Williams [Sun, 26 Feb 2017 06:28:12 +0000 (00:28 -0600)]
Add $ENV builtin variable to access environment

7 years agoFix error message for undefined vars
Nicolas Williams [Sun, 26 Feb 2017 06:25:09 +0000 (00:25 -0600)]
Fix error message for undefined vars

7 years agoPreserve precious vars in configure.ac (fix #795)
Nicolas Williams [Sun, 26 Feb 2017 03:49:38 +0000 (21:49 -0600)]
Preserve precious vars in configure.ac (fix #795)

7 years agoDocument $ARGS and friends
Nicolas Williams [Sun, 26 Feb 2017 01:21:06 +0000 (19:21 -0600)]
Document $ARGS and friends

7 years agoAdd $ARGS, --args and --jsonargs (fix #1345) 1346/head
Nicolas Williams [Mon, 20 Feb 2017 00:11:18 +0000 (18:11 -0600)]
Add $ARGS, --args and --jsonargs (fix #1345)

7 years agojq_compile_args(): allow object args to be object
Nicolas Williams [Mon, 20 Feb 2017 00:08:03 +0000 (18:08 -0600)]
jq_compile_args(): allow object args to be object

7 years agoAdd jv_object_has()
Nicolas Williams [Mon, 20 Feb 2017 00:05:38 +0000 (18:05 -0600)]
Add jv_object_has()

7 years agoMake test/shtest test of constant folding robust
Nicolas Williams [Mon, 20 Feb 2017 00:23:36 +0000 (18:23 -0600)]
Make test/shtest test of constant folding robust

Rather than testing that a constant expression produces so many
instructions, test that a variety of of such expressions produce the
same number of instructions.  This will make future changes in the
compiler less likely to break this test.

7 years agoImprove Appveyor build
Nicolas Williams [Sat, 25 Feb 2017 20:30:14 +0000 (14:30 -0600)]
Improve Appveyor build

Among other things, make TESTS=... breaks when using modules/oniguruma,
so set SUBDIRS= then.

7 years agoWindows: configure fails to detect missing math
Nicolas Williams [Sun, 26 Feb 2017 00:22:24 +0000 (18:22 -0600)]
Windows: configure fails to detect missing math

For some reason AC_CHECK_MATH_FUNC() on Windows is not detecting a
handful of math functions as not being supported.  This commit is a bit
of a hack.

7 years agoMake comment consistent with code
Nicolas Williams [Sat, 25 Feb 2017 20:24:43 +0000 (14:24 -0600)]
Make comment consistent with code

7 years agoDon't call SetConsoleOutputCP
Yasuhiro Matsumoto [Fri, 1 Apr 2016 05:53:38 +0000 (14:53 +0900)]
Don't call SetConsoleOutputCP

Should use wide-string function instead of SetConsoleOutputCP.

Fixes #1121

7 years agoQuiet a compiler warning
Yasuhiro Matsumoto [Fri, 1 Apr 2016 05:53:12 +0000 (14:53 +0900)]
Quiet a compiler warning

7 years agoWindows: Also use -lshlwapi for jq(1)
Nicolas Williams [Sat, 25 Feb 2017 20:15:18 +0000 (14:15 -0600)]
Windows: Also use -lshlwapi for jq(1)

7 years agoWhen using builtin Oniguruma, set flags correctly
Nicolas Williams [Sat, 25 Feb 2017 20:02:03 +0000 (14:02 -0600)]
When using builtin Oniguruma, set flags correctly

This should fix the Travis-CI build.

7 years agoDocument `localtime` and `strflocaltime`
Nicolas Williams [Fri, 24 Feb 2017 05:39:24 +0000 (23:39 -0600)]
Document `localtime` and `strflocaltime`

7 years agoAdd `localtime` and `strflocaltime` (fix #1349)
Nicolas Williams [Fri, 24 Feb 2017 04:26:53 +0000 (22:26 -0600)]
Add `localtime` and `strflocaltime` (fix #1349)

7 years agoImprove manual section on assignment forms
Nicolas Williams [Fri, 24 Feb 2017 04:17:54 +0000 (22:17 -0600)]
Improve manual section on assignment forms

7 years agoRevert e7caf68 for Dockerfile
Nicolas Williams [Fri, 24 Feb 2017 04:01:43 +0000 (22:01 -0600)]
Revert e7caf68 for Dockerfile

7 years agoAttempt to use builtin Oniguruma for CIs
Nicolas Williams [Thu, 23 Feb 2017 06:33:08 +0000 (00:33 -0600)]
Attempt to use builtin Oniguruma for CIs

7 years agoAllow ./configure --with-oniguruma=builtin
Nicolas Williams [Thu, 23 Feb 2017 06:30:13 +0000 (00:30 -0600)]
Allow ./configure --with-oniguruma=builtin

This allows one to force the use of jq's builtin copy of Oniguruma
(builtin as a git submodule).

We still need to fix make dist to include that copy of Oniguruma.

7 years agoAllow var bindings in path expressions (#1347)
Nicolas Williams [Wed, 22 Feb 2017 00:11:35 +0000 (18:11 -0600)]
Allow var bindings in path expressions (#1347)

The expression in a variable binding is not and must not be seen as
being part of a path expression in which the variable binding appears.