Solaris, glib and GTree

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Solaris, glib and GTree

Miek Gieben-2
Hello,

I'm using glib in my tools to create a tree (GTree) with
pathnames and some data (from stat(2)). I'm using this
structure as the key:

struct entry {
        char *f_name;
        size_t f_name_size;
        uid_t f_uid;
        gid_t f_gid;
        mode_t f_mode;
        time_t f_mtime;
        off_t f_size;
};

When I print this structure to disk, with g_tree_foreach, something
strange happens on Solaris. Some f_name entries get mangled. This
happened with glib 2.4.1 and glib 2.12.x. I should get:

16832 /export/home/miek/bin/.svn/text-base
33024 /export/home/miek/bin/.svn/text-base/VI.svn-base
...

But on Solaris I get:
33024 /export/hom
33024 /export/home/miek/bin/.svn/text-base/avi2vob.svn-base

On other machines this code works perfectly; linux amd64, linux powerpc, linux
i386 and freebsd i386. All do it ok.

Could this be a GTree issue on Solaris? I'm really stuck with it :(

Regards, Miek
--
grtz,
  - Miek

  http://www.miek.nl
  PGP: 6A3C F450 6D4E 7C6B C23C  F982 258B 85CF 3880 D0F6

_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list

signature.asc (198 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Solaris, glib and GTree

Tim-Philipp Müller
On Fri, 2006-10-13 at 11:17 +0200, Miek Gieben wrote:

> I'm using glib in my tools to create a tree (GTree) with
> pathnames and some data (from stat(2)). I'm using this
> structure as the key:
>  (...)
> When I print this structure to disk, with g_tree_foreach, something
> strange happens on Solaris. Some f_name entries get mangled. This
> happened with glib 2.4.1 and glib 2.12.x.
>  (...)
> Could this be a GTree issue on Solaris? I'm really stuck with it :(

Unlikely that this is an issue with the GTree code, but it's hard to say
without seeing your code. The best way to get some feedback/help is to
make a small test case and attach it or put it up somewhere so people
can have a look at what you're doing exactly.

Cheers
 -Tim


_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Solaris, glib and GTree

Miek Gieben-2
[On 13 Oct, @12:45, Tim Müller wrote in "Re: Solaris, glib and GTree ..."]

> On Fri, 2006-10-13 at 11:17 +0200, Miek Gieben wrote:
>
> > I'm using glib in my tools to create a tree (GTree) with
> > pathnames and some data (from stat(2)). I'm using this
> > structure as the key:
> >  (...)
> > When I print this structure to disk, with g_tree_foreach, something
> > strange happens on Solaris. Some f_name entries get mangled. This
> > happened with glib 2.4.1 and glib 2.12.x.
> >  (...)
> > Could this be a GTree issue on Solaris? I'm really stuck with it :(
>
> Unlikely that this is an issue with the GTree code, but it's hard to say
> without seeing your code. The best way to get some feedback/help is to
> make a small test case and attach it or put it up somewhere so people
> can have a look at what you're doing exactly.
The code is already fairly small, that was part of the plan :)
You can get the from
http://miek.nl/projects/rdup/rdup-0.2.17.tar.bz2

The normal, configure && make should to the trick.

If you run:
rm -f LIST t && rdup -Nt LIST ~

you get a list of the files in your home in 'LIST'
This list should look normal, on Solaris it's almost normal.

What this does is: crawl ~ (in crawler.c) and fill a GTree with
the path data, essentially this data is then written to disk.
All the GTree functions are grouped in gfunc.c, but to me these
look al harmless. I suspect a coding error in crawler.c, but then
again, why does it only fail on Solaris.

grtz Miek

_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list

signature.asc (198 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Solaris, glib and GTree

Miek Gieben-2
In reply to this post by Tim-Philipp Müller
[On 13 Oct, @12:45, Tim Müller wrote in "Re: Solaris, glib and GTree ..."]

> On Fri, 2006-10-13 at 11:17 +0200, Miek Gieben wrote:
>
> > I'm using glib in my tools to create a tree (GTree) with
> > pathnames and some data (from stat(2)). I'm using this
> > structure as the key:
> >  (...)
> > When I print this structure to disk, with g_tree_foreach, something
> > strange happens on Solaris. Some f_name entries get mangled. This
> > happened with glib 2.4.1 and glib 2.12.x.
> >  (...)
> > Could this be a GTree issue on Solaris? I'm really stuck with it :(
>
> Unlikely that this is an issue with the GTree code, but it's hard to say
> without seeing your code. The best way to get some feedback/help is to
> make a small test case and attach it or put it up somewhere so people
> can have a look at what you're doing exactly.
I can let it crash now, but I can't make heads nor tail from the
output I get from gdb:

Segmentation Fault (core dumped)
-bash-3.00$ gdb rdup core
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
<SNIP>
(gdb) where
#0  0xff340e30 in memcpy () from /platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
#1  0xff114580 in _dowrite () from /lib/libc.so.1
#2  0xff116fd4 in _ndoprnt () from /lib/libc.so.1
#3  0xff118268 in fprintf () from /lib/libc.so.1
#4  0x00013b98 in gfunc_write (r=0x4c4c0, ze_t=0x1, fp=0x26638) at gfunc.c:297
#5  0xff2d8f08 in g_tree_foreach (tree=0x4a968, func=0x13b0c <gfunc_write>, user_data=0x26638) at gtree.c:821
#6  0x00012d68 in main (argc=2, argv=0xffbffd88) at rdup.c:299
(gdb) f 4
#4  0x00013b98 in gfunc_write (r=0x4c4c0, ze_t=0x1, fp=0x26638) at gfunc.c:297
297             fprintf((FILE*) fp, "%d %d %s\n", (int) e->f_mode, e->f_name_size, e->f_name);
(gdb) print e
$1 = (struct entry *) 0x4c4c0
(gdb) print e->f_mode
$2 = 33188
(gdb) print e->f_name_size
$3 = 46
(gdb) print e->f_name
$4 = 0x4cf60 "/tmp/BA/export/home/miek/trunk/debian/prerm.ex"

So the value look valid, but still it crashes??? Very weird this.

grtz Miek


_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list

signature.asc (198 bytes) Download Attachment