Bug#931087: fdisk/sfdisk: creates scripts that don't work

2019-07-28 Thread Matthias Urlichs
https://github.com/karelzak/util-linux/issues/830


-- 
-- Matthias Urlichs



Bug#931087: fdisk/sfdisk: creates scripts that don't work

2019-06-25 Thread Matthias Urlichs
Package: fdisk
Version: 2.33.1-0.1
Severity: important

I have created a GPT-partitioned image where the first partition
needs to start at block 64. The problem is that fdisk/sfdisk is unable to
replicate this partition layout using an sfdisk script, because the
generated script doesn't work when it's read back in.

This seems to be a problem with interpreting the "table-length" value.
It appears to be multiplied by 4 instead of divided by 4 when checking
sector limits.

# ls -l /tmp/bmb_root
-rw-r--r-- 1 smurf smurf 1170228224 Jun 25 22:16 /tmp/bmb_root
# bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free 
Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
1170228224/512-34
2285568

# cat /tmp/lb  ### minimum/maximum working LBA values
label: gpt
label-id: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C
device: /tmp/bmb_root
unit: sectors
table-length: 8
first-lba: 34
last-lba: 2285568

# sfdisk /tmp/bmb_root