GNOME Bugzilla – Bug 756434
GParted dumps core when passing non-existent or invalid device on the command line
Last modified: 2015-10-27 17:04:46 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.
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
*** Bug 756612 has been marked as a duplicate of this bug. ***
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
This enhancement was included in the GParted 0.24.0 release on October 27, 2015.