borgmatic list --json doesn't output valid json #276

Closed
opened 2020-01-04 20:57:16 +00:00 by varac · 3 comments

What I'm trying to do and why

I want to parse the output of borgmatic list --json.

Steps to reproduce (if a bug)

borgmatic list --json

Actual behavior (if a bug)

  • borgmatic list --json | jq . gives parse error: Invalid numeric literal at line 1, column 860
  • borgmatic list --json | cat -A shows "}}]^[[0m at the end

Expected behavior (if a bug)

borgmatic list --json should output valid json

Environment

borgmatic version: 1.4.21
borgmatic installation method: installed as python package using pipx
Borg version: 1.1.10-2 (installed as debian package)
Python version: 3.7.5
operating system and version: Ubuntu 19.10

Etc

While creating this issue I realized that downgrading to 1.4.15 fixes this.
So it's some kind of regression between 1.4.15 and 1.4.21

#### What I'm trying to do and why I want to parse the output of `borgmatic list --json`. #### Steps to reproduce (if a bug) `borgmatic list --json` #### Actual behavior (if a bug) * `borgmatic list --json | jq .` gives `parse error: Invalid numeric literal at line 1, column 860` * `borgmatic list --json | cat -A` shows `"}}]^[[0m` at the end #### Expected behavior (if a bug) `borgmatic list --json` should output valid json #### Environment **borgmatic version:** 1.4.21 **borgmatic installation method:** installed as python package using pipx **Borg version:** 1.1.10-2 (installed as debian package) **Python version:** 3.7.5 **operating system and version:** Ubuntu 19.10 #### Etc While creating this issue I realized that downgrading to 1.4.15 fixes this. So it's some kind of regression between 1.4.15 and 1.4.21
Owner

Thanks for reporting this, and for including the helpful reproduction steps! I'm able to see the exact same behavior on my system.

Thanks for reporting this, and for including the helpful reproduction steps! I'm able to see the exact same behavior on my system.
witten added the
bug
label 2020-01-04 21:57:30 +00:00
Owner

This is fixed in master! The problem was that the coloring of log output was screwing with the JSON. Now, using --json automatically disables colored output. I'll post an update here when this fix is released. Thanks again.

This is fixed in master! The problem was that the coloring of log output was screwing with the JSON. Now, using `--json` automatically disables colored output. I'll post an update here when this fix is released. Thanks again.
Owner

Okay, this is now released in borgmatic 1.4.22!

Okay, this is now released in borgmatic 1.4.22!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#276
No description provided.