Dear Maintainer,
I just tried to find some more information.

I could reproduce the issue in a unstable amd64 VM
on the second attempt.

It looks like in a garbage collector run a
division by zero is triggered because we
get there with sector_size==0.

If wanted I can forward the core file.

Kind regards,
Bernhard



1708    gpt_alloc_metadata (PedDisk *disk)
1709    {
...
1718      gptlength = ped_div_round_up (sizeof (GuidPartitionTableHeader_t),
1719                                    disk->dev->sector_size);


(gdb) bt
#0  0x00007fb67449e727 in ped_div_round_up (divisor=0, numerator=100) at 
../../../include/parted/natmath.h:130
#1  gpt_alloc_metadata (disk=0x558890efb060) at 
../../../libparted/labels/gpt.c:1718
#2  0x00007fb67448851a in _disk_alloc_metadata (disk=0x558890efb060) at 
../../libparted/disk.c:1164
#3  _disk_pop_update_mode (disk=0x558890efb060) at ../../libparted/disk.c:1164
#4  0x00007fb6744890b2 in ped_disk_delete_all (disk=disk@entry=0x558890efb060) 
at ../../libparted/disk.c:2104
#5  0x00007fb67449dd59 in gpt_free (disk=0x558890efb060) at 
../../../libparted/labels/gpt.c:622
#6  0x00007fb674abee82 in ?? ()
#7  0x00007fb673c46348 in ?? ()
#8  0x000055888eb4b67b in dict_dealloc (mp=0x7fb673c46280) at 
../Objects/dictobject.c:1086
#9  0x000055888ebf8339 in subtype_clear (self=<Disk at remote 0x7fb673bbaa10>) 
at ../Objects/typeobject.c:912
#10 0x000055888eb3860c in delete_garbage (old=0x55888eda25b0 
<generations.lto_priv+80>, collectable=0x7ffd0ab2f4e0) at 
../Modules/gcmodule.c:817
#11 collect (generation=2) at ../Modules/gcmodule.c:981
#12 0x000055888eb9fcaa in PyGC_Collect () at ../Modules/gcmodule.c:1439
#13 0x000055888eb9ef44 in Py_Finalize () at ../Python/pythonrun.c:455
#14 0x000055888ebc92c8 in Py_Exit (sts=0) at ../Python/pythonrun.c:1795
#15 0x000055888ebc6a8d in handle_system_exit () at ../Python/pythonrun.c:1160
#16 0x000055888ebc63b6 in PyErr_PrintEx (set_sys_last_vars=<optimized out>, 
set_sys_last_vars=<optimized out>) at ../Python/pythonrun.c:1170
#17 0x000055888ebc527d in RunModule (module=<optimized out>, 
set_argv0=<optimized out>) at ../Modules/main.c:199
#18 0x000055888eb2cea2 in Py_Main (argc=<optimized out>, argv=0x7ffd0ab2f888) 
at ../Modules/main.c:592
#19 0x00007fb674bc209b in __libc_start_main (main=0x55888eb2ca90 <main>, 
argc=5, argv=0x7ffd0ab2f888, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffd0ab2f878) at ../csu/libc-start.c:308
#20 0x000055888eb2c9ca in _start () at ../Modules/gcmodule.c:1003

# Buster amd64 qemu VM 2019-04-23


apt update
apt dist-upgrade


apt build-dep pyparted
apt install systemd-coredump fakeroot gdb python2.7-dbg libparted2-dbgsym


mkdir /home/benutzer/source/pyparted/orig -p
cd    /home/benutzer/source/pyparted/orig
apt source pyparted
cd


mkdir /home/benutzer/source/libparted2/orig -p
cd    /home/benutzer/source/libparted2/orig
apt source libparted2
cd


cd /home/benutzer/source/pyparted
cp -a orig try1
cd try1/pyparted-3.11.2
dpkg-buildpackage



#############


Switched to unstable


dpkg-buildpackage
-> first attempt succeeded, second failed


...
runTest (tests.test_parted_device.DeviceWriteTestCase) ... skipped 
'Unimplemented test case.'
runTest (tests.test_parted_filesystem.FileSystemGetPedFileSystemTestCase) ... 
skipped 'Unimplemented test case.'
runTest (tests.test_parted_filesystem.FileSystemGetSetTestCase) ... skipped 
'Unimplemented test case.'
runTest (tests.test_parted_filesystem.FileSystemNewTestCase) ... skipped 
'Unimplemented test case.'
runTest (tests.test_parted_filesystem.FileSystemStrTestCase) ... skipped 
'Unimplemented test case.'

----------------------------------------------------------------------
Ran 273 tests in 0.905s

