Subject: bug#22266: [libparted] jump instruction and boot code is corrupted with random bytes after fat is resized

From: Tom Yan <[email-masked]>
Date: Tue, 29 Dec 2015 18:08:31 +0800

https://gist.github.com/tomty89/2a1ca8698bad5ae969ad/revisions?diff=split

The (last) diff compares a FAT32 resized with a working commit of
libparted and a not working one. You can see that in the latter, the
jump instruction and boot code in the boot sectors are not preserved
but completely corrupted by random bytes. (FWIW, the first byte "eb"
is crucial for Windows to recognize the filesystem)

The last working commit I can confirm is:
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=d0a4cc1b57750a92afb48b229e4791154afa322b

which is the commit right before:
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=80678bdd957cf49a9ccfc8b88ba3fb8b4c63fc12

where FAT resizing no longer works, until:
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=5adae27101565a5d6fed4aadf28ddb39872e41f5

which is the first commit I can confirm to have this issue.

I've also tested the latest commit:
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=388bab890a4e09b09d2428c0e773ed083295f91b

which does not work properly either.

See this bug report for more details:
https://bugzilla.gnome.org/show_bug.cgi?id=759916