[parted-devel] [PATCH 0/2] Prevent crash resizing FAT with very deep directories

Mike Fleetwood mike.fleetwood at googlemail.com
Sat Mar 5 17:14:18 UTC 2016


On 5 March 2016 at 10:55, Mike Fleetwood <mike.fleetwood at googlemail.com> wrote:
> On 3 March 2016 at 19:07, Brian C. Lane <bcl at redhat.com> wrote:
>> On Sun, Feb 28, 2016 at 03:36:09PM +0000, Mike Fleetwood wrote:
>>> Hi,
>>>
>>> Here's a fix for libparted-fs-resize crashing when resizing a FAT file
>>> system with a deep directory tree with names over 512 bytes long.
>>> Original reporter was using GParted to check and resize a FAT file
>>> system created on his Android phone.  The phone was running CyanogenMod
>>> and the Filemanager app had created a very deep directory tree leading
>>> to a core dump.
>>>
>>> Bug 762448 - Check FAT32 fs crashes GParted
>>> https://bugzilla.gnome.org/show_bug.cgi?id=762448
>>>
>>> Thanks,
>>> Mike
>>
>> I gave this a try, and while it looks simple enough it is still
>> crashing for me when I apply it to Fedora rawhide's version of parted.
>
> I have just tried my patches on Fedora 23 and Fedora Rawhide using the
> current parted GIT master (8c6de55) and they worked.  The only none
> standard thing I have is a symlink of mkfs.hfs -> mkfs.hfsplus as
> t3000-resize-fs.sh currently requires mkfs.hfs.
>
> Ran test t3000-resize-fs.sh:
> 1) Clean GIT master
>    => Pass
> 2) Applied test case patch first
>    => Triggers crash in fs-resize and reports failure, as expected.
> 3) Applied code fix
>    => fs-resize succeeds, test case passes

I have given rebuilding parted-3.2-16 RPM with my patches applied in
Fedora Rawhide a go.  The RPM builds successfully as a non-root user,
however about half the tests are skipped, including t3000-resize-fs.sh.

Trying to reproduce your failure I ran the RPM build up to the install
step (rpmbuild -bi) and then as root changed into tests/ directory and
ran test t3000-resize-fs.sh.  This does cause the test to fail.  However
it fails because test/fs-resize (actually test/.libs/fs-resize) is
linked with the current installed (and broken)
/lib64/libparted-fs-resize.so.  It needs to be dynamically linked with
the new library in the RPM buildroot.
  $ cd ~/rpmbuild/BUILD/parted-3.2/tests/
  $ ldd .libs/fs-resize | fgrep libparted
          libparted-fs-resize.so.0 => /lib64/libparted.so.2 (...)
          libparted.so.2 => /lib64/libparted.so.2 (...)

It doesn't appear to be valid to run parted tests out of the RPM build
tree without overriding the dynamic library search path.  Doing this
allows the test to pass.
  $ cd ~/rpmbuild/BUILD/parted-3.2/tests/
  $ su root
  # export LD_LIBRARY_PATH=/home/fedora/rpmbuild/BUILDROOT/parted-3.2*/lib64
  # make check TESTS=t3000-resize-fs.sh

Using parted from GIT and doing a make install (configuration prefix was
/tmp/parted) before performing the tests gets fs-resize dynamically
linked to the new fixed libparted-fs-resize.so so the test passes.
  $ cd ~/programming/c/parted/tests/
  $ ldd .libs/fs-resize | fgrep libparted
          libparted-fs-resize.so.0 => /tmp/parted/lib/libparted.so.2 (...)
          libparted.so.2 => /tmp/parted/lib/libparted.so.2 (...)



More information about the parted-devel mailing list