bug sfdisk parcer
See original GitHub issueHI! I tried the parser on two operating systems : Debian 10 and CentOS 8.
If I specify sfdisk -l /dev/sda1 | jc --sfdisk , the output is : [{“disk”:“/dev/sda1”,“cylinders”:1,“units”:“sectors of 1 * 512 = 512 bytes”}]
But, if I want to get information on the entire sdc drive, I get a parser error :
sfdisk -l /dev/sda | jc --sfdisk -dd :
Traceback (most recent call last):
File "/usr/local/bin/jc", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/jc/cli.py", line 618, in main
result = parser.parse(data, raw=raw, quiet=quiet)
File "/usr/local/lib/python3.8/site-packages/jc/parsers/sfdisk.py", line 296, in parse
item['heads'] = line.split()[4]
IndexError: list index out of range
.... sfdisk.py in parse(data='Disk /dev/sda: 32 GiB, 34359738368 bytes, 671088... 2099200 67108863 65009664 31G 8e Linux LVM\n', raw=False, quiet=False)
If I comment out 2 lines ::
296 # item[‘heads’] = line.split()[4] 297 # item[‘sectors_per_track’] = line.split()[6]
I have this result : [{“disk”:“/dev/sda”,“cylinders”:32,“units”:“sectors of 1 * 512 = 512 bytes”},{“disk”:“identifier”,“cylinders”:57705}]
If my normal sfdisk output here:
# sfdisk -l /dev/sda
Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5fac7705
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 67108863 65009664 31G 8e Linux LVM
That is, all drive information is not displayed. I would also like to ask for support for the -F flag, I often use it to get information about disk resizing.
Thanx
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Replication of libfdisk script parsing bug on stock Xubuntu ...
Created a new partition 1 of type 'EFI System' and of size 260 MiB. 3934: libfdisk: ASK: [0x6c8f20]: do_ask done [rc=0]. 3934 ...
Read more >Fdisk Error Message - Unix & Linux Stack Exchange
After this i went to fdisk and created it again. I then went on to add a file system to this partition using...
Read more >fdisk: -w / --wipe is no longer honoured in ver 2.36
Bug #1005101: fdisk: -w / --wipe is no longer honoured in ver 2.36 ... previously (deb 10) used fdisk with --wipe=never option, ......
Read more >[PATCH/RFC] fdisk: read/parse/print GPT disklabels - BusyBox
Return an error if anything is out of place. + * Do not create an empty disklabel. This is used for the "list"...
Read more >1119045 – vgscan 'Parse error at byte 1587 (line 101)
The tools are complaining that an illegal token (character, word or other element) appeared in the LVM metadata read from the device. An...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I forgot to mention - I noticed there is now a
-J
JSON output option insfdisk
, which is great! Unfortunately, though, it is quite limited at the moment.Thank you very match !!! Work is very well!!! Great job!
And with flag -F: