]> granicus.if.org Git - jq/log
jq
4 years agoEnsure travis has a python version we expect master
William Langford [Tue, 22 Oct 2019 17:14:33 +0000 (13:14 -0400)]
Ensure travis has a python version we expect

4 years agoRemove an accidentally committed debug file
Leonid S. Usov [Thu, 4 Apr 2019 17:47:35 +0000 (20:47 +0300)]
Remove an accidentally committed debug file

4 years agoAdd configure guards around literal jv_numbers
William Langford [Thu, 4 Apr 2019 01:55:39 +0000 (21:55 -0400)]
Add configure guards around literal jv_numbers

Allow building jq in a mode that doesn't use decnumber for benchmarking
purposes. decnumber support is enabled by default, and this option is
meant to be removed once we're happy with the performance.

4 years ago[tests] print test # from the start of the tests file to help with skip and take
Leonid S. Usov [Tue, 30 Oct 2018 12:51:49 +0000 (14:51 +0200)]
[tests] print test # from the start of the tests file to help with skip and take

4 years agoSave literal value of the parsed number to preserve it for the output
Leonid S. Usov [Fri, 19 Oct 2018 18:57:41 +0000 (21:57 +0300)]
Save literal value of the parsed number to preserve it for the output

Extend jv_number to use decNumber for storing number literals. Any math
operations on the numbers will truncate them to double precision.
Comparisons when both numbers are literal numbers will compare them
without truncation.

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

Outputting literal jv_numbers preserves the original precision.

Add strong pthread requirement to manage contexts/allocations for
converting numbers between their decNumber, string, and double formats.

4 years agoAdd decNumber library
Leonid S. Usov [Fri, 26 Oct 2018 21:04:35 +0000 (00:04 +0300)]
Add decNumber library

The library adds support for decimal numbers of arbitrary length.
Downloaded from ICU, under ICU 1.8.1 license
http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip

4 years agoMerge pull request #1948 from eli-schwartz/no-pacman-sy
William Langford [Wed, 31 Jul 2019 16:20:51 +0000 (12:20 -0400)]
Merge pull request #1948 from eli-schwartz/no-pacman-sy

docs: fix seriously dangerous download instructions for Arch Linux

4 years agodocs: fix seriously dangerous download instructions for Arch Linux 1948/head
Eli Schwartz [Sun, 21 Jul 2019 18:40:47 +0000 (14:40 -0400)]
docs: fix seriously dangerous download instructions for Arch Linux

The current instructions tell users to perform two actions:
- update the package database
- install the jq package

The only thing users need to or should be doing is actually installing
the jq package -- regardless of which version is being installed.
Guidelines on how to perform system updates are massively out of scope.

In the case of partially performing a system update as a prerequisite
for installing jq, the official guidance from Arch Linux is not to do
this: partial updates are not supported, we refuse to support them, and
anyone who does try to perform them anyway is assumed to know so much
about their system that they clearly do not ever need help from anyone
else (which is a good thing since they won't get it). The result is a
frankensteined system that can only ever be supported by the person who
frankensteined it to begin with. The only reason the package manager
even allows it to occur in the first place is because other
distributions using pacman might have different LTS policies, and
because it would prevent expert users from being in control of their
system, as per the traditional Unix philosophy:

"Unix was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things."

Consequences of performing partial updates without understanding the
ramifications in extensive detail can include breaking the partially
updated application (jq), breaking any application that shares a mutual
dependency with the partially updated application (which jq is *lucky*
to only depend on the ever-backwards-compatible glibc), or breaking the
entire operating system by leaving armed traps behind for the next time
a `pacman -S new-package` is executed and thereby breaks *its* cascading
dependencies.

See:
https://wiki.archlinux.org/index.php/System_maintenance#Partial_upgrades_are_unsupported

4 years agoMerge pull request #1944 from tessus/doc-improvement
William Langford [Sun, 14 Jul 2019 19:08:14 +0000 (15:08 -0400)]
Merge pull request #1944 from tessus/doc-improvement

clarify filter usage

4 years agoclarify filter usage 1944/head
Helmut K. C. Tessarek [Tue, 9 Jul 2019 01:02:43 +0000 (21:02 -0400)]
clarify filter usage

The current paragraph is not complete, since a digit is not a special character.

Changing it to:

    If the key contains special characters or starts with a digit,
    you need to surround it with double quotes like this:
    `."foo$"`, or else `.["foo$"]`.

4 years agoMakefile.am: fix builtin.inc with out-of-root builds
Ricardo Constantino [Wed, 29 May 2019 19:36:18 +0000 (20:36 +0100)]
Makefile.am: fix builtin.inc with out-of-root builds

5 years agoImprove jv_is_integer()
Mark Feit [Thu, 14 Mar 2019 19:07:35 +0000 (15:07 -0400)]
Improve jv_is_integer()

5 years agojq_util_input_init: Zero memory using calloc
Mattias Hansson [Thu, 4 Apr 2019 09:42:49 +0000 (11:42 +0200)]
jq_util_input_init: Zero memory using calloc

Calloc will zero the allocated memory which makes one memset and a
number of explicit zero assignments redundant.

5 years agoDockerfile: Uninstall oniguruma before distclean
Mattias Hansson [Fri, 29 Mar 2019 08:32:26 +0000 (09:32 +0100)]
Dockerfile: Uninstall oniguruma before distclean

Run `make uninstall` for oniguruma before running the recursive
distclean that will remove oniguruma's Makefile and cause a build error
due to missing make target.

5 years agoDockerfile: Fetch dependency as git submodule
Mattias Hansson [Thu, 28 Mar 2019 20:45:29 +0000 (21:45 +0100)]
Dockerfile: Fetch dependency as git submodule

Fetch oniguruma using git submodule instead of a release tarball. It
will fix a build problem, caused by jq's autotools configuration, trying
to run `make distclean` recursively in an empty modules directory. This
will also improve the maintainability of the Dockerfile.

5 years agoDockerfile: Change base image to Debian Stable
Mattias Hansson [Thu, 28 Mar 2019 19:05:42 +0000 (20:05 +0100)]
Dockerfile: Change base image to Debian Stable

5 years agoDockerfile: Add missing dependency to pip3
Mattias Hansson [Thu, 28 Mar 2019 17:49:35 +0000 (18:49 +0100)]
Dockerfile: Add missing dependency to pip3

5 years agoDockerfile: Specify locale settings
Mattias Hansson [Thu, 28 Mar 2019 17:36:33 +0000 (18:36 +0100)]
Dockerfile: Specify locale settings

Avoid RuntimeError in pipenv by setting LC_ALL and LANG to C.UTF-8.

5 years agoDockerfile: Set noninteractive
Mattias Hansson [Thu, 28 Mar 2019 17:32:39 +0000 (18:32 +0100)]
Dockerfile: Set noninteractive

Configure the environment to inform debconf that it's running in
noninteractive mode, to avoid some warnings.

5 years agoAdd pkg-config file for libjq
Mattias Hansson [Fri, 29 Mar 2019 12:25:39 +0000 (13:25 +0100)]
Add pkg-config file for libjq

pkg-config is a common interface to resolve build details. It will
become easier to incorporate libjq in other projects by providing this
interface.

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