fdisk: off-by-one issue in (n)new command
Quoted 6 lines · Francesco Cosoleto
2012/1/12 Gerardo Exequiel Pozzi<[email protected]>:
Quoted 5 lines
I think I found two related bugs, steps to reproduce will be more clear than a description:
It is present in stable 2.20.1 and using latest git snapshot, and using any device/file as disk, using here a loop dev with a backing file of 256MiB just for example.
Quoted 8 lines
Fixed. Thank you for the report.
http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commit;h=0c381880282b9365aaf9e8457c69750c12c4d9b2
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thank you!
I will test it in few hours ;)
Signature · 2 lines
Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Quoted 11 lines · Gerardo Exequiel Pozzi
Quoted 10 lines · Francesco Cosoleto
2012/1/12 Gerardo Exequiel Pozzi<[email protected]>:
Quoted 5 lines
I think I found two related bugs, steps to reproduce will be more clear than a description:
It is present in stable 2.20.1 and using latest git snapshot, and using any device/file as disk, using here a loop dev with a backing file of 256MiB just for example.Fixed. Thank you for the report.
Quoted 9 lines
Quoted 5 lines
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlThank you!
I will test it in few hours ;)
Works fine (default value after out-of-range) :)
Still remains the other bug that does not allow to specify "last sector" that just fits the size in +sectors/+N(K|M|G).
Example:
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-524287, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +255M Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +261120K Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +522240 Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +522239 Partition 1 of type Linux and of size 255 MiB is set
Command (m for help): p
Disk /dev/vdb: 268 MB, 268435456 bytes
16 heads, 63 sectors/track, 520 cylinders, total 524288 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 Disk identifier: 0xbfd7539b
Device Boot Start End Blocks Id System /dev/vdb1 2048 524287 261120 83 Linux
Signature · 2 lines
Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Karel Zak
maintainerQuoted 2 lines · Gerardo Exequiel Pozzi
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +255M Value out of range.
The size of the device is 268435456 bytes,
+255M is relative to the begin of the partition, it means
(2048 * 512) + (255 * 1024 * 1024) = 268435456 bytes
but the begin of the last sector (in bytes) is
268435456 - 512 = 268434944 bytes (LBA sector 524287)
Right?
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 8 lines · Karel Zak
Quoted 2 lines · Gerardo Exequiel Pozzi
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +255M Value out of range.
The size of the device is 268435456 bytes,
+255M is relative to the begin of the partition, it means
(2048 * 512) + (255 * 1024 * 1024) = 268435456 bytes
Right.
Quoted 6 lines
but the begin of the last sector (in bytes) is
268435456 - 512 = 268434944 bytes (LBA sector 524287)Right?
Right.
From [2048, 524287] (all inclusive), so
(524287 - 2048 + 1) * 512 = 522240 and 522240 * 512 / 2**20 = 255
Indeed, when you say, for example, these sizes: p1 = +55M, p2 = +100M, and now try to set +100M to p3, is not posible, so accept the default value, and you can see that the size is equal to p2, that is right. So the issue appears when last sector is specified in +sectors or +size(K|M|G), only
Signature · 2 lines
Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
I wonder whether this is a preferred behavior:
Partition number (1-4, default 1): 5
Value 5 out of range, used 4.
First sector (2048-16383, default 2048): 1024
Value 1024 out of range, used 2048.
Last sector, +sectors or +size{K,M,G} (2048-16383, default 16383): +8M Value 18432 out of range, used 16383.
Partition 4 of type Linux and of size 7 MiB is set
Francesco
Quoted 10 lines · Francesco Cosoleto
I wonder whether this is a preferred behavior:
Partition number (1-4, default 1): 5
Value 5 out of range, used 4.
First sector (2048-16383, default 2048): 1024
Value 1024 out of range, used 2048.
Last sector, +sectors or +size{K,M,G} (2048-16383, default 16383): +8M Value 18432 out of range, used 16383.
Partition 4 of type Linux and of size 7 MiB is set
Quoted 6 lines
Francesco
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sounds good for me.
Signature · 2 lines
Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1