From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 28 11:17:55 2018 Received: (at submit) by debbugs.gnu.org; 28 Jun 2018 15:17:55 +0000 Received: from localhost ([127.0.0.1]:38744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYYgE-0002qB-H5 for submit@debbugs.gnu.org; Thu, 28 Jun 2018 11:17:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57959) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYUlX-0002UI-Vw for submit@debbugs.gnu.org; Thu, 28 Jun 2018 07:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYUlR-000250-Ni for submit@debbugs.gnu.org; Thu, 28 Jun 2018 07:07:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=BAYES_20, RECEIVED_FROM_WINDOWS_HOST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fYUlR-00024Z-KV for submit@debbugs.gnu.org; Thu, 28 Jun 2018 07:07:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYUlQ-0002pO-AY for bug-parted@gnu.org; Thu, 28 Jun 2018 07:07:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYUlL-0001qD-TQ for bug-parted@gnu.org; Thu, 28 Jun 2018 07:06:59 -0400 Received: from nat.cjt.de ([109.109.203.211]:15789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fYUlL-0001hG-Mb for bug-parted@gnu.org; Thu, 28 Jun 2018 07:06:55 -0400 Received: from Calw.cjt.lokal (10.10.1.4) by Calw.cjt.lokal (10.10.1.4) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Thu, 28 Jun 2018 12:36:46 +0200 Received: from Calw.cjt.lokal ([fe80::f9a1:4e4a:7716:2ad6]) by Calw.cjt.lokal ([fe80::f9a1:4e4a:7716:2ad6%12]) with mapi id 15.00.1263.000; Thu, 28 Jun 2018 12:36:46 +0200 From: Hans-Joachim Baader To: "bug-parted@gnu.org" Subject: Support for WinRe partition Thread-Topic: Support for WinRe partition Thread-Index: AQHUDsvpm4p1lMv2EU+aN4f+8mDg/Q== Date: Thu, 28 Jun 2018 10:36:45 +0000 Message-ID: <24e5ed09511541e5abbe1a089b4db10c@Calw.cjt.lokal> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.10.10.111] x-tm-as-product-ver: SMEX-11.1.0.1239-8.200.1013-23934.004 x-tm-as-result: No--2.681700-5.000000-31 x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 28 Jun 2018 11:17:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hello maintainers, Windows 10 uses a recovery partition which is sometimes marked with partition type 0x27 on MBR systems. I don't know why some vendors use MBR rather than GPT, but it's a fact. 0x27 is in fact defined as Windows RE hidden partition (see https://www.win.tue.nl/~aeb/partitions/partition_types-1.html). I haven't found a way to create a partition with this ID in parted. I used parted 3.2 which is 4 years old but I don't think is has been changed in Git. For example when I create a NTFS partition and do set 3 hidden on I get ID 0x17. Perhaps a new flag is needed, e.g. set 3 winre on Do you think that parted should support that? Perhaps I could contribute a patch if it's not supported yet. Best regards, Hans-Joachim Baader From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 19 18:33:31 2018 Received: (at 31994) by debbugs.gnu.org; 19 Jul 2018 22:33:31 +0000 Received: from localhost ([127.0.0.1]:48614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fgHUJ-0003PB-Iy for submit@debbugs.gnu.org; Thu, 19 Jul 2018 18:33:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fgHUI-0003Oy-7m for 31994@debbugs.gnu.org; Thu, 19 Jul 2018 18:33:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEA95C057F82; Thu, 19 Jul 2018 22:33:24 +0000 (UTC) Received: from lister.brianlane.com (ovpn-112-35.phx2.redhat.com [10.3.112.35]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E07860851; Thu, 19 Jul 2018 22:33:23 +0000 (UTC) Date: Thu, 19 Jul 2018 15:33:21 -0700 From: "Brian C. Lane" To: Hans-Joachim Baader Subject: Re: bug#31994: Support for WinRe partition Message-ID: <20180719223321.GE4427@lister.brianlane.com> References: <24e5ed09511541e5abbe1a089b4db10c@Calw.cjt.lokal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24e5ed09511541e5abbe1a089b4db10c@Calw.cjt.lokal> User-Agent: Mutt/1.10.0 (2018-05-17) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 19 Jul 2018 22:33:24 +0000 (UTC) X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31994 Cc: 31994@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Thu, Jun 28, 2018 at 10:36:45AM +0000, Hans-Joachim Baader wrote: > Hello maintainers, > > Windows 10 uses a recovery partition which is sometimes marked with > partition type 0x27 on MBR systems. I don't know why some vendors > use MBR rather than GPT, but it's a fact. > > 0x27 is in fact defined as Windows RE hidden partition (see > https://www.win.tue.nl/~aeb/partitions/partition_types-1.html). > > I haven't found a way to create a partition with this ID in parted. I used > parted 3.2 which is 4 years old but I don't think is has been changed > in Git. For example when I create a NTFS partition and do > > set 3 hidden on > > I get ID 0x17. Perhaps a new flag is needed, e.g. > > set 3 winre on > > Do you think that parted should support that? Perhaps I could contribute > a patch if it's not supported yet. It looks like we know about it internally, PARTITION_MSFT_RECOVERY, but it isn't hooked up to a flag type. It is displayed as diag, but using diag sets it to 0x12 (COMPAQ_DIAG). It would probably be a good thing to separate that out. We already have a msftres that's only used on GPT so I think it makes sense to hook that command up to 0x27 on MBR. That also means no changes to the list of PED_PARTITION_* flags. If you'd like to try patching it that would be great, thanks! -- Brian C. Lane (PST8PDT) From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 14 10:21:40 2019 Received: (at 31994) by debbugs.gnu.org; 14 Jan 2019 15:21:40 +0000 Received: from localhost ([127.0.0.1]:59207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gj43W-0006qB-4G for submit@debbugs.gnu.org; Mon, 14 Jan 2019 10:21:38 -0500 Received: from nat.cjt.de ([109.109.203.211]:53348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gj43S-0006py-MM for 31994@debbugs.gnu.org; Mon, 14 Jan 2019 10:21:36 -0500 Received: from Calw.cjt.lokal (10.10.1.4) by Calw.cjt.lokal (10.10.1.4) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 14 Jan 2019 16:21:30 +0100 Received: from Calw.cjt.lokal ([fe80::f9a1:4e4a:7716:2ad6]) by Calw.cjt.lokal ([fe80::f9a1:4e4a:7716:2ad6%12]) with mapi id 15.00.1263.000; Mon, 14 Jan 2019 16:21:30 +0100 From: Hans-Joachim Baader To: "Brian C. Lane" Subject: Re: bug#31994: Support for WinRe partition Thread-Topic: bug#31994: Support for WinRe partition Thread-Index: AQHUDsvpm4p1lMv2EU+aN4f+8mDg/aSXId+AgRj4Jiw= Date: Mon, 14 Jan 2019 15:21:30 +0000 Message-ID: <6376718b6d8740209224ae61bf86861b@Calw.cjt.lokal> References: <24e5ed09511541e5abbe1a089b4db10c@Calw.cjt.lokal>, <20180719223321.GE4427@lister.brianlane.com> In-Reply-To: <20180719223321.GE4427@lister.brianlane.com> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [80.146.228.68] x-tm-as-product-ver: SMEX-11.7.0.1024-8.200.1013-24362.004 x-tm-as-result: No--7.954100-5.000000-31 x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31994 Cc: "31994@debbugs.gnu.org" <31994@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello maintainers, finally I found the time to complete a patch. If I have to sign a copyright= assignment it will take some more time. I have amended the documentation and ran the tests. The existing tests cove= red the flag already so I didn't write a new test. Also I had to patch libparted/unit.c to make it compile (Debian 9, GCC 6.3)= : diff --git a/libparted/unit.c b/libparted/unit.c index e47e868..84ba8c4 100644 --- a/libparted/unit.c +++ b/libparted/unit.c @@ -151,6 +151,7 @@ ped_unit_get_size (const PedDevice* dev, PedUnit unit) * * For example, the textual representation of PED_UNIT_SECTOR is "s". */ +__attribute__ ((const)) const char* ped_unit_get_name (PedUnit unit) { Here's the patch. Best regards, Hans-Joachim Baader >From e20005b1889a51b479c62a176a3e75f5af30d696 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Baader Date: Mon, 14 Jan 2019 16:01:07 +0100 Subject: [PATCH] Added support for Windows recovery partition (WINRE) on MB= R Windows 10 uses a recovery partition which is sometimes marked with partition type 0x27 on MBR systems. It wasn't possible to handle such a partition with parted. Therefore the partition type PARTITION_MSFT_RECOVE= RY is now used properly also on MBR when the flag msftres is set. --- doc/C/parted.8 | 2 +- doc/parted.texi | 4 ++-- libparted/labels/dos.c | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/doc/C/parted.8 b/doc/C/parted.8 index fecdc29..15932c2 100644 --- a/doc/C/parted.8 +++ b/doc/C/parted.8 @@ -112,7 +112,7 @@ or an LVM logical volume if necessary. .B set \fIpartition\fP \fIflag\fP \fIstate\fP Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba= ", -"legacy_boot", "irst", "esp" and "palo". +"legacy_boot", "irst", "msftres", "esp" and "palo". \fIstate\fP should be either "on" or "off". .TP .B unit \fIunit\fP diff --git a/doc/parted.texi b/doc/parted.texi index c08cdc7..98dc162 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -861,8 +861,8 @@ flag can only be removed within parted by replacing it = with a competing flag, such as boot or msftres. =20 @item msftres -(GPT) - This flag identifies a "Microsoft Reserved" partition, which is -used by Windows on GPT disks. Note that this flag should not normally be +(MS-DOS,GPT) - This flag identifies a "Microsoft Reserved" partition, whic= h +is used by Windows. Note that this flag should not normally be set on Windows filesystem partitions (those that contain NTFS or FAT filesystems). =20 diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index b2b8de9..d736b9e 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -156,6 +156,7 @@ typedef struct { unsigned char system; int boot; int hidden; + int msftres; int raid; int lvm; int lba; @@ -949,8 +950,8 @@ raw_part_parse (const PedDisk* disk, const DosRawPartit= ion* raw_part, dos_data->system =3D raw_part->type; dos_data->boot =3D raw_part->boot_ind !=3D 0; dos_data->diag =3D raw_part->type =3D=3D PARTITION_COMPAQ_DIAG || - raw_part->type =3D=3D PARTITION_MSFT_RECOVERY || raw_part->type =3D=3D PARTITION_DELL_DIAG; + dos_data->msftres =3D raw_part->type =3D=3D PARTITION_MSFT_RECOVERY; dos_data->hidden =3D raw_part_is_hidden (raw_part); dos_data->raid =3D raw_part->type =3D=3D PARTITION_LINUX_RAID; dos_data->lvm =3D raw_part->type =3D=3D PARTITION_LINUX_LVM_OLD @@ -1345,6 +1346,7 @@ msdos_partition_new (const PedDisk* disk, PedPartitio= nType part_type, dos_data->orig =3D NULL; dos_data->system =3D PARTITION_LINUX; dos_data->hidden =3D 0; + dos_data->msftres =3D 0; dos_data->boot =3D 0; dos_data->diag =3D 0; dos_data->raid =3D 0; @@ -1384,6 +1386,7 @@ msdos_partition_duplicate (const PedPartition* part) new_dos_data->boot =3D old_dos_data->boot; new_dos_data->diag =3D old_dos_data->diag; new_dos_data->hidden =3D old_dos_data->hidden; + new_dos_data->msftres =3D old_dos_data->msftres; new_dos_data->raid =3D old_dos_data->raid; new_dos_data->lvm =3D old_dos_data->lvm; new_dos_data->lba =3D old_dos_data->lba; @@ -1433,6 +1436,11 @@ msdos_partition_set_system (PedPartition* part, && strcmp (fs_type->name, "ntfs") !=3D 0) dos_data->hidden =3D 0; =20 + if (dos_data->msftres + && fs_type + && strcmp (fs_type->name, "ntfs") !=3D 0) + dos_data->msftres =3D 0; + if (part->type & PED_PARTITION_EXTENDED) { dos_data->diag =3D 0; dos_data->raid =3D 0; @@ -1452,11 +1460,14 @@ msdos_partition_set_system (PedPartition* part, /* Don't change the system if it already is a diag type, otherwise use Compaq as almost all vendors use that. */ if (dos_data->system !=3D PARTITION_COMPAQ_DIAG && - dos_data->system !=3D PARTITION_MSFT_RECOVERY && dos_data->system !=3D PARTITION_DELL_DIAG) dos_data->system =3D PARTITION_COMPAQ_DIAG; return 1; } + if (dos_data->msftres) { + dos_data->system =3D PARTITION_MSFT_RECOVERY; + return 1; + } if (dos_data->lvm) { dos_data->system =3D PARTITION_LINUX_LVM; return 1; @@ -1516,6 +1527,7 @@ clear_flags (DosPartitionData *dos_data) { dos_data->diag =3D 0; dos_data->hidden =3D 0; + dos_data->msftres =3D 0; dos_data->lvm =3D 0; dos_data->palo =3D 0; dos_data->prep =3D 0; @@ -1552,6 +1564,18 @@ msdos_partition_set_flag (PedPartition* part, dos_data->hidden =3D state; return ped_partition_set_system (part, part->fs_type); =20 + case PED_PARTITION_MSFT_RESERVED: + if (part->type =3D=3D PED_PARTITION_EXTENDED) { + ped_exception_throw ( + PED_EXCEPTION_ERROR, + PED_EXCEPTION_CANCEL, + _("Extended partitions cannot be recovery partitions on " + "msdos disk labels.")); + return 0; + } + dos_data->msftres =3D state; + return ped_partition_set_system (part, part->fs_type); + case PED_PARTITION_BOOT: dos_data->boot =3D state; if (!state) @@ -1632,6 +1656,12 @@ msdos_partition_get_flag (const PedPartition* part, = PedPartitionFlag flag) else return dos_data->hidden; =20 + case PED_PARTITION_MSFT_RESERVED: + if (part->type =3D=3D PED_PARTITION_EXTENDED) + return 0; + else + return dos_data->msftres; + case PED_PARTITION_BOOT: return dos_data->boot; =20 @@ -1675,6 +1705,12 @@ msdos_partition_is_flag_available (const PedPartitio= n* part, else return 1; =20 + case PED_PARTITION_MSFT_RESERVED: + if (part->type =3D=3D PED_PARTITION_EXTENDED) + return 0; + else + return 1; + case PED_PARTITION_BOOT: case PED_PARTITION_RAID: case PED_PARTITION_LVM: --=20 2.11.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 31 14:32:14 2019 Received: (at 31994-done) by debbugs.gnu.org; 31 Jan 2019 19:32:14 +0000 Received: from localhost ([127.0.0.1]:53358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gpI4M-0003Tk-23 for submit@debbugs.gnu.org; Thu, 31 Jan 2019 14:32:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gpI4I-0003TW-JO for 31994-done@debbugs.gnu.org; Thu, 31 Jan 2019 14:32:10 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E680F550BB; Thu, 31 Jan 2019 19:32:04 +0000 (UTC) Received: from lister.brianlane.com (ovpn-112-42.phx2.redhat.com [10.3.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54CE3608EB; Thu, 31 Jan 2019 19:32:04 +0000 (UTC) Date: Thu, 31 Jan 2019 11:32:01 -0800 From: "Brian C. Lane" To: Hans-Joachim Baader Subject: Re: bug#31994: Support for WinRe partition Message-ID: <20190131193201.GC11492@lister.brianlane.com> References: <24e5ed09511541e5abbe1a089b4db10c@Calw.cjt.lokal> <20180719223321.GE4427@lister.brianlane.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180719223321.GE4427@lister.brianlane.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 31 Jan 2019 19:32:05 +0000 (UTC) X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31994-done Cc: 31994-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Thu, Jul 19, 2018 at 03:33:21PM -0700, Brian C. Lane wrote: > On Thu, Jun 28, 2018 at 10:36:45AM +0000, Hans-Joachim Baader wrote: > > Hello maintainers, > > > > Windows 10 uses a recovery partition which is sometimes marked with > > partition type 0x27 on MBR systems. I don't know why some vendors > > use MBR rather than GPT, but it's a fact. I've applied the msftres on msdos patch to master, thanks! I left out the debian specific patch for now, it doesn't seem to be necessary in my builds using gcc 9.0.1 on Fedora rawhide. -- Brian C. Lane (PST8PDT) From unknown Sat Jun 14 18:53:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 01 Mar 2019 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator