diff -Nru parted-3.2/debian/changelog parted-3.2/debian/changelog --- parted-3.2/debian/changelog 2018-10-18 18:00:56.000000000 -0400 +++ parted-3.2/debian/changelog 2019-03-14 13:05:58.000000000 -0400 @@ -1,3 +1,12 @@ +parted (3.2-20ubuntu0.2) bionic; urgency=medium + + * debian/patches/fix-windows-fat-recognition-after-resizing.patch: + Apply upstream patch to fix FAT resizing so that FAT filesystems which + are resized by libparted are recognizeable in Microsoft Windows. + (LP: #1820090) + + -- Thomas Ward Thu, 14 Mar 2019 13:05:58 -0400 + parted (3.2-20ubuntu0.1) bionic; urgency=medium * debian/patches/Read-NVMe-model-names-from-sysfs.patch: Expose NVMe diff -Nru parted-3.2/debian/control parted-3.2/debian/control --- parted-3.2/debian/control 2018-01-16 20:42:52.000000000 -0500 +++ parted-3.2/debian/control 2019-03-14 13:05:58.000000000 -0400 @@ -1,7 +1,8 @@ Source: parted Section: admin Priority: optional -Maintainer: Parted Maintainer Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Parted Maintainer Team Uploaders: Bastian Blank , Colin Watson Standards-Version: 3.9.8 Vcs-Git: https://anonscm.debian.org/git/parted/debian/parted.git diff -Nru parted-3.2/debian/patches/fix-windows-fat-recognition-after-resizing.patch parted-3.2/debian/patches/fix-windows-fat-recognition-after-resizing.patch --- parted-3.2/debian/patches/fix-windows-fat-recognition-after-resizing.patch 1969-12-31 19:00:00.000000000 -0500 +++ parted-3.2/debian/patches/fix-windows-fat-recognition-after-resizing.patch 2019-03-14 13:05:54.000000000 -0400 @@ -0,0 +1,92 @@ +Origin: upstream, http://git.savannah.gnu.org/cgit/parted.git/patch/?id=c0d394abac4d6d2ce35c98585b6ecb33aea48583 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1820090 +From: Curtis Gedak +Date: Sun, 10 Apr 2016 11:38:41 -0600 +Subject: lib-fs-resize: Fix recognition of FAT file system after resizing + +When resizing a FAT partition, an extra boot_sector memory allocation +was causing the original boot_sector information to be lost. The +resulting FAT file system was still recognized by GNU/Linux, but not +recognized by the proprietary Windows operating system. + +The problem with Windows FAT32 recognition was introduced with: + + Fix filesystem detection on non 512 byte sectors + 80678bdd957cf49a9ccfc8b88ba3fb8b4c63fc12 + +Fix by removing the extra boot_sector memory allocation. + +Note that since parted-3.0 another code path to the extra memory +allocation of fat_create(...) via ped_file_system_create(...) is +inaccessible. In an effort to maintain the ability to re-instate the +code, add a new boot_sector memory allocation where it is needed in +the alternate code path. + +GNU bug report logs - #22266 +[libparted] jump instruction and boot code is corrupted with random +bytes after fat is resized +http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22266 +--- + libparted/fs/r/fat/bootsector.c | 9 +++++++-- + libparted/fs/r/fat/bootsector.h | 2 +- + libparted/fs/r/fat/fat.c | 2 +- + 3 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c +index 1d2b601..99d788d 100644 +--- a/libparted/fs/r/fat/bootsector.c ++++ b/libparted/fs/r/fat/bootsector.c +@@ -281,8 +281,13 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs) + + #ifndef DISCOVER_ONLY + int +-fat_boot_sector_set_boot_code (FatBootSector* bs) ++fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs) + { ++ FatSpecific* fs_info = FAT_SPECIFIC (fs); ++ ++ PED_ASSERT (bsp != NULL); ++ *bsp = ped_malloc (fs->geom->dev->sector_size); ++ FatBootSector *bs = *bsp; + PED_ASSERT (bs != NULL); + + memset (bs, 0, 512); +@@ -297,8 +302,8 @@ fat_boot_sector_generate (FatBootSector** bsp, const PedFileSystem* fs) + FatSpecific* fs_info = FAT_SPECIFIC (fs); + + PED_ASSERT (bsp != NULL); +- *bsp = ped_malloc (fs->geom->dev->sector_size); + FatBootSector *bs = *bsp; ++ PED_ASSERT (bs != NULL); + + memcpy (bs->system_id, "MSWIN4.1", 8); + bs->sector_size = PED_CPU_TO_LE16 (fs_info->logical_sector_size * 512); +diff --git a/libparted/fs/r/fat/bootsector.h b/libparted/fs/r/fat/bootsector.h +index e92842c..3f84d7f 100644 +--- a/libparted/fs/r/fat/bootsector.h ++++ b/libparted/fs/r/fat/bootsector.h +@@ -120,7 +120,7 @@ int fat_boot_sector_read (FatBootSector** bs, const PedGeometry* geom); + FatType fat_boot_sector_probe_type (const FatBootSector* bs, + const PedGeometry* geom); + int fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs); +-int fat_boot_sector_set_boot_code (FatBootSector* bs); ++int fat_boot_sector_set_boot_code (FatBootSector** bs, const PedFileSystem* fs); + int fat_boot_sector_generate (FatBootSector** bs, const PedFileSystem* fs); + int fat_boot_sector_write (const FatBootSector* bs, PedFileSystem* fs); + +diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c +index 4ecf5c5..444668d 100644 +--- a/libparted/fs/r/fat/fat.c ++++ b/libparted/fs/r/fat/fat.c +@@ -310,7 +310,7 @@ fat_create (PedGeometry* geom, FatType fat_type, PedTimer* timer) + + fs_info->serial_number = generate_random_uint32 (); + +- if (!fat_boot_sector_set_boot_code (fs_info->boot_sector)) ++ if (!fat_boot_sector_set_boot_code (&fs_info->boot_sector, fs)) + goto error_free_buffers; + if (!fat_boot_sector_generate (&fs_info->boot_sector, fs)) + goto error_free_buffers; +-- +cgit v1.0-41-gc330 + diff -Nru parted-3.2/debian/patches/series parted-3.2/debian/patches/series --- parted-3.2/debian/patches/series 2018-10-18 18:00:12.000000000 -0400 +++ parted-3.2/debian/patches/series 2019-03-14 13:03:36.000000000 -0400 @@ -26,3 +26,4 @@ libparted-dasd-add-new-fdasd-functions.patch libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch Read-NVMe-model-names-from-sysfs.patch +fix-windows-fat-recognition-after-resizing.patch