GNU bug report logs -
#31111
Partition table wrongly identified as "atari"
Previous Next
Reported by: bouke_1 <bouke_1 <at> zonnet.nl>
Date: Mon, 9 Apr 2018 14:22:01 UTC
Severity: normal
Done: Phil Susi <psusi <at> ubuntu.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31111 in the body.
You can then email your comments to 31111 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Mon, 09 Apr 2018 14:22:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
bouke_1 <bouke_1 <at> zonnet.nl>
:
New bug report received and forwarded. Copy sent to
bug-parted <at> gnu.org
.
(Mon, 09 Apr 2018 14:22:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
After restoring an image using Clonezilla (which in turn uses sfdisk to
configure the partitions), parted identifies the partition table of my
harddisk as "Atari" and sees only one partition, while in fact it is a
valid msdos partition table with three NTFS partitions (boot, main and
restore). Other tools (e.g., fdisk) correctly identify an "msdos"
partition list. The disk contains a Windows 10 environment and that
boots and works correctly. So I have reason to believe that parted is
wrong (or the rest of the world is crazy, which is not impossible).
I ran parted from the Linux command line from a Clonezilla Live disk (on
a USB drive) which is based on debian zesty. The version of parted used
there is (of course) the latest stable, 3.2. I also tried gparted (which
uses libparted) in its latest stable live distribution, which gives the
same results.
Also, I restored the same Clonezilla image to another PC, again, with
the same results. These PC's are pretty standard, neither brand new nor
very old desktop boxes with a single 500GB disk.
The attachment shows a screenshot of the parted results together with
those of sfdisk (which is proof but does not provide too much
information). I also attached the extended parted output since it is
mandatory but I don't think it provides much.
Clonezilla uses parted to check the partition layout. When I restore the
image to a PC, I can use the PC normally but Clonezilla will not allow
me to write a new image from it. I think I will be able to work around
this, but it if this is a bug or quirk in parted it may merit some
attention.
I don't know how parted determines the partition table type, but there
must be something on the disk that makes it think it is Atari. If I can
help by providing e.g., a dump of the boot sector of the disk, or any
other data please let me know.
Bouke
[parted+fdisk_scrndmp.JPG (image/jpeg, attachment)]
[partedprintprintprint.JPG (image/jpeg, attachment)]
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Mon, 09 Apr 2018 15:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Some additional observations:
Browsing the bug list archive (which I probably should have done before
posting) I noticed that the support for Atari disks is implemented as a
patch on top of version 3.2
(http://lists.gnu.org/archive/html/bug-parted/2016-12/msg00004.html). No
wonder I could not find the term 'atari' in the parted 3.2 source :)
Looks like the function atari_probe may be fuddled by some coincidence?
<quote>
+/*
+ * The Atari disk label doesn't have any magic id
+ * so we must completely parse the layout to be sure
+ * we are really dealing with it.
+ */
</unquote>
Apparently, the version of parted in the Clonezilla distribution (and of
partedlib used in gparted) is patched (parted --version reports 3.2).
I don't have a full Linux system at hand so I can't compile from source
& depend on binary distributions.
Bouke
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Tue, 10 Apr 2018 12:00:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
I quickly looked through the atari_probe routine in the Atari patch
code, and I may have found the logic error. At the bottom:
} /* no XGM so try ICD */
+ else if (atr_part_valid (&table.icd_part[0], rs_hd_size)
+ && atr_part_known (&table.icd_part[0],
atr_known_icd_pid)) {
+ for (i = 1; i < N_ICD; i++) {
+ if (atr_part_trash (&table.icd_part[i],
rs_hd_size))
+ return 0;
+ }
+ }
+
+ return 1;
+ }
Correct me if I'm wrong (I know little about partitioning and less about
atari disks), but it looks if the partition (or whatever) does not check
out as "XGM" and either atr_part_valid or atr_part_known returns
false, the routine will return 1 (meaning: this checks out as an atari
disk).
In order to reach this part, only a few things need to check out (in the
top part of the routine): three id values need to be alphanumeric and a
couple of sizes need to be realistic (i.e., in my case, between 0 and
500G). That does not seem like something that can never happen by
coincidence for a non-atari disk.
I would guess it may be a good idea to add another "else return 0;" line
so that if the disk is neither "XGM" nor "ICD" (whatever that may mean),
it is not detected as atari disk.
I have the neither the stomach nor the means or the time to look into
this but if I can assist in any way please let me know.
Bouke
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Wed, 18 Apr 2018 15:08:02 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
For the record, let me add to this lonely conversation.
I tried to reproduce the problem in a simple way, by separating the
sfdisk command from the Clonezilla operation where it first appeared.
Clonezilla uses parted for information and sfdisk to configure the
partitions.
Starting with a functional Windows 10 system with three partitions I ran
some tests from the Clonezilla live distribution (parted says it is
version 3.2).
1.parted says I have an atari disk (even though it is a functional
Windows 10 system)
2.Instruct parted to create a new dos partition table
3.parted says I have an msdos disk with no partitions (as expected)
4.Run sfdisk with sda-pt.sf from the Clonezilla image as input
5.sfdisk creates three NTFS partitions on the disk (as expected)
6.parted says I have an atari disk with one partition
See the full log below. This reproduces on a bunch of PC's here (albeit,
identical ones), so my guess it that it should reproduce elsewere?
Bouke
// log
sudo parted /dev/sda print
Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: atari
Disk Flags:
Number Start End Size Type File system Flags
1 8323MB 14.8GB 6446MB primary boot
sudo parted -s /dev/sda mklabel msdos
sudo parted /dev/sda print
Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
sudo LC_ALL=C sfdisk --force /dev/sda
label: dos
label-id: 0x22a777ed
device: /dev/sda
unit: sectors
/dev/sda1 : start= 2048, size= 716800, type=17, bootable
/dev/sda2 : start= 718848, size= 975028224, type=7
/dev/sda3 : start= 975747072, size= 1024000, type=27
Checking that no-one is using this disk right now ... OK
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0xcb89b023
Old situation:
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x22a777ed.
/dev/sda1: Created a new partition 1 of type 'Hidden HPFS/NTFS' and of
size 350 MiB.
/dev/sda2: Created a new partition 2 of type 'HPFS/NTFS/exFAT' and of
size 465 GiB.
/dev/sda3: Created a new partition 3 of type 'Hidden NTFS WinRE' and of
size 500 MiB.
/dev/sda4: Done.
New situation:
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 718847 716800 350M 17 Hidden HPFS/NTFS
/dev/sda2 718848 975747071 975028224 465G 7 HPFS/NTFS/exFAT
/dev/sda3 975747072 976771071 1024000 500M 27 Hidden NTFS WinRE
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
sudo parted /dev/sda print
Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: atari
Disk Flags:
Number Start End Size Type File system Flags
1 8323MB 14.8GB 6446MB primary boot
// end
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Thu, 19 Apr 2018 15:18:02 GMT)
Full text and
rfc822 format available.
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
One final observation: the size of sda2 seems to be the one that
triggers the bug. If I change it from 9750281224 to 9750281222, the
problem goes away (i.e., parted no longer identifies my Partition Table
as Atari).
I rest my case.
Bouke
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Thu, 10 May 2018 17:54:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 31111 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 4/10/2018 7:59 AM, bouke_1 wrote:
> I quickly looked through the atari_probe routine in the Atari patch
> code, and I may have found the logic error. At the bottom:
>
> } /* no XGM so try ICD */
> + else if (atr_part_valid (&table.icd_part[0], rs_hd_size)
> + && atr_part_known (&table.icd_part[0],
> atr_known_icd_pid)) {
> + for (i = 1; i < N_ICD; i++) {
> + if (atr_part_trash (&table.icd_part[i],
> rs_hd_size))
> + return 0;
> + }
> + }
> +
> + return 1;
> + }
>
> Correct me if I'm wrong (I know little about partitioning and less about
> atari disks), but it looks if the partition (or whatever) does not check
> out as "XGM" and either atr_part_valid or atr_part_known returns
> false, the routine will return 1 (meaning: this checks out as an atari
> disk).
I'd say so. I can't reproduce the problem though by simply creating an
image file and making the partitions as you describe. Can you send your
whole MBR so I can try to reproduce it and see if fixing this logic
error fixes it?
[signature.asc (application/pgp-signature, attachment)]
Reply sent
to
Phil Susi <psusi <at> ubuntu.com>
:
You have taken responsibility.
(Thu, 10 May 2018 18:54:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
bouke_1 <bouke_1 <at> zonnet.nl>
:
bug acknowledged by developer.
(Thu, 10 May 2018 18:54:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 31111-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 5/10/2018 1:53 PM, Phil Susi wrote:
> I'd say so. I can't reproduce the problem though by simply creating an
> image file and making the partitions as you describe. Can you send your
> whole MBR so I can try to reproduce it and see if fixing this logic
> error fixes it?
Ok, after looking at the code it wasn't very hard to slap a few of the
right bytes into an empty file and trick atari_probe. I've fixed it
now. Will post the patch tomorrow. Thanks.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-parted <at> gnu.org
:
bug#31111
; Package
parted
.
(Fri, 11 May 2018 14:56:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 31111 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 5/10/2018 2:52 PM, Phil Susi wrote:
> Ok, after looking at the code it wasn't very hard to slap a few of the
> right bytes into an empty file and trick atari_probe. I've fixed it
> now. Will post the patch tomorrow. Thanks.
Nevermind; it wasn't a logical error. As long as at least one partition
has a plausible start and end value and 3 ASCII characters in the name
field, it is a valid atari table. I think I'll just move the atari
table to be probed last, after every other table has rejected it.
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 09 Jun 2018 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 316 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.