Thread: pgAdmin3 svn 4409 on Debian - segfault

pgAdmin3 svn 4409 on Debian - segfault

From
Tomasz Rybak
Date:
Hello.
I've downloaded pgAdmin3 from trunk 4409.

I've installed wx 2.6.1.1 from Debian Experimental.
I've made Debian package from this,
but when I try to run it, it segfaults,
even when I want to get version or help:

tomus@barad-dur:~/Zrodla$ pgadmin3 --help
Segmentation fault
tomus@barad-dur:~/Zrodla$

Here's backtrace (BTW - how can I compile it with debugging?):
(gdb) bt
#0  0x08071deb in wxStringListBase::~wxStringListBase ()
#1  0x081b3bd9 in wxGridCellAttr::wxGridCellAttr ()
#2  0x0806979b in ?? ()
#3  0x08069eff in wxAppConsole::CallOnInit ()
#4  0xb78604da in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#5  0xb78605de in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#6  0x08067f19 in ?? ()
#7  0xb7464ec0 in __libc_start_main () from /lib/tls/libc.so.6
#8  0x08067e51 in ?? ()
(gdb)


Two notes about Debian packaging.
1. locales are put into wrong directory:
/usr/share/locale/debian/tmp/usr/share/pgadmin3/i18n/af_ZA/pgadmin3.mo
(there shouldn't be tmp/usr/share)

2. After Sarge has been made stable, in Sid PostgreSQL has been changed.
There is no postgresql package - instead, there are packages
postgresql-7.4 and postgresql-8.0.
For PostgreSQL 8.0 there is libpq4, and For PostgreSQL 7.4
there is libpq3.
Now, there are different development packages for libpq (libpq-dev)
and for compiling programs for server (postgresql-server-dev-8.0
and postgresql-server-dev-7.4).
There are different directories for different versions of PostgreSQL,
for example /usr/include/postgresql/8.0, /usr/share/postgresql/8.0.

Here is patch (svn diff) for changes I made to be able
to compile pgAdmin3:

Index: pkg/debian/control
===================================================================
--- pkg/debian/control    (wersja 4409)
+++ pkg/debian/control    (kopia robocza)
@@ -2,7 +2,7 @@
 Section: misc
 Priority: optional
 Maintainer: Raphael Enrici <blacknoz@club-internet.fr>
-Build-Depends: debhelper (>= 4.1.0), postgresql-dev (>=7.3),
devscripts, libwxgtk2.5-dev (>= 2.5.3.2)
+Build-Depends: debhelper (>= 4.1.0), libpq-dev, devscripts,
libwxgtk2.6-dev (>= 2.6.1.1)
 Standards-Version: 3.6.1

 Package: pgadmin3
Index: pkg/debian/rules
===================================================================
--- pkg/debian/rules    (wersja 4409)
+++ pkg/debian/rules    (kopia robocza)
@@ -13,7 +13,7 @@
 _PGA3_WXCONFIG ?= wx-config

 # A hack to get it compile without errors concerning MNU_NEW
-_pgsql_inc:="/usr/include/postgresql -I./include"
+_pgsql_inc:="/usr/include/postgresql/8.0 -I./include"

 # These are used for cross-compiling and for saving the configure
script
 # from having to guess our platform (since we know it already)



--
Tomasz Rybak <bogomips@post.pl>


Re: pgAdmin3 svn 4409 on Debian - segfault

From
Andreas Pflug
Date:
Tomasz Rybak wrote:
> Hello.
> I've downloaded pgAdmin3 from trunk 4409.

Use the latest (4412); there was a major problem with wxgtk in a
previous version.

Regards,
Andreas

Re: pgAdmin3 svn 4409 on Debian - segfault

From
Tomasz Rybak
Date:
Dnia 21-08-2005, nie o godzinie 17:26 +0000, Andreas Pflug napisał(a):
> Tomasz Rybak wrote:
> > Hello.
> > I've downloaded pgAdmin3 from trunk 4409.
>
> Use the latest (4412); there was a major problem with wxgtk in a
> previous version.


OK. After changing  factory.cpp, pgAdmin3 works.
Even Slony-I is visible.

tomus@barad-dur:~/Zrodla/admin$ svn diff src/base/factory.cpp
Index: src/base/factory.cpp
===================================================================
--- src/base/factory.cpp        (wersja 4412)
+++ src/base/factory.cpp        (kopia robocza)
@@ -289,7 +289,11 @@

 actionFactory::actionFactory(menuFactoryList *list) : menuFactory(list)
 {
+       if (list){
     id = list->GetCount()+MNU_ACTION -1;
+       } else {
+               id = 0;
+       }
     context=false;
 }


Best regards.
Tomasz



Re: pgAdmin3 svn 4409 on Debian - segfault

From
Andreas Pflug
Date:
Tomasz Rybak wrote:
> Dnia 21-08-2005, nie o godzinie 17:26 +0000, Andreas Pflug napisał(a):
>

>
>  actionFactory::actionFactory(menuFactoryList *list) : menuFactory(list)
>  {
> +       if (list){
>      id = list->GetCount()+MNU_ACTION -1;
> +       } else {
> +               id = 0;
> +       }

Yes, this fix is correct; the initial tooltipFactory is called with no
menuFactoryList present, thanks for reporting.

Regards,
Andreas

Re: pgAdmin3 svn 4409 on Debian - segfault

From
Tomasz Rybak
Date:
Dnia 21-08-2005, nie o godzinie 17:26 +0000, Andreas Pflug napisał(a):
> Tomasz Rybak wrote:
> > Hello.
> > I've downloaded pgAdmin3 from trunk 4409.
>
> Use the latest (4412); there was a major problem with wxgtk in a
> previous version.
>

I upgraded to latest version, made Debian package, installed
debug (not-stripped) libraries and:

tomus@barad-dur:~$ ulimit -c unlimited
tomus@barad-dur:~$ export
LD_LIBRARY_PATH=/usr/lib/debug:/usr/lib/debug/lib:/usr/lib/debug/usr/lib
tomus@barad-dur:~$ /usr/bin/pgadmin3 --version
Naruszenie ochrony pamięci (core dumped)
tomus@barad-dur:~$ gdb /usr/bin/pgadmin3 core
#0  actionFactory (this=0xbfa0cf40, list=0x0) at ./base/factory.cpp:292
292         id = list->GetCount()+MNU_ACTION -1;
(gdb) bt
#0  actionFactory (this=0xbfa0cf40, list=0x0) at ./base/factory.cpp:292
#1  0x081b9d29 in tipOfDayFactory (this=0xbfa0cf40, list=0x0, mnu=0x0,
    toolbar=0x0) at ./frm/frmHint.cpp:401
#2  0x0806979b in pgAdmin3::OnInit (this=0x8429c28)
at ./pgAdmin3.cpp:366
#3  0x08069eff in wxAppConsole::CallOnInit (this=0xbfa0cf40) at app.h:87
#4  0xb780e4da in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#5  0xb780e5de in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#6  0x08067f19 in main (argc=2, argv=0xbfa0d0d4) at ./pgAdmin3.cpp:101
(gdb)

I don't know pgAdmin (planned to play with it), so I cannot tell,
what's wrong.

Libraries versions:
ii  libwxgtk2.6-0                    2.6.1.1
wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime)
ii  libwxgtk2.6-dbg                  2.6.1.1
wxWidgets Cross-platform C++ GUI toolkit (GTK+ development)
ii  libwxgtk2.6-dev                  2.6.1.1
wxWidgets Cross-platform C++ GUI toolkit (GTK+ development)
ii  wx2.6-common                     2.6.1.1
wxWidgets Cross-platform C++ GUI toolkit (common support files)
ii  wx2.6-headers                    2.6.1.1
wxWidgets Cross-platform C++ GUI toolkit (header files)
ii  postgresql-8.0                   8.0.3-12
object-relational SQL database, version 8.0 server
ii  postgresql-8.0-plr               0.6.1-2
Procedural language interface between PostgreSQL 8.0 and R
ii  postgresql-autodoc               1.25-1
utility to create system tables overview in HTML, DOT and XML
ii  postgresql-client-8.0            8.0.3-12
front-end programs for PostgreSQL 8.0
ii  postgresql-common                23
manager for PostgreSQL database clusters
ii  postgresql-contrib-8.0           8.0.3-12
additional facilities for PostgreSQL
ii  postgresql-doc-8.0               8.0.3-12
documentation for the PostgreSQL database management system
ii  postgresql-plperl-8.0            8.0.3-12
PL/Perl procedural language for PostgreSQL 8.0
ii  postgresql-plpython-8.0          8.0.3-12
PL/Python procedural language for PostgreSQL 8.0
ii  postgresql-server-dev-8.0        8.0.3-12
development files for PostgreSQL 8.0 server-side programming



BTW: during start-up notice window appears, and text is put
into pgadmin.log:
2005-08-21 22:35:01 ERROR  : can't open file
'/usr/bin/../i18n/pgadmin3.lng' (error 2: Nie ma takiego pliku ani
katalogu)

But it can be because of wrong directory with i18n stuff, like I've
written in previous letter.

Best regards.
Tomasz



Re: pgAdmin3 svn 4409 on Debian - segfault

From
Tomasz Rybak
Date:
Dnia 21-08-2005, nie o godzinie 23:27 +0000, Andreas Pflug napisał(a):
> Tomasz Rybak wrote:
> > Dnia 21-08-2005, nie o godzinie 17:26 +0000, Andreas Pflug napisał(a):
> >
>
> >
> >  actionFactory::actionFactory(menuFactoryList *list) : menuFactory(list)
> >  {
> > +       if (list){
> >      id = list->GetCount()+MNU_ACTION -1;
> > +       } else {
> > +               id = 0;
> > +       }
>
> Yes, this fix is correct; the initial tooltipFactory is called with no
> menuFactoryList present, thanks for reporting.

I'm wondering...
If there is list, we make id equal to MNU_ACTION + last_element_of_list.
Shouldn't there be
    id = MNU_ACTION;
instead of
    id = 0;
pgAdmin3 with my fix (id = 0) works, but I'm thinking, if
id is identity of stuff we add to menu, and we make it zero,
we could make some values reused (two menu items have the same id).

In src/include/menu.h there is:
    MNU_ACTION=MNU_NEW+1000 // leave space for objects
which would suggest, that we should add after that.

So - should id be initialised to zero, or MNU_ACTION?

--
Tomasz Rybak <bogomips@post.pl>


Re: pgAdmin3 svn 4409 on Debian - segfault

From
Andreas Pflug
Date:
Tomasz Rybak wrote:

>Dnia 21-08-2005, nie o godzinie 23:27 +0000, Andreas Pflug napisał(a):
>
>
>>Tomasz Rybak wrote:
>>
>>
>>>Dnia 21-08-2005, nie o godzinie 17:26 +0000, Andreas Pflug napisał(a):
>>>
>>>
>>>
>>> actionFactory::actionFactory(menuFactoryList *list) : menuFactory(list)
>>> {
>>>+       if (list){
>>>     id = list->GetCount()+MNU_ACTION -1;
>>>+       } else {
>>>+               id = 0;
>>>+       }
>>>
>>>
>>Yes, this fix is correct; the initial tooltipFactory is called with no
>>menuFactoryList present, thanks for reporting.
>>
>>
>
>I'm wondering...
>If there is list, we make id equal to MNU_ACTION + last_element_of_list.
>Shouldn't there be
>    id = MNU_ACTION;
>instead of
>    id = 0;
>pgAdmin3 with my fix (id = 0) works, but I'm thinking, if
>id is identity of stuff we add to menu, and we make it zero,
>we could make some values reused (two menu items have the same id).
>
>In src/include/menu.h there is:
>    MNU_ACTION=MNU_NEW+1000 // leave space for objects
>which would suggest, that we should add after that.
>
>So - should id be initialised to zero, or MNU_ACTION?
>
>
Anything (maybe 42 would perform best). If initialized without
menuItemList, no menu action is used.

Regards,
Andreas