Commit Graph
1291 Commits
Author SHA1 Message Date
Eli Schwartz 78774647e1 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
2019-07-21 14:40:47 -04:00
William Langford a97638713a Merge pull request #1944 from tessus/doc-improvement
clarify filter usage
2019-07-14 15:08:14 -04:00
Helmut K. C. Tessarek 8d9817d2f7 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$"]`.
2019-07-08 21:02:43 -04:00
Ricardo Constantino e944fe8436 Makefile.am: fix builtin.inc with out-of-root builds 2019-06-11 11:57:02 -05:00
Mark Feit ad9fc9f559 Improve jv_is_integer() 2019-04-07 14:33:36 -05:00
Mattias Hansson 263e1061ea 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.
2019-04-04 12:37:21 -05:00
Mattias Hansson 4f58a59f4d 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.
2019-03-29 08:19:41 -05:00
Mattias Hansson 584370127a 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.
2019-03-29 08:19:41 -05:00
Mattias Hansson 528a4f5945 Dockerfile: Change base image to Debian Stable 2019-03-29 08:19:41 -05:00
Mattias Hansson c4062e09b9 Dockerfile: Add missing dependency to pip3 2019-03-29 08:19:41 -05:00
Mattias Hansson 70e04d6a8e Dockerfile: Specify locale settings
Avoid RuntimeError in pipenv by setting LC_ALL and LANG to C.UTF-8.
2019-03-29 08:19:41 -05:00
Mattias Hansson bcd594ed69 Dockerfile: Set noninteractive
Configure the environment to inform debconf that it's running in
noninteractive mode, to avoid some warnings.
2019-03-29 08:19:41 -05:00
Mattias Hansson 3c4fcb1594 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.
2019-03-29 08:16:36 -05:00
Nicolas Williams b52fc1043b 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.
2019-03-26 18:58:55 -05:00
Nicolas Williams b34af08f67 Fix tests/jq.test for c72ed135 2019-03-25 09:56:53 -05:00
Nicolas Williams e01398c9db Fix tests/shtest broken by 2b4d51f 2019-03-25 09:52:42 -05:00
Nicolas Williams dffba62e13 Disable docs by default; don't mantest if no docs 2019-03-24 23:36:50 -05:00
Nicolas Williams 2b4d51f697 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.
2019-03-24 23:36:18 -05:00
Nicolas Williams 0dab2b18d7 Add -b / --binary option for Windows 2019-03-24 23:23:16 -05:00
Nicolas Williams 3e0a118886 Allow .["foo"].["bar"] 2019-03-24 23:23:16 -05:00
Nicolas Williams c72ed135e4 Allow keywords in more places (fix #1868) 2019-03-24 23:19:09 -05:00
Muh Muhten 3ea0199e03 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.
2019-02-26 22:39:57 -06:00
Muh Muhten abed751e96 Bind libraries backward for consistent shadowing 2019-02-26 21:57:08 -06:00
Muh Muhten 141bb78e96 Fix regression on ~/.jq being a directory 2019-02-26 21:57:08 -06:00
Muh Muhten 30afc86af1 Fix alpine build 2019-02-26 21:40:59 -06:00
Nicolas Williams 6df393c902 Make shtest verbose 2 diag. alpine build failure
Temporarily(?) make tests/shtest verbose to help diagnose Travis alpine
build failures.
2019-02-26 11:17:20 -06:00
William Langford f951d0241c 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.
2019-02-26 11:10:38 -06:00
William Langford cc724f105d Configure appveyor build to use python 2019-02-26 11:10:38 -06:00
William Langford a4756fde3f Cleanup leftover references to ruby 2019-02-26 11:10:38 -06:00
William Langford 15be4e7915 Configure travis build to use python 2019-02-26 11:10:38 -06:00
William Langford 53a3f47076 Remove ruby dependency from mantests 2019-02-26 11:10:38 -06:00
William Langford 175dbc4e25 Remove ruby dependency from manpage build 2019-02-26 11:10:38 -06:00
William Langford c1f11855e3 Remove ruby dependency from website build 2019-02-26 11:10:38 -06:00
Muh Muhten 76e72a301d Simplify and optimize SQLish builtins 2019-02-26 11:05:25 -06:00
Muh Muhten a1626adb7e Fix bizarre bsearch/1 behaviour with a stream argument 2019-02-26 11:05:25 -06:00
Muh Muhten d1a07cbdc1 Make tostream much more efficient
(`path(.[])` is a streaming `keys`!)
2019-02-26 11:05:25 -06:00
Muh Muhten 8c1e7175ec Reimplement fromstream/1 more compactly 2019-02-26 11:05:25 -06:00
Muh Muhten fc6df0fdc1 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.
2019-02-26 11:05:25 -06:00
Muh Muhten 78271b179a Simplify type-select builtins 2019-02-26 11:05:25 -06:00
Muh Muhten d3abe3a468 Add more tests for any and all 2019-02-26 11:05:25 -06:00
Muh Muhten 41b859325b Redefine isempty/1, and the all and any series
Fixes the bug where all and any evaluate one more item than needed.
2019-02-26 11:05:25 -06:00
Muh Muhten 6a0bdf6063 Remove scalars_or_empty 2019-02-26 11:05:25 -06:00
Muh Muhten 36c250a03d No need to block_drop_unreferenced after builtins
(The correctness of this change is more obvious after the rename.)
2019-02-26 10:49:08 -06:00
Muh Muhten 260879a5c3 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.
2019-02-26 10:49:08 -06:00
Muh Muhten 8537b93a43 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.
2019-02-26 10:49:08 -06:00
Nico Williams 9a0d5be790 Merge pull request #1837 from muhmuhten/limit_0 2019-02-21 08:17:41 -06:00
Muh Muhten 130152a2ac Ensure limit(0; ...) is empty 2019-02-21 04:11:41 -05:00
Muh Muhten 730c730940 Rewrite _assign/2 using $argument syntax 2019-02-20 20:12:52 -06:00
Muh Muhten 85caac4473 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
2019-02-20 20:12:52 -06:00
Nicolas Williams 048acee39b Fix if-then-else example formatting 2019-02-20 20:03:26 -06:00