Slice the output starting with the index for "{" before parsing it as JSON #632

Closed
davidk01 wants to merge 1 commits from (deleted):json-parsing-error-fix into main
First-time contributor

The output for some reason now contains "Acquiring lock with timeout" which throws an exception when parsed as JSON. This change trims the output by finding the first occurrence of the opening curly brace for the JSON payload so that it can be properly parsed as JSON.

The output for some reason now contains "Acquiring lock with timeout" which throws an exception when parsed as JSON. This change trims the output by finding the first occurrence of the opening curly brace for the JSON payload so that it can be properly parsed as JSON.
davidk01 added 1 commit 2023-01-25 12:55:17 +00:00
504de98f15 Slice the output starting with the index for "{" before parsing it as JSON
The output for some reason now contains "Acquiring lock with timeout" throws an exception when parsed as JSON. This change trims the output by finding the first occurrence of the opening curly brace for the JSON payload so that it can be properly parsed as JSON.
Owner

I appreciate you taking the time to diagnose this and make the PR! Before merging though, I'd like to understand a little more about what's going on. A few thoughts/questions:

  • What versions of borgmatic and Borg are you using?
  • Could you include the exact text of the message here? I'm not seeing an "Acquiring lock with timeout" message in the Borg source code, although it's possible I'm not searching correctly.
  • borgmatic is supposed to suppress Borg info/debug log messages when --json is specified to prevent exactly the sort of problem you're experiencing here. So that's why I'm interested in where this log message is coming from.. it should already be suppressed!

Also, I generally like to see unit test updates with PRs as well. But if you don't want to take a stab at that for this one, please let me know.

Thanks!

I appreciate you taking the time to diagnose this and make the PR! Before merging though, I'd like to understand a little more about what's going on. A few thoughts/questions: * What versions of borgmatic and Borg are you using? * Could you include the exact text of the message here? I'm not seeing an "Acquiring lock with timeout" message in the Borg source code, although it's possible I'm not searching correctly. * borgmatic is supposed to suppress Borg info/debug log messages when `--json` is specified to prevent exactly the sort of problem you're experiencing here. So that's why I'm interested in where this log message is coming from.. it should already be suppressed! Also, I generally like to see unit test updates with PRs as well. But if you don't want to take a stab at that for this one, please let me know. Thanks!
Author
First-time contributor

Actually, it looks like this is my doing. I was debugging an issue with an upgrade and added some print statement that I forgot to get rid of. This PR can be closed.

Actually, it looks like this is my doing. I was debugging an issue with an upgrade and added some print statement that I forgot to get rid of. This PR can be closed.
davidk01 closed this pull request 2023-01-29 23:08:49 +00:00
Owner

Sounds good. I'm glad it's working for you now!

Sounds good. I'm glad it's working for you now!

Pull request closed

Sign in to join this conversation.
No reviewers
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#632
No description provided.