Jq: Bug: slurp command with no newlines doesn't work in jq 1.5 (worked fine in 1.3)

Created on 25 Sep 2017  路  4Comments  路  Source: stedolan/jq

Using latest version of jq from github (along with v1.5 installed in ubuntu 17.04):

The following command result in incorrect output:

Command:
echo -n '{"b": {"c": 3}, "a": 2}{"b": {"e": 4}, "d": 3}' | jq -s '.'

Output:

[
  {
    "b": {
      "c": 3
    },
    "a": 2
  }
]
{
  "b": {
    "e": 4
  },
  "d": 3
}

on the other hand if use "echo" rather than"echo -n" the results are as expected:

Command:
echo '{"b": {"c": 3}, "a": 2}{"b": {"e": 4}, "d": 3}' | jq -s '.'

Output:

[
  {
    "b": {
      "c": 3
    },
    "a": 2
  },
  {
    "b": {
      "e": 4
    },
    "d": 3
  }
]

I have tested both above commands with jq 1.3 and both "echo" and "echo -n" work fine. so there has been a regression from 1.3 to 1.5.

Most helpful comment

Seeing this too on v1.5.

> echo -n '{"a": 1} {"b": 2} {"c": 3}' | jq -s .
[
  {
    "a": 1
  }
]
{
  "b": 2
}
{
  "c": 3
}

All 4 comments

Seeing this too on v1.5.

> echo -n '{"a": 1} {"b": 2} {"c": 3}' | jq -s .
[
  {
    "a": 1
  }
]
{
  "b": 2
}
{
  "c": 3
}

Bisected: 0d414471bb41f41373754c680ecc7f955a9ec2ad introduces the regression

Just to be clear, the problem was fixed after the release of jq 1.5, and it seems to have stayed fixed -- using the current "master":

$ echo -n '{"a": 1} {"b": 2} {"c": 3}' | jq -s .
[
  {
    "a": 1
  },
  {
    "b": 2
  },
  {
    "c": 3
  }
]

You're right; it looks like the fix for #1534 fixed this as well (in f06deb828a318536b85d68280d429c3a70b21259). I guess this can be closed then, if someone who has the ability to do so can.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thelonious picture thelonious  路  4Comments

ghost picture ghost  路  4Comments

sloanlance picture sloanlance  路  3Comments

neowulf picture neowulf  路  3Comments

tischwa picture tischwa  路  4Comments