OK (skipped=118)
Floating point exception (core dumped)
E: pybuild pybuild:341: test: plugin distutils failed with: exit code=136: cd 
/home/benutzer/source/pyparted/try1/pyparted-3.11.2/.pybuild/cpython2_2.7_parted/build;
 python2.7 -m unittest discover -v 
dh_auto_test: pybuild --test -i python{version} -p 2.7 returned exit code 13
make: *** [debian/rules:9: build] Fehler 25
dpkg-buildpackage: Fehler: Unterprozess debian/rules build lieferte Exitstatus 2



############


dmesg:
[  568.228710] traps: python2.7[15867] trap divide error ip:7fb67449e727 
sp:7ffd0ab2f360 error:0 in libparted.so.2.0.1[7fb674482000+2c000]


root@debian:~# coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Tue 2019-04-23 10:45:12 CEST  15867  1000  1000   8 present   /usr/bin/python2.7


root@debian:~# coredumpctl gdb 15867
           PID: 15867 (python2.7)
           UID: 1000 (benutzer)
           GID: 1000 (benutzer)
        Signal: 8 (FPE)
     Timestamp: Tue 2019-04-23 10:45:12 CEST (2min 45s ago)
  Command Line: python2.7 -m unittest discover -v
    Executable: /usr/bin/python2.7
 Control Group: /user.slice/user-1000.slice/session-3.scope
          Unit: session-3.scope
         Slice: user-1000.slice
       Session: 3
     Owner UID: 1000 (benutzer)
       Boot ID: 04731d72fe444b5c8567e7172ad9cf8a
    Machine ID: 32f43b50ac8c4b21941bc0b02f8e7811
      Hostname: debian
       Storage: 
/var/lib/systemd/coredump/core.python2\x2e7.1000.04731d72fe444b5c8567e7172ad9cf8a.15867.1556009112000000.lz4
       Message: Process 15867 (python2.7) of user 1000 dumped core.
                
                Stack trace of thread 15867:
                #0  0x00007fb67449e727 n/a (libparted.so.2)
                #1  0x00007fb67448851a n/a (libparted.so.2)
                #2  0x00007fb6744890b2 ped_disk_delete_all (libparted.so.2)
                #3  0x00007fb67449dd59 n/a (libparted.so.2)
                #4  0x00007fb674abee82 n/a 
(/home/benutzer/source/pyparted/try1/pyparted-3.11.2/.pybuild/cpython2_2.7_parted/build/_ped.so)

GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python2.7...(no debugging symbols found)...done.
[New LWP 15867]

warning: Could not load shared library symbols for ./_ped.so.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python2.7 -m unittest discover -v'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x00007fb67449e727 in ?? () from /lib/x86_64-linux-gnu/libparted.so.2
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x00007fb67449e727 in ?? () from /lib/x86_64-linux-gnu/libparted.so.2
#1  0x00007fb67448851a in ?? () from /lib/x86_64-linux-gnu/libparted.so.2
#2  0x00007fb6744890b2 in ped_disk_delete_all () from 
/lib/x86_64-linux-gnu/libparted.so.2
#3  0x00007fb67449dd59 in ?? () from /lib/x86_64-linux-gnu/libparted.so.2
#4  0x00007fb674abee82 in ?? ()
#5  0x00007fb673c46348 in ?? ()
#6  0x000055888eb4b67b in ?? ()
#7  0x000055888ebf8339 in ?? ()
#8  0x000055888eb3860c in ?? ()
#9  0x000055888eb9fcaa in PyGC_Collect ()
#10 0x000055888eb9ef44 in Py_Finalize ()
#11 0x000055888ebc92c8 in Py_Exit ()
#12 0x000055888ebc6a8d in ?? ()
#13 0x000055888ebc63b6 in PyErr_PrintEx ()
#14 0x000055888ebc527d in ?? ()
#15 0x000055888eb2cea2 in Py_Main ()
#16 0x00007fb674bc209b in __libc_start_main (main=0x55888eb2ca90 <main>, 
argc=5, argv=0x7ffd0ab2f888, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffd0ab2f878) at ../csu/libc-start.c:308
#17 0x000055888eb2c9ca in _start ()


Core was generated by `python2.7 -m unittest discover -v'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x00007fb67449e727 in ped_div_round_up (divisor=0, numerator=100) at 
../../../include/parted/natmath.h:130
130     ../../../include/parted/natmath.h: Datei oder Verzeichnis nicht 
gefunden.
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x00007fb67449e727 in ped_div_round_up (divisor=0, numerator=100) at 
../../../include/parted/natmath.h:130
#1  gpt_alloc_metadata (disk=0x558890efb060) at 
../../../libparted/labels/gpt.c:1718
#2  0x00007fb67448851a in _disk_alloc_metadata (disk=0x558890efb060) at 
../../libparted/disk.c:1164
#3  _disk_pop_update_mode (disk=0x558890efb060) at ../../libparted/disk.c:1164
#4  0x00007fb6744890b2 in ped_disk_delete_all (disk=disk@entry=0x558890efb060) 
at ../../libparted/disk.c:2104
#5  0x00007fb67449dd59 in gpt_free (disk=0x558890efb060) at 
../../../libparted/labels/gpt.c:622
#6  0x00007fb674abee82 in ?? ()
#7  0x00007fb673c46348 in ?? ()
#8  0x000055888eb4b67b in dict_dealloc (mp=0x7fb673c46280) at 
../Objects/dictobject.c:1086
#9  0x000055888ebf8339 in subtype_clear (self=<Disk at remote 0x7fb673bbaa10>) 
at ../Objects/typeobject.c:912
#10 0x000055888eb3860c in delete_garbage (old=0x55888eda25b0 
<generations.lto_priv+80>, collectable=0x7ffd0ab2f4e0) at 
../Modules/gcmodule.c:817
#11 collect (generation=2) at ../Modules/gcmodule.c:981
#12 0x000055888eb9fcaa in PyGC_Collect () at ../Modules/gcmodule.c:1439
#13 0x000055888eb9ef44 in Py_Finalize () at ../Python/pythonrun.c:455
#14 0x000055888ebc92c8 in Py_Exit (sts=0) at ../Python/pythonrun.c:1795
#15 0x000055888ebc6a8d in handle_system_exit () at ../Python/pythonrun.c:1160
#16 0x000055888ebc63b6 in PyErr_PrintEx (set_sys_last_vars=<optimized out>, 
set_sys_last_vars=<optimized out>) at ../Python/pythonrun.c:1170
#17 0x000055888ebc527d in RunModule (module=<optimized out>, 
set_argv0=<optimized out>) at ../Modules/main.c:199
#18 0x000055888eb2cea2 in Py_Main (argc=<optimized out>, argv=0x7ffd0ab2f888) 
at ../Modules/main.c:592
#19 0x00007fb674bc209b in __libc_start_main (main=0x55888eb2ca90 <main>, 
argc=5, argv=0x7ffd0ab2f888, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffd0ab2f878) at ../csu/libc-start.c:308
#20 0x000055888eb2c9ca in _start () at ../Modules/gcmodule.c:1003


(gdb) down
#0  0x00007fb67449e727 in ped_div_round_up (divisor=0, numerator=100) at 
../../../include/parted/natmath.h:130
130             return (numerator + divisor - 1) / divisor;

(gdb) list
126
127     static inline PedSector
128     ped_div_round_up (PedSector numerator, PedSector divisor)
129     {
130             return (numerator + divisor - 1) / divisor;
131     }
132

(gdb) print numerator
$1 = 100
(gdb) print divisor
$2 = 0




(gdb) up
#1  gpt_alloc_metadata (disk=0x558890efb060) at 
../../../libparted/labels/gpt.c:1718
1718      gptlength = ped_div_round_up (sizeof (GuidPartitionTableHeader_t),

(gdb) list gpt.c:1705,1735
1705
1706    /* Allocate metadata partitions for the GPTH and PTES */
1707    static int
1708    gpt_alloc_metadata (PedDisk *disk)
1709    {
1710      PedSector gptlength, pteslength = 0;
1711      GPTDiskData *gpt_disk_data;
1712
1713      PED_ASSERT (disk != NULL);
1714      PED_ASSERT (disk->dev != NULL);
1715      PED_ASSERT (disk->disk_specific != NULL);
1716      gpt_disk_data = disk->disk_specific;
1717
1718      gptlength = ped_div_round_up (sizeof (GuidPartitionTableHeader_t),
1719                                    disk->dev->sector_size);
1720      pteslength = ped_div_round_up (gpt_disk_data->entry_count
1721                                     * sizeof (GuidPartitionEntry_t),
1722                                     disk->dev->sector_size);
1723
1724      /* metadata at the start of the disk includes the MBR */
1725      if (!add_metadata_part (disk, GPT_PMBR_LBA,
1726                              GPT_PMBR_SECTORS + gptlength + pteslength))
1727        return 0;
1728
1729      /* metadata at the end of the disk */
1730      if (!add_metadata_part (disk, disk->dev->length - gptlength - 
pteslength,
1731                              gptlength + pteslength))
1732        return 0;
1733
1734      return 1;
1735    }


(gdb) print disk
$3 = (PedDisk *) 0x558890efb060
(gdb) print *disk
$4 = {dev = 0x558890efaf30, type = 0x7fb6744c38e0 <gpt_disk_type>, block_sizes 
= 0x558890efb050, part_list = 0x0, disk_specific = 0x558890ef0ff0, 
needs_clobber = 1, update_mode = 1}
(gdb) print disk->dev
$6 = (PedDevice *) 0x558890efaf30
(gdb) print *disk->dev
$7 = {next = 0x0, model = 0x558890eafa40 "0\257U", path = 0x558890f01450 " 
Y\360\220\210U", type = 2431670560, sector_size = 0, phys_sector_size = 32, 
length = 31, open_count = -1, read_only = 8, external_mode = 0, dirty = 0, 
boot_dirty = 0, hw_geom = {cylinders = 0, heads = 0, sectors = 0}, bios_geom = 
{cylinders = 33, heads = 0, sectors = 1}, host = 21896, did = 0, arch_specific 
= 0x0}
(gdb) print disk->dev->sector_size
$5 = 0






(gdb) up
#2  0x00007fb67448851a in _disk_alloc_metadata (disk=0x558890efb060) at 
../../libparted/disk.c:1164
warning: Source file is more recent than executable.
1164                    _disk_alloc_metadata (disk);

(gdb) list disk.c:1149,1177
1149
1150    static int
1151    _disk_pop_update_mode (PedDisk* disk)
1152    {
1153            PED_ASSERT (disk->update_mode);
1154
1155            if (disk->update_mode == 1) {
1156            /* re-allocate metadata BEFORE leaving update mode, to prevent 
infinite
1157             * recursion (metadata allocation requires update mode)
1158             */
1159    #ifdef DEBUG
1160                    if (!_disk_check_sanity (disk))
1161                            return 0;
1162    #endif
1163
1164                    _disk_alloc_metadata (disk);
1165                    disk->update_mode--;
1166                    _disk_alloc_freespace (disk);
1167
1168    #ifdef DEBUG
1169                    if (!_disk_check_sanity (disk))
1170                            return 0;
1171    #endif
1172            } else {
1173                    disk->update_mode--;
1174            }
1175            return 1;
1176    }
1177






############



root@debian:~# dpkg -l | grep -E "parted|python2"
ii  libparted-dev:amd64              3.2-25                      amd64        
disk partition manipulator - development files
ii  libparted-fs-resize0:amd64       3.2-25                      amd64        
disk partition manipulator - shared FS resizing library
ii  libparted2:amd64                 3.2-25                      amd64        
disk partition manipulator - shared library
ii  libparted2-dbgsym:amd64          3.2-25                      amd64        
debug symbols for libparted2
ii  libpython2-dev:amd64             2.7.16-1                    amd64        
header files and a static library for Python2
ii  libpython2-stdlib:amd64          2.7.16-1                    amd64        
interactive high-level object-oriented language (Python2)
ii  libpython2.7:amd64               2.7.16-2                    amd64        
Shared Python runtime library (version 2.7)
ii  libpython2.7-dbg:amd64           2.7.16-2                    amd64        
Debug Build of the Python Interpreter (version 2.7)
ii  libpython2.7-dev:amd64           2.7.16-2                    amd64        
Header files and a static library for Python (v2.7)
ii  libpython2.7-minimal:amd64       2.7.16-2                    amd64        
Minimal subset of the Python language (version 2.7)
ii  libpython2.7-stdlib:amd64        2.7.16-2                    amd64        
Interactive high-level object-oriented language (standard library, version 2.7)
ii  parted                           3.2-25                      amd64        
disk partition manipulator
ii  python2                          2.7.16-1                    amd64        
interactive high-level object-oriented language (Python2 version)
ii  python2-dev                      2.7.16-1                    amd64        
header files and a static library for Python2
ii  python2-minimal                  2.7.16-1                    amd64        
minimal subset of the Python2 language
ii  python2.7                        2.7.16-2                    amd64        
Interactive high-level object-oriented language (version 2.7)
ii  python2.7-dbg                    2.7.16-2                    amd64        
Debug Build of the Python Interpreter (version 2.7)
ii  python2.7-dev                    2.7.16-2                    amd64        
Header files and a static library for Python (v2.7)
ii  python2.7-minimal                2.7.16-2                    amd64        
Minimal subset of the Python language (version 2.7)



    set width 0
    set pagination off
    directory /home/benutzer/source/libparted2/orig/parted-3.2/libparted/fs/r
    directory /home/benutzer/source/libparted2/orig/parted-3.2/libparted/fs
    bt

Reply via email to