After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756434 - GParted dumps core when passing non-existent or invalid device on the command line
GParted dumps core when passing non-existent or invalid device on the command...
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: Mike Fleetwood
gparted maintainers alias
: 756612 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-10-12 13:24 UTC by Mike Fleetwood
Modified: 2015-10-27 17:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Prevent core dump from non-existent or invalid named devices (v1) (7.04 KB, patch)
2015-10-14 21:16 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2015-10-12 13:24:13 UTC
Get a core dump by doing this:

# ./gpartedbin /dev/zero
======================
libparted : 2.4
======================
The device /dev/zero is so small that it cannot possibly store a file system or partition table.  Perhaps you selected the wrong device?
Error fsyncing/closing /dev/zero: Invalid argument
Backtrace has 10 calls on stack:
  10: /lib64/libparted.so.0(ped_assert+0x31) [0x7f6c3f8f4e61]
  9: /lib64/libparted.so.0(+0x3fdfc12a0c) [0x7f6c3f8f5a0c]
  8: /home/mike/programming/c/gparted/src/gpartedbin() [0x45495b]
  7: /home/mike/programming/c/gparted/src/gpartedbin() [0x4549d0]
  6: /home/mike/programming/c/gparted/src/gpartedbin() [0x454a1d]
  5: /home/mike/programming/c/gparted/src/gpartedbin() [0x463c37]
  4: /usr/lib64/libglibmm-2.4.so.1() [0x3ff5834a8d]
  3: /lib64/libglib-2.0.so.0() [0x3fe086a374]
  2: /lib64/libpthread.so.0() [0x3fdf407a51]
  1: /lib64/libc.so.6(clone+0x6d) [0x3fdf0e893d]
Assertion (dev != NULL) at device.c:227 in function ped_device_open() failed.
Aborted (core dumped)


Affects GParted 0.22.0 and later.
Comment 1 Mike Fleetwood 2015-10-14 21:16:01 UTC
Created attachment 313337 [details] [review]
Prevent core dump from non-existent or invalid named devices (v1)

Hi Curtis,

Here's the patchset to fix the core dump and a couple of related issues
I also found when testing further.

Ho hum.  All 3 issues were with my code.  Anyway fixed now.  2nd and 3rd
bugs were from this very recent one of mine:
Check disks named on the command line are safe to use too (#755495)
https://git.gnome.org/browse/gparted/commit/?id=362b2db331b4c31a978bb67232fa7f3ce9ab38c3


Thanks,
Mike
Comment 2 Mike Fleetwood 2015-10-15 09:03:03 UTC
*** Bug 756612 has been marked as a duplicate of this bug. ***
Comment 3 Curtis Gedak 2015-10-15 16:21:34 UTC
Thank you Mike for finding and resolving this core dump problem.

Using patch set v1 from comment #1 I successfully tested passing the
command line arguments representing a non-existent device path and
/dev/zero.

I confirmed the core dump problem and tested patch v1 on the following
distros:

  Debian    7
  kubuntu  12.04 LTS
  openSUSE 13.2

I hope you don't mind but I made one minor change to the commit
message in last two of the three patches.  More specifically I
changed:

FROM:
  Must not have large a sector size when GParted is built with an old
TO:
  Must not have a large sector size when GParted is built with an old
                ^^^^^^^

Patch set v1 from comment #1 has been committed to the git repository.

The relevant git commits can be viewed at the following links:

Prevent core dump with non-existent or invalid command line named device (#756434)
https://git.gnome.org/browse/gparted/commit/?id=663807802ff01f51633204f98c7f4410e9d0b9c7

Remove non-existent or invalid devices from those named (#756434)
https://git.gnome.org/browse/gparted/commit/?id=bbf1a19cec72db9bda8a88324579dd7f70a0e9d8

Check usability of named device following a non-existent / invalid one (#756434)
https://git.gnome.org/browse/gparted/commit/?id=9d6ebb3dabafc7bfb0105bb5758e04a5efe85e6f
Comment 4 Curtis Gedak 2015-10-27 17:04:46 UTC
This enhancement was included in the GParted 0.24.0 release on October 27, 2015.