[Upstream] python2.7 crashed with SIGSEGV in Application::IsInMain()

Bug #251427 reported by Philip Ashmore
48
This bug affects 5 people
Affects Status Importance Assigned to Milestone
LibreOffice
Fix Released
Undecided
Unassigned
libreoffice (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: python-uno

3) What is expected to happen via a terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/789891/+attachment/2146841/+files/test.py && python test.py

is it does not segfault.

4) It segfaults.

Reproducible in Natty:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/789891

Precise:
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/938294

Original Reporter Comments:
lsb_release -d
    Description: Ubuntu 8.04.1

python-uno ersion: 1:2.4.1-1ubuntu2

The python script that causes this so small I can include it in line
{{{
#!/usr/bin/python
import sys, uno, unohelper

# get the uno component context from the PyUNO runtime
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
xToolkit = smgr.createInstance( "com.sun.star.awt.Toolkit")
unohelper.inspect(xToolkit, sys.stdout)
}}}

Saving this to a text file "test.py" and executing
    python test.py
produces
    Segmentation fault

I installed debugging symbols; here's the stack trace i got from gdb

#0 0xb68b60c7 in Application::IsInMain () from /usr/lib/openoffice/program/libvcl680li.so
#1 0xb6d9a2ba in VCLXToolkit_CreateInstance () from /usr/lib/openoffice/program/libtk680li.so
#2 0xb7b14373 in cppu::OSingleFactoryHelper::createInstanceEveryTime () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#3 0xb7b10180 in cppu::OSingleFactoryHelper::createInstanceWithContext () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#4 0xb7b110e9 in cppu::OFactoryComponentHelper::createInstanceWithContext () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#5 0xb7b13e18 in cppu::ORegistryFactoryHelper::createInstanceEveryTime () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#6 0xb7b10180 in cppu::OSingleFactoryHelper::createInstanceWithContext () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#7 0xb7b110e9 in cppu::OFactoryComponentHelper::createInstanceWithContext () from /usr/lib/openoffice/program/libuno_cppuhelpergcc3.so.3
#8 0xb76edbcd in stoc_smgr::OServiceManager::createInstanceWithContext () from /usr/lib/openoffice/program/bootstrap.uno.so
#9 0xb76e87d7 in stoc_smgr::OServiceManager::createInstance () from /usr/lib/openoffice/program/bootstrap.uno.so
#10 0xb7f3bae3 in callVirtualMethod () from /usr/lib/openoffice/program/libgcc3_uno.so
#11 0xb7f3bdcf in cpp_call () from /usr/lib/openoffice/program/libgcc3_uno.so
#12 0xb7f3c230 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch () from /usr/lib/openoffice/program/libgcc3_uno.so
#13 0xb6e85f3a in stoc_corefl::IdlInterfaceMethodImpl::invoke () from /usr/lib/openoffice/program/reflection.uno.so
#14 0xb6ed49cc in stoc_inv::Invocation_Impl::invoke () from /usr/lib/openoffice/program/invocation.uno.so
#15 0xb7bb526e in pyuno::PyUNO_callable_call () from /usr/lib/openoffice/program/libpyuno.so
#16 0x0805cb37 in PyObject_Call ()
#17 0x080c7987 in PyEval_EvalFrameEx ()
#18 0x080cb0d7 in PyEval_EvalCodeEx ()
#19 0x080cb227 in PyEval_EvalCode ()
#20 0x080ea6d8 in PyRun_FileExFlags ()
#21 0x080ea979 in PyRun_SimpleFileExFlags ()
#22 0x08059335 in Py_Main ()
#23 0x080587f2 in main ()

{{{
$ dpkg -l '*dbgsym*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============================-==============================-============================================================================
ii openoffice.org-base-core-dbgsy 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-base-core
ii openoffice.org-core-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-core
ii openoffice.org-dev-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-dev
ii openoffice.org-headless-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-headless
ii openoffice.org-impress-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-impress
ii openoffice.org-kde-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-kde
ii openoffice.org-ogltrans-dbgsym 1:2.4.1-1ubuntu2 debug symbols for package openoffice.org-ogltrans
}}}

What should have happened:
    A meaningful exception (or no exception), justifying python as a quick-test tool for ideas.

What did happen:
   Whether I wanted to or not, a headlong dive into Ububtu / Debian package management.

First I posted

    https://answers.edge.launchpad.net/ubuntu/+source/kdevelop/+question/40081
    How do I step through the source code of installed packages?
(thanks for your responses)
and realised that
1. It's quite uncommon for people to debug / step through installed binary packages - the de-facto approach is to build from source with debugging information and optimisation off, and step through that.
2. kdbg / gdb has no way of knowing (that I can find) where the source code for a loaded library / program is, even with the debug info package for that package installed.
3. sudo apt-get source <packagename> doesn't apply to OpenOffice.org - I got the following message when I tried:
    $ apt-get -s source openoffice.org-core
    NOTICE: 'openoffice.org' packaging is maintained in the 'Bzr' version control system at:
    http://bazaar.launchpad.net/~openoffice-pkgs/openoffice/2.4.1-hardy
    Please use:
    bzr get http://bazaar.launchpad.net/~openoffice-pkgs/openoffice/2.4.1-hardy
    to retrieve the latest (possible unreleased) updates to the package.
4. According to the apt-get man page, in the "source" command section:
"Note that source packages are not tracked like binary packages, they exist only in the current directory and are similar to downloading source tar balls.".
5. <trawls the net some more> I found
    http://openoffice.debian.net/build.html
    Building OpenOffice.org 2.2.1 from the latest apt-gettable Debian sources
It suggested that I
    apt-get update
    apt-get build-dep openoffice.org
    apt-get source openoffice.org
(which doesn't apply to Ubuntu, I guess)
In Ubuntu, OpenOffice.org is stored on Bazaar
6. OpenOffice.org is stored on Bazaar in 'bzip2 compressed archives' so I couldn't just point gdb at the expanded source tree.
sudo apt-get install bzr
bzr get http://bazaar.launchpad.net/~openoffice-pkgs/openoffice/2.4.1-hardy
for which I would need about 6GB of free disk space and (from previous experience).
    dpkg-buildpackage -uc -us -rfakeroot
7. dpkg-buildpackage -uc -us -rfakeroot failed as I needed to
sudo apt-get install bison flex-old libpam0g-dev libxaw7-dev libfontconfig1-dev zlib1g-dev libfreetype6-dev libx11-dev libsm-dev libxt-dev libxext-dev libxtst-dev libice-dev libsane-dev libxrender-dev libcupsys2-dev libarchive-zip-perl libpng12-dev libjpeg62-dev libxml2-dev libldap2-dev libexpat1-dev libgnomevfs2-dev fastjar imagemagick netpbm libxkbfile-dev libxinerama-dev x11proto-render-dev unixodbc-dev gperf libpq-dev libxrandr-dev translate-toolkit libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libssl-dev libdb4.6-dev java-gcj-compat-dev libgcj-bc libxalan2-java libjcommon-java libsac-java libxml-java libflute-1.3-jfree-java libpentaho-reporting-flow-engine-java liblayout-java libloader-java libformula-java librepository-java libfonts-java libjcommon-serializer-java xulrunner-1.9-dev dmake mono-mcs mono-gmcs libmono-dev mono-utils cli-common-dev mono-1.0-devel mono-2.0-devel libhunspell-dev libboost-dev libvigraimpex-dev libwpd8-dev libwps-dev libwpg-dev libicu-dev libxslt1-dev libcairo2-dev kdelibs4-dev libhsqldb-java bsh libdbus-glib-1-dev libgstreamer-plugins-base0.10-dev libneon27-dev libgtk2.0-dev

Actually dpkg-buildpackage included version constraints in brackets for the required packages. I won't repeat them here as I don't want to waste your time unnecessarily.
From building it before on Fedora 8 this would take up most of the day on my puny 1GHz pentium III with only 512MB RAM.

8. The recommended location for source files
    http://proton.pathname.com/fhs/pub/fhs-2.3.html#USRSRCSOURCECODE
    Filesystem Hierarchy Standard
I found the section on
    /usr/src Source code (optional)
I'm guessing that I need to install the source code here.

Speaking of Fedora, kdbg integration is somewhat more integrated and will recommend
    debuginfo-install <package name>
this downloads and installs debugging symbol information and the source code in a well known location.

9. The debugging information in the debugging packages doesn't include source file and line number information.

I eagerly look forward to a considered response.

Revision history for this message
Chris Cheney (ccheney) wrote :

This appears to be an upstream issue it segfaults for me on upstream's openoffice.org 2.4.1 as well.

Changed in openoffice.org:
importance: Undecided → Low
status: New → Triaged
Chris Cheney (ccheney)
Changed in openoffice:
importance: Undecided → Unknown
status: New → Unknown
Changed in openoffice:
status: Unknown → New
Chris Cheney (ccheney)
tags: added: hardy
Revision history for this message
In , penalvch (penalvch) wrote :

Downstream bug may be found at:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/789891

1) lsb_release -rd
Description: Ubuntu precise (development branch)
Release: 12.04

2) apt-cache policy python2.7
python2.7:
  Installed: 2.7.2-13ubuntu5
  Candidate: 2.7.2-13ubuntu5
  Version table:
 *** 2.7.2-13ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
        100 /var/lib/dpkg/status

apt-cache policy libreoffice
libreoffice:
  Installed: 1:3.5.0-1ubuntu1
  Candidate: 1:3.5.0-1ubuntu1
  Version table:
 *** 1:3.5.0-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
        100 /var/lib/dpkg/status

3) What is (naively) expected to happen is running the attachment at the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/789891/+attachment/2146841/+files/test.py && python test.py

does not segfaults.

4) It segfaults. I do not know the purpose of the file or ramifications of it crashing (valid or deprecated syntax, etc.). I was triaging https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/251427 and trying to reproduce.

First reproduced in:
lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

apt-cache policy python2.7
python2.7:
  Installed: 2.7.1-5ubuntu2
  Candidate: 2.7.1-5ubuntu2
  Version table:
 *** 2.7.1-5ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages
        100 /var/lib/dpkg/status

LO 3.3.4

penalvch (penalvch)
summary: - [upstream] [hardy] python-uno segfaults
+ [Upstream] python2.7 crashed with SIGSEGV in Application::IsInMain()
Changed in libreoffice (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
penalvch (penalvch)
Changed in openoffice.org (Ubuntu):
status: Triaged → Won't Fix
penalvch (penalvch)
tags: added: i386 natty precise
Changed in df-libreoffice:
importance: Unknown → High
status: Unknown → Incomplete
penalvch (penalvch)
tags: added: quantal raring
penalvch (penalvch)
description: updated
description: updated
Changed in df-libreoffice:
status: Incomplete → Confirmed
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Does this also happen with python3-uno on raring (Libreoffice 4)?

Changed in libreoffice (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Python2 UNO is long gone, thus closing.

Changed in libreoffice (Ubuntu):
status: Incomplete → Won't Fix
Revision history for this message
Adolfo Jayme Barrientos (fitojb) wrote :
Changed in df-libreoffice:
importance: High → Undecided
status: Confirmed → New
affects: openoffice → hundredpapercuts
Changed in libreoffice (Ubuntu):
status: Won't Fix → Triaged
no longer affects: openoffice.org (Ubuntu)
Changed in df-libreoffice:
status: New → Fix Released
no longer affects: hundredpapercuts
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Still wontfix. Please dont bring back this Zombie.

Changed in libreoffice (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
penalvch (penalvch) wrote :

Fixed in Xenial.

Changed in libreoffice (Ubuntu):
status: Won't Fix → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.