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 323891 - pygimp crashes python when accessing PDB
pygimp crashes python when accessing PDB
Status: RESOLVED WONTFIX
Product: GIMP
Classification: Other
Component: Gimp-Python
2.3.x
Other Linux
: Low minor
: ---
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-12-12 16:11 UTC by Ari Pollak
Modified: 2008-01-15 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ari Pollak 2005-12-12 16:11:03 UTC
From Debian bug report http://bugs.debian.org/342850 (even if this is not a
valid operation, it shouldn't crash python):

$ PYTHONPATH=/usr/lib/gimp/2.0/python/ python
Python 2.3.5 (#2, Nov 20 2005, 16:40:39)
[GCC 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>>>>> import gimpfu;
>>>>>> dir(gimpfu.pdb)


(process:1998): GLib-CRITICAL **: g_hash_table_lookup: assertion
`hash_table != NULL' failed

LibGimpBase-ERROR **: could not find handler for message: 5
aborting...
[1]    13924 abort (core dumped)  PYTHONPATH=/usr/lib/gimp/2.0/python/ python

-------

In case the coredump is of any importance at all:

(gdb) bt
  • #0 raise
    from /lib/tls/libc.so.6
  • #1 abort
    from /lib/tls/libc.so.6
  • #2 IA__g_logv
    at gmessages.c line 497
  • #3 IA__g_log
    at gmessages.c line 517
  • #4 wire_write_msg
    at gimpwire.c line 294
  • #5 gp_proc_run_write
    at gimpprotocol.c line 308
  • #6 gimp_run_procedure2
    at gimp.c line 945
  • #7 gimp_run_procedure
    at gimp.c line 877
  • #8 _gimp_procedural_db_proc_info
    at gimpproceduraldb_pdb.c line 207
  • #9 gimp_procedural_db_proc_info
    at gimpproceduraldb.c line 69
  • #10 pygimp_pdb_function_new_from_proc_db
    at pygimp-pdb.c line 700
  • #11 PyObject_Dir
    at ../Objects/object.c line 1182
  • #12 builtin_dir
    at ../Python/bltinmodule.c line 422
  • #13 eval_frame
    at ../Python/ceval.c line 3445
  • #14 PyEval_EvalCodeEx
    at ../Python/ceval.c line 2669
  • #15 PyEval_EvalCode
    at ../Python/ceval.c line 537
  • #16 PyRun_InteractiveOneFlags
    at ../Python/pythonrun.c line 1267
  • #17 PyRun_InteractiveLoopFlags
    at ../Python/pythonrun.c line 690
  • #18 PyRun_AnyFileExFlags
    at ../Python/pythonrun.c line 653
  • #19 Py_Main
    at ../Modules/main.c line 415
  • #20 __libc_start_main
    from /lib/tls/libc.so.6
  • #21 _start
    at ../sysdeps/i386/elf/start.S line 119

Comment 1 Sven Neumann 2005-12-13 18:04:05 UTC
That's what you get for using the wire protocol without initializing it beforehand.
Comment 2 Manish Singh 2005-12-13 23:16:34 UTC
"Doctor, it hurts when I do this." "Well, don't do that anymore then."

You can't use any of the gimp functions outside of the environment that the gimp
app runs plug-ins in. That's partially why the pygimp stuff is *not* installed
into the global python module paths.

I don't think preventing this edge case from happening is worth cluttering every
entry point into the pygimp code with a check for whether the environment is
right or not.

It may be possible to do some sanity checks upon import, but I'm not convinced
that'd be correct for all usage.

Note that this is an explict abort(), and not a random crash. There's other
extension modules for libraries that may call abort() in bogus user
configurations, so the "don't crash" assertion is debatable.

Leaving this open for now, since it may be possible to be more graceful, but I
may WONTFIX this upon more pondering.
Comment 3 Sven Neumann 2006-08-31 14:04:27 UTC
Yosh, what do you think about this now? In my opinion it's OK to abort here. Perhaps we should add a check for wire_ht != NULL to the wire functions in libgimpbase and g_error() with a more useful error message?
Comment 4 Sven Neumann 2007-06-25 10:44:07 UTC
I've improved the error checking in libgimpbase. Closing the report as WONTFIX.

2007-06-25  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpwire.c: if the wire protocol is used without
	prior initialization, abort with g_error() instead of crashing.