]> granicus.if.org Git - jq/log
jq
5 years agoFix assert in generator subexpressions (fix #1875) 1877/head
Nicolas Williams [Tue, 26 Mar 2019 23:33:19 +0000 (18:33 -0500)]
Fix assert in generator subexpressions (fix #1875)

Expressions of the form `path(EXPR) | select(GENERATOR)`, where `EXPR`
is a path expression and `GENERATOR` is a generator conditional
expression (e.g., `has("a"), has("b")`) cause an assertion if the
jq_state VM is torn down too soon.  That assert() was only correct if
assuming that the conditional is not a generator.

If the conditional is generator, then what we see is that when
backtracking a SUBEXP_END is executed without a corresponding
SUBEXP_BEGIN because the entire conditional is bracketed with
SUBEXP_BEGIN and SUBEXP_END, and since it's resumed in the middle, in
between the brackets.

Rather than assert that the jq->path_len being restored has some
particular value, we can simply re-compute it from the restored
jq->path.

5 years agoFix tests/jq.test for c72ed135
Nicolas Williams [Mon, 25 Mar 2019 14:56:46 +0000 (09:56 -0500)]
Fix tests/jq.test for c72ed135

5 years agoFix tests/shtest broken by 2b4d51f
Nicolas Williams [Mon, 25 Mar 2019 14:52:36 +0000 (09:52 -0500)]
Fix tests/shtest broken by 2b4d51f

5 years agoDisable docs by default; don't mantest if no docs
Nicolas Williams [Wed, 6 Mar 2019 19:58:09 +0000 (13:58 -0600)]
Disable docs by default; don't mantest if no docs

5 years agoIdentify progname in more errors (fix #1860)
Nicolas Williams [Mon, 25 Mar 2019 04:32:42 +0000 (23:32 -0500)]
Identify progname in more errors (fix #1860)

However, we should really use the argv[0] progname, not just jq.
Someday we may want to support aliases which automatically add certain
options, etc.

5 years agoAdd -b / --binary option for Windows
Nicolas Williams [Sun, 24 Mar 2019 19:39:58 +0000 (14:39 -0500)]
Add -b / --binary option for Windows

5 years agoAllow .["foo"].["bar"]
Nicolas Williams [Fri, 8 Mar 2019 15:59:47 +0000 (09:59 -0600)]
Allow .["foo"].["bar"]

5 years agoAllow keywords in more places (fix #1868)
Nicolas Williams [Fri, 22 Mar 2019 04:58:55 +0000 (23:58 -0500)]
Allow keywords in more places (fix #1868)

5 years agoRestore cfunction arity in builtins/0
Muh Muhten [Wed, 27 Feb 2019 04:13:33 +0000 (23:13 -0500)]
Restore cfunction arity in builtins/0

Count arguments up-front at definition/invocation instead of doing it at
bind time, which comes after generating builtins/0 since e843a4f.

5 years agoBind libraries backward for consistent shadowing
Muh Muhten [Thu, 21 Feb 2019 04:05:29 +0000 (23:05 -0500)]
Bind libraries backward for consistent shadowing

5 years agoFix regression on ~/.jq being a directory
Muh Muhten [Thu, 21 Feb 2019 03:53:37 +0000 (22:53 -0500)]
Fix regression on ~/.jq being a directory

5 years agoFix alpine build
Muh Muhten [Tue, 26 Feb 2019 23:45:32 +0000 (18:45 -0500)]
Fix alpine build

5 years agoMake shtest verbose 2 diag. alpine build failure
Nicolas Williams [Tue, 26 Feb 2019 17:15:49 +0000 (11:15 -0600)]
Make shtest verbose 2 diag. alpine build failure

Temporarily(?) make tests/shtest verbose to help diagnose Travis alpine
build failures.

5 years agoChange contains to return true for empty string needles
William Langford [Sat, 23 Feb 2019 00:33:24 +0000 (19:33 -0500)]
Change contains to return true for empty string needles

The behavior of memmem for an empty needle is inconsistent between
implementations of libc.
Our tests imply that we want an empty string needle to be true,
so check for an empty needle before calling memmem.

5 years agoConfigure appveyor build to use python
William Langford [Thu, 21 Feb 2019 02:58:58 +0000 (21:58 -0500)]
Configure appveyor build to use python

5 years agoCleanup leftover references to ruby
William Langford [Thu, 21 Feb 2019 02:28:10 +0000 (21:28 -0500)]
Cleanup leftover references to ruby

5 years agoConfigure travis build to use python
William Langford [Thu, 21 Feb 2019 02:01:17 +0000 (21:01 -0500)]
Configure travis build to use python

5 years agoRemove ruby dependency from mantests
William Langford [Thu, 21 Feb 2019 01:58:25 +0000 (20:58 -0500)]
Remove ruby dependency from mantests

5 years agoRemove ruby dependency from manpage build
William Langford [Thu, 21 Feb 2019 01:53:10 +0000 (20:53 -0500)]
Remove ruby dependency from manpage build

5 years agoRemove ruby dependency from website build
William Langford [Thu, 21 Feb 2019 01:50:08 +0000 (20:50 -0500)]
Remove ruby dependency from website build

5 years agoSimplify and optimize SQLish builtins
Muh Muhten [Tue, 26 Feb 2019 10:54:58 +0000 (05:54 -0500)]
Simplify and optimize SQLish builtins

5 years agoFix bizarre bsearch/1 behaviour with a stream argument
Muh Muhten [Tue, 26 Feb 2019 10:40:01 +0000 (05:40 -0500)]
Fix bizarre bsearch/1 behaviour with a stream argument

5 years agoMake tostream much more efficient
Muh Muhten [Tue, 26 Feb 2019 10:35:59 +0000 (05:35 -0500)]
Make tostream much more efficient

(`path(.[])` is a streaming `keys`!)

5 years agoReimplement fromstream/1 more compactly
Muh Muhten [Tue, 26 Feb 2019 10:33:36 +0000 (05:33 -0500)]
Reimplement fromstream/1 more compactly

5 years agoSimplify definition of range/3
Muh Muhten [Tue, 26 Feb 2019 10:22:18 +0000 (05:22 -0500)]
Simplify definition of range/3

New implementation in terms of while/2, and branches immediately on $by
to avoid checking the sign of $by *in* the loop.

5 years agoSimplify type-select builtins
Muh Muhten [Tue, 26 Feb 2019 10:21:31 +0000 (05:21 -0500)]
Simplify type-select builtins

5 years agoAdd more tests for any and all
Muh Muhten [Sun, 24 Feb 2019 00:47:51 +0000 (19:47 -0500)]
Add more tests for any and all

5 years agoRedefine isempty/1, and the all and any series
Muh Muhten [Tue, 26 Feb 2019 10:18:09 +0000 (05:18 -0500)]
Redefine isempty/1, and the all and any series

Fixes the bug where all and any evaluate one more item than needed.

5 years agoRemove scalars_or_empty
Muh Muhten [Tue, 26 Feb 2019 04:53:21 +0000 (23:53 -0500)]
Remove scalars_or_empty

5 years agoNo need to block_drop_unreferenced after builtins
Muh Muhten [Tue, 26 Feb 2019 04:02:14 +0000 (23:02 -0500)]
No need to block_drop_unreferenced after builtins

(The correctness of this change is more obvious after the rename.)

5 years agoRename block_bind_incremental to block_bind_referenced
Muh Muhten [Tue, 26 Feb 2019 03:55:39 +0000 (22:55 -0500)]
Rename block_bind_incremental to block_bind_referenced

block_bind_incremental is block_bind_referenced in a loop backwards. For
an 1-inst block, it does the same thing and isn't too much more
expensive, so it's not really useful to keep both.

Also, block_bind_referenced was a better name for the function.

5 years agoFix block flipping in block_drop_unreferenced
Muh Muhten [Tue, 26 Feb 2019 02:55:15 +0000 (21:55 -0500)]
Fix block flipping in block_drop_unreferenced

Since 605bfb3, block_drop_unreferenced actually reverses the order of
instructions in the block it's run against. This bug was hidden by the
fact that normally it's run *twice* against the main program, flipping
it back, and that order of function definitionss doesn't really matter
after symbol resolution.

5 years agoMerge pull request #1837 from muhmuhten/limit_0
Nico Williams [Thu, 21 Feb 2019 14:17:41 +0000 (08:17 -0600)]
Merge pull request #1837 from muhmuhten/limit_0

5 years agoEnsure limit(0; ...) is empty 1837/head
Muh Muhten [Thu, 21 Feb 2019 09:11:41 +0000 (04:11 -0500)]
Ensure limit(0; ...) is empty

5 years agoRewrite `_assign/2` using `$argument` syntax
Muh Muhten [Thu, 21 Feb 2019 02:10:31 +0000 (20:10 -0600)]
Rewrite `_assign/2` using `$argument` syntax

5 years agoWork around fgets()'s lack of length reporting
Muh Muhten [Thu, 7 Feb 2019 06:53:09 +0000 (01:53 -0500)]
Work around fgets()'s lack of length reporting

Stop losing \0s from the end of files because we don't know how much
fgets() read into our buffer. If we prefill the buffer with anything
other than zeroes, we can actually tell the difference between the
terminator and unused space in the buffer.

This is possibly more expensive, but at least it should be correct.

Fixes #1504

5 years agoFix if-then-else example formatting
Nicolas Williams [Thu, 21 Feb 2019 01:54:06 +0000 (19:54 -0600)]
Fix if-then-else example formatting

5 years agoDocument optional `else` clause of `if`
Nicolas Williams [Thu, 21 Feb 2019 01:53:39 +0000 (19:53 -0600)]
Document optional `else` clause of `if`

5 years agoSupport "if" without "else" clause
Chance Zibolski [Fri, 15 Feb 2019 03:59:59 +0000 (19:59 -0800)]
Support "if" without "else" clause

Defaults the else clause to the identity filter "." if an else clause is
missing.

The following two jq programs are considered equivalent:

```
if .foo then
    .foo = "bar"
else
    .
end
```

```
if .foo then
    .foo = "bar"
end
```

5 years agoBind data imports properly when already resolved
Muh Muhten [Fri, 8 Feb 2019 04:05:18 +0000 (23:05 -0500)]
Bind data imports properly when already resolved

5 years agoMake builtin binding fast again by binding only referenced symbols
Muh Muhten [Wed, 20 Feb 2019 06:48:56 +0000 (01:48 -0500)]
Make builtin binding fast again by binding only referenced symbols

Avoid doing the internal binding of top-level symbols in the parser,
leaving that work to be done in a post-processing step. For builtins,
this lets us do a reference-aware bind step (block_bind_incremental)
*after* generating builtins/0.

Libraries are a bit trickier since they may be bound multiple times, so
instead of thinking through the implications I added (block_bind_self)
to resolve all internal symbols immediately.

5 years agoLoad ~/.jq as a library instead of with builtins
Muh Muhten [Tue, 19 Feb 2019 05:39:34 +0000 (00:39 -0500)]
Load ~/.jq as a library instead of with builtins

Remove the special code which loads ~/.jq in builtin.c, and instead glue
an optional include which points to the same file onto the main program
in linker.c.

Fixes a minor bug where errors in ~/.jq would be labelled <builtin>.

5 years agoAdd import metadata key "optional"
Muh Muhten [Sun, 15 Oct 2017 05:57:17 +0000 (01:57 -0400)]
Add import metadata key "optional"

A library marked is imported if found, but silently skipped if missing.
This is the desired semantic for the auto-include at ~/.jq

5 years agoReplace TOP-before-imports special case with assert
Muh Muhten [Tue, 19 Feb 2019 05:14:53 +0000 (00:14 -0500)]
Replace TOP-before-imports special case with assert

The case isn't actually possible afaict.

5 years agoCatch .. as the first component of a module path
Muh Muhten [Tue, 19 Feb 2019 05:35:40 +0000 (00:35 -0500)]
Catch .. as the first component of a module path

Only the second and subsequent path components were being checked, which
I guess is theoretically security-relevant.

There's no apparent point to reconstructing the path after splitting it
by adding /s back in, either.

5 years agoPass on the error message when rel_path is invalid
Muh Muhten [Tue, 19 Feb 2019 05:34:04 +0000 (00:34 -0500)]
Pass on the error message when rel_path is invalid

"Module path must be a string" is not a useful error message when the
reason the module path isn't a string is because the string it was got
replaced with an invalid with an error message for some other reason.

Also fixes a few memory leaks on early exits.

5 years agoSimplify definition of block_bind_referenced
Muh Muhten [Tue, 19 Feb 2019 02:00:59 +0000 (21:00 -0500)]
Simplify definition of block_bind_referenced

5 years agoAllow globbing on Windows
Jason Hood [Tue, 12 Feb 2019 11:33:46 +0000 (21:33 +1000)]
Allow globbing on Windows

The mingw-w64 runtime expands wildcards, which causes a discrepancy
between `main`'s `argv` (multiple file names) and Windows' `wargv` (a
single wildcard).  Use `wmain` to retrieve the wide character args.

5 years agoMake UTC time on Windows
Jason Hood [Thu, 14 Feb 2019 08:42:51 +0000 (18:42 +1000)]
Make UTC time on Windows

Windows has `_mkgmtime` for the UTC equivalent of `mktime`.

5 years agoAdd ISO 8601-specific strptime
Jason Hood [Thu, 14 Feb 2019 08:39:23 +0000 (18:39 +1000)]
Add ISO 8601-specific strptime

Implement `strptime` for systems lacking it, but only supporting the
ISO 8601 format string.

5 years agoPrevent redirecting to NUL crash
Jason Hood [Tue, 12 Feb 2019 13:18:47 +0000 (23:18 +1000)]
Prevent redirecting to NUL crash

Windows regards the `NUL` device as tty, which causes `WriteFile` to
fail (the bytes written pointer cannot be `NULL` in this case).  Tweak
the color test to ensure tty is accurate.

5 years agoPossibly enable color output on Windows (#1494)
Jason Hood [Tue, 12 Feb 2019 08:34:37 +0000 (18:34 +1000)]
Possibly enable color output on Windows (#1494)

Windows 10 supports color output, but it must be explicitly enabled;
ANSICON provides support for other versions.  Enable color if either of
those are available.  Resolves #1494.

5 years agoReimplement block_drop_unreferenced in linear time
Muh Muhten [Sat, 9 Feb 2019 22:24:18 +0000 (17:24 -0500)]
Reimplement block_drop_unreferenced in linear time

5 years agoMerge pull request #1818 from muhmuhten/free_in_index
Nico Williams [Sat, 9 Feb 2019 22:32:20 +0000 (16:32 -0600)]
Merge pull request #1818 from muhmuhten/free_in_index

5 years agoMake sure to free in jv_string_indexes 1818/head
Muh Muhten [Sat, 9 Feb 2019 22:17:59 +0000 (17:17 -0500)]
Make sure to free in jv_string_indexes

5 years agoImprove linking time by marking subtrees with unbound symbols
Muh Muhten [Fri, 8 Feb 2019 21:52:04 +0000 (16:52 -0500)]
Improve linking time by marking subtrees with unbound symbols

5 years agoFix infinite loop in index("") (fix #1815)
Nicolas Williams [Sat, 9 Feb 2019 02:39:36 +0000 (20:39 -0600)]
Fix infinite loop in index("") (fix #1815)

5 years agoFIX if-then-else example
Matt Clegg [Mon, 3 Sep 2018 09:58:02 +0000 (11:58 +0200)]
FIX if-then-else example

"(.+)" doesn't match new line characters so the link generated for [if-then-else](https://github.com/stedolan/jq/blob/90bc29c1b544c0436ec44246e180fdbb6d6384df/docs/content/3.manual/v1.5/manual.yml#L1804) doesn't work

5 years agoDefine error/1 in terms of error/0
Muh Muhten [Thu, 7 Feb 2019 02:00:02 +0000 (21:00 -0500)]
Define error/1 in terms of error/0

The parser generates a call to error/0 on break. Having that exported
from C directly removes a language dependency on builtin.jq.

In any case, error/0 seems to be the more fundamental operation, seeing
as the old C impementation of error/1 did nothing useful with its input.

5 years agoExport input/0 directly from C, removing _input/0
Muh Muhten [Wed, 6 Feb 2019 04:52:50 +0000 (23:52 -0500)]
Export input/0 directly from C, removing _input/0

The distinction between input/0 and _input/0 has been unnecessary since
a9c613..7dc34b, which moved end-of-input handling into C and replaced
the jq definition of input with `def input: _input;`

5 years agobuiltin/f_match: prevent overruns of input_string
Derrick Pallas [Sun, 3 Feb 2019 02:18:18 +0000 (18:18 -0800)]
builtin/f_match: prevent overruns of input_string

If these values do not match exactly, it is because the UTF-8 is invalid
anyway and we counted codepoints differently than oniguruma did.  Perhaps it
would be better to error out here, but at least one similar loop already
uses < vs != and since we're off the rails anyway this might be OK.  It is
certainly better than overruning the buffer.

Resolves https://github.com/stedolan/jq/issues/1804

5 years agobuiltin/f_match: call onig_error_code_to_str with einfo correctly
Derrick Pallas [Sun, 3 Feb 2019 00:17:12 +0000 (16:17 -0800)]
builtin/f_match: call onig_error_code_to_str with einfo correctly

5 years agoUnify timegm fallbacks into my_mktime
Muh Muhten [Wed, 30 Jan 2019 05:41:47 +0000 (00:41 -0500)]
Unify timegm fallbacks into my_mktime

my_timegm was introduced in 1900c7 to add a mktime fallback used in
4a6241, the subsequently removed in c53823. As a result of this code
shuffling, the jq mktime function (f_mktime) wound up using a fallback
even on systems where timegm is available, with incorrect results in
some time zones with DST, e.g.

% TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T01:00:00Z"

This undoes 1900c7 and moves the workaround it added into the #else of
my_mktime.

5 years agoFix build on BSD make
Muh Muhten [Wed, 30 Jan 2019 05:05:49 +0000 (00:05 -0500)]
Fix build on BSD make

Replace uses of the nonstandard $^ variable by explicitly specifying the
source filenames. This is the only obvious thing preventing the build
from running correctly on non-GNU make.

5 years agoFix include/import namespace confusion
Muh Muhten [Thu, 12 Oct 2017 18:46:31 +0000 (14:46 -0400)]
Fix include/import namespace confusion

5 years agoAdd tests for built-in function `contains`
David Haguenauer [Tue, 22 Jan 2019 01:33:55 +0000 (20:33 -0500)]
Add tests for built-in function `contains`

5 years ago`contains` should handle embedded NULs (fix #1732)
Nicolas Williams [Sat, 19 Jan 2019 04:33:46 +0000 (22:33 -0600)]
`contains` should handle embedded NULs (fix #1732)

5 years agoMerge pull request #1774 from dooglus/patch-1
William Langford [Sat, 5 Jan 2019 21:04:30 +0000 (16:04 -0500)]
Merge pull request #1774 from dooglus/patch-1

Fix grammar typo.

5 years agoOut-of-srcdir builds: AM_CPPFLAGS=-I${srcdir}/src
Nicolas Williams [Wed, 26 Dec 2018 18:52:22 +0000 (12:52 -0600)]
Out-of-srcdir builds: AM_CPPFLAGS=-I${srcdir}/src

5 years agobuiltin: add missing windows.h include
Ricardo Constantino [Wed, 26 Dec 2018 02:49:05 +0000 (02:49 +0000)]
builtin: add missing windows.h include

Follow-up fix to b436156f5 because BOOL and DWORD
are not built-in to mingw64.

5 years agoMakefile.am: add no-undefined for win32
Ricardo Constantino [Wed, 26 Dec 2018 02:45:54 +0000 (02:45 +0000)]
Makefile.am: add no-undefined for win32

"Undefined symbols are not allowed in x86_64-w64-mingw32 shared libraries"

This was also applied in the official MINGW-packages repo:
Alexpux/MINGW-packages@b5566c58a

5 years agoMingw-w64 on windows doesn't have `setenv`, fix that.
HE, Tao [Tue, 18 Dec 2018 08:49:32 +0000 (16:49 +0800)]
Mingw-w64 on windows doesn't have `setenv`, fix that.

Signed-off-by: HE, Tao <sighingnow@gmail.com>
5 years agoMake fromstream/1 more efficient
Eugen [Sat, 10 Nov 2018 21:08:41 +0000 (22:08 +0100)]
Make fromstream/1 more efficient

5 years agofix --exit-code issues #1142 and #1139
Ryoichi KATO [Sun, 29 Jul 2018 19:50:28 +0000 (12:50 -0700)]
fix --exit-code issues #1142 and #1139

* Set default error code to -4 in main(), Fixes #1142
* fix --exit-code with more than one object in input, Fixes #1139
    - Return code 1 or 4 based on last output, not last input.

5 years agoEnsure that `${builddir}/src` exists
mail6543210 [Mon, 5 Nov 2018 15:16:39 +0000 (23:16 +0800)]
Ensure that `${builddir}/src` exists

5 years agoMerge pull request #1779 from gvangool/update-NEWS
William Langford [Sat, 15 Dec 2018 20:20:23 +0000 (15:20 -0500)]
Merge pull request #1779 from gvangool/update-NEWS

Adds the release info for 1.6 to NEWS

5 years agoAdds the release info for 1.6 to NEWS 1779/head
Gert Van Gool [Sat, 15 Dec 2018 18:51:29 +0000 (19:51 +0100)]
Adds the release info for 1.6 to NEWS

5 years agoAllow variable refs as object keys {$key:value}
Nicolas Williams [Tue, 11 Dec 2018 03:54:59 +0000 (21:54 -0600)]
Allow variable refs as object keys {$key:value}

Users are often surprised by the requirement to parenthesize any
non-trivial object key expressions in object constructors.  E.g.,
{"a"+"b":1}.  This commit adds one more kind of key expression besides
literals and idents: variable references.

A common use case for this is jq programs as JSON templates to fill in
with variables computed from inputs or passed in on the command-line.
E.g., {some_key:$value}.  Now users can also use, e.g., {$key:$value}.

This and the restrictions on key and value expressions in object
constructors are now clarified a bit in the documentation.

5 years agoFix grammar typo. 1774/head
Chris Moore [Thu, 29 Nov 2018 13:44:05 +0000 (05:44 -0800)]
Fix grammar typo.

'operator' needs to be plural here.

5 years agoMerge pull request #1768 from haochenx/readme-add-automake-as-build-dependency-in
William Langford [Tue, 20 Nov 2018 15:13:47 +0000 (10:13 -0500)]
Merge pull request #1768 from haochenx/readme-add-automake-as-build-dependency-in

add automake as build dependency to README.md

5 years agoAdd missing jv_copy when printing with -ar
William Langford [Tue, 20 Nov 2018 14:58:25 +0000 (09:58 -0500)]
Add missing jv_copy when printing with -ar

5 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

5 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

5 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

5 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

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

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

5 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

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

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

5 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.

5 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.

5 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