Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON output of rfkill is broken #1339

Closed
phijor opened this issue Jun 7, 2021 · 2 comments
Closed

JSON output of rfkill is broken #1339

phijor opened this issue Jun 7, 2021 · 2 comments

Comments

@phijor
Copy link

phijor commented Jun 7, 2021

Since v2.37, running rfkill -J produces invalid JSON output:

$ rfkill -J
{
   [
      {
         "id": 0,
         "type": "bluetooth",
         "device": "tpacpi_bluetooth_sw",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 1,
         "type": "wlan",
         "device": "phy0",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 2,
         "type": "bluetooth",
         "device": "hci0",
         "soft": "unblocked",
         "hard": "unblocked"
      }
   ]
}

Not how the outer object contains a bare array ({[...]}) and not a key-value pair.

Bisecting the issue between v2.36 and v2.37, 618a6cc seems to be the culprit.

The bisect-log:
# bad: [50736e4998fde0fff9b7876476137a21b85bd5a6] build-sys: release++ (v2.37)
# good: [c8b8326b070b00b835f163cbed3c8051081f4011] build-sys: release++ (v2.36)
git bisect start 'v2.37' 'v2.36'
# bad: [eba9ef598fd9fb9687e322a31b3396461320e7ef] libmount: don't use deprecated security_context_t
git bisect bad eba9ef598fd9fb9687e322a31b3396461320e7ef
# good: [062e6a39451622cce9fa89f26ee848b0dddb10d3] whereis: extend test case
git bisect good 062e6a39451622cce9fa89f26ee848b0dddb10d3
# bad: [05b9c556f688eb7f2dc982e9088e778c6eea5f49] lscpu: fix MHZ parsing
git bisect bad 05b9c556f688eb7f2dc982e9088e778c6eea5f49
# bad: [314aa95fd51ffb2bc72ad64fe41f85d4b8f82386] lscpu: add lscpu_read_topolgy_ids()
git bisect bad 314aa95fd51ffb2bc72ad64fe41f85d4b8f82386
# good: [ab5d18e973fdfaa802a5486b72b55c139c69bd42] tests: (ul) remove another 'dim' input
git bisect good ab5d18e973fdfaa802a5486b72b55c139c69bd42
# bad: [cbf8f1297bebc33b9155e5a5826e8c2b783a9e80] lscpu: (cputype) add header file, cleanup patterns code
git bisect bad cbf8f1297bebc33b9155e5a5826e8c2b783a9e80
# bad: [618a6ccbfd41d4ad3864eecab3d7d5091314d53e] libsmartcols: use lib/jsonwrt.c for JSON
git bisect bad 618a6ccbfd41d4ad3864eecab3d7d5091314d53e
# good: [3fbeb9eeb86a04283e38ee9272a7726e7fbb8de9] libblkid: fix time_t handling
git bisect good 3fbeb9eeb86a04283e38ee9272a7726e7fbb8de9
# good: [32d81aff5beb53354d0235d4e378698f6770465a] Merge branch 'libblkid' of https://github.com/ferivoz/util-linux
git bisect good 32d81aff5beb53354d0235d4e378698f6770465a
# good: [37bcd05602760c0bd0d063c43e346f4343834c6b] lib/jsonwrt: add new functions to write in JSON
git bisect good 37bcd05602760c0bd0d063c43e346f4343834c6b
# first bad commit: [618a6ccbfd41d4ad3864eecab3d7d5091314d53e] libsmartcols: use lib/jsonwrt.c for JSON
karelzak added a commit that referenced this issue Jun 7, 2021
The bare array ({[...]}) for top level list of entries is invalid. It
seems better to print empty string than nothing. This is workaround
for broken utils, better is to define a table name.

Addresses: #1339
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzak
Copy link
Collaborator

karelzak commented Jun 7, 2021

Thanks for your report.

@phijor
Copy link
Author

phijor commented Jun 7, 2021

Thank you for your fast response! I can confirm that rfkill -J now produces valid output again :)

karelzak added a commit that referenced this issue Jul 20, 2021
The bare array ({[...]}) for top level list of entries is invalid. It
seems better to print empty string than nothing. This is workaround
for broken utils, better is to define a table name.

Addresses: #1339
Signed-off-by: Karel Zak <kzak@redhat.com>
karelzak pushed a commit that referenced this issue Jul 20, 2021
[kzak@redhat.com: - s/rfkill/rfkilldevices/]

Fixes: #1339
Signed-off-by: Nicolai Dagestad <nicolai@dagestad.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants