gtkdialog1-1.4

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#201 Post by Iguleder »

Here's the Valgrind log :P
Attachments
valgrind.log.gz
(14 KiB) Downloaded 281 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#202 Post by technosaurus »

IIRC Rich (musl dev) mentiioned something about sbrk syscall used to implement malloc and his malloc implementation having issues with custom mallocs .... My guess is gtk1 either implements its own by default or there is an issue recognizing musl's version due to differences in how musl organizes header files (not incorrect, but different than glibc)

You could probably modify gtk1's ifdef to always. Use the system's *alloc functions.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#203 Post by Iguleder »

Nope - neither gtk or glib implement malloc() or brk().

EDIT: here's the patch required for GTK2 on x86_64. Still debugging GTK1.

EDIT 2: some good progress! When I build against GTK1, glib1 and glibc on Debian Sid, I face some issue with malloc() - I guess both glibc and musl are affected by the same bug, despite of the fact musl doesn't crash:

Code: Select all

gtkdialog1: malloc.c:2368: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

Code: Select all

#0  0x00007ffff5f6a3a9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff5f6d4c8 in __GI_abort () at abort.c:89
#2  0x00007ffff5facd0d in __malloc_assert (
    assertion=assertion@entry=0x7ffff609bc40 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7ffff60976d1 "malloc.c", 
    line=line@entry=2368, function=function@entry=0x7ffff6097a58 <__func__.11276> "sysmalloc") at malloc.c:290
#3  0x00007ffff5faf889 in sysmalloc (av=0x7ffff62d8620 <main_arena>, nb=32) at malloc.c:2365
#4  _int_malloc (av=0x7ffff62d8620 <main_arena>, bytes=10) at malloc.c:3743
#5  0x00007ffff5fb0c80 in __GI___libc_malloc (bytes=10) at malloc.c:2858
#6  0x00007ffff73a1e77 in g_malloc (size=10) at gmem.c:177
#7  0x00007ffff73acc9e in g_strdup (str=0x7ffff7bae523 "GtkWidget") at gstrfuncs.c:87
#8  0x00007ffff7b69cf0 in gtk_type_unique (parent_type=21, type_info=0x7ffff7dd6080 <widget_info.12569>) at gtktypeutils.c:251
#9  0x00007ffff7b75ee2 in gtk_widget_get_type () at gtkwidget.c:247
#10 0x00007ffff7a7d080 in gtk_container_get_type () at gtkcontainer.c:136
#11 0x00007ffff7a44575 in gtk_bin_get_type () at gtkbin.c:71
#12 0x00007ffff7b86295 in gtk_window_get_type () at gtkwindow.c:188
#13 0x00007ffff7b86b10 in gtk_window_new (type=GTK_WINDOW_TOPLEVEL) at gtkwindow.c:390
#14 0x000000000040d803 in run_program () at automaton.c:474
#15 0x000000000040a550 in yywrap () at parser.y:399
#16 0x000000000040b6e9 in yylex () at lexer.c:2321
#17 0x0000000000409925 in yyparse () at parser.c:2043
#18 0x0000000000407bb4 in main (argc=2, argv=0x7fffffffe648) at main.c:261
Attachments
gtkdialog1-x86_64.patch.gz
(634 Bytes) Downloaded 281 times

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#204 Post by Iguleder »

There you go.

Works with GTK1 on Debian Sid. The problem was a severe heap corruption that screwed up malloc() badly, caused by uninitialized variables in compat.c. I tried to attack this bug through 5 vectors and all of them failed because I ended up debugging glib's hash table code (which is impossible to debug, all meaningful data is hashed :lol:).

When I built gtkdialog against glibc, I used MALLOC_CHECK_=1 and found out the upper heap blocks got bombed by gtkdialog, so I decided to build an unoptimized gtkdialog (-O0 -g) and saw new errors, this time in compat.c (OUR code, not glib's). Long story short - many pixmap-related errors showed up, so I traced uninitialized memory issues until I found these variables.

Took two days to debug, but eventually, Puppy Linux won again. :D

EDIT: doesn't work with my static musl/glib/gtk1 combo, I think one of Debian's GTK patches is required.
Attachments
gtkdialog.png
(421 Bytes) Downloaded 431 times
GtkDialog1-1.3-gtk1-x86_64.patch.gz
(2.17 KiB) Downloaded 292 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#205 Post by goingnuts »

Congratulations! And thank you for all your effort! We include your patch in future release.

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#206 Post by Iguleder »

I don't know why, the patch was rejected when I built the static GTK1 gtkdialog, so the result binary did not include the fix.

Here's a re-generated patch that works.
Attachments
gtkdialog1-x86_64.patch.gz
(2.18 KiB) Downloaded 284 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#207 Post by goingnuts »

Adding examples:
* A simple calculator using awk & gtkdialog1
* A simple text editor
Attachments
snap0003.png
(31.9 KiB) Downloaded 259 times
notedad.tar.gz
(2.91 KiB) Downloaded 209 times
calc.sh.tar.gz
(4.1 KiB) Downloaded 216 times
snap0002.png
(5.36 KiB) Downloaded 273 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#208 Post by goingnuts »

And with some fear - on this special date - I announce the release of gtkdialog1-1.4 - view first post for download link.
Directly from the ChangeLog:

- Released as gtkdialog1-1.4.tar.gz
- configure.in bumped version to 1.4 and regenerate configure script
- finally fixed window launch and window close
- introduced sort in table by clicking headers
- introduced multiple select in table
- introduced autoset column size for columns in table
- introduced pixmap refresh
- fixed xpm images not resizing
- clean up code/functions in image handling
- gtk1 filechooser strip trailing "/" like gtk2 filechooser does
- added examples and fixed various mistakes
- patches for x86_64 kindly supplied by Iguleder applied

Attached image shows the gtk1 version running one of the included examples, xarchive2.
Attachments
snap0000.png
(90.3 KiB) Downloaded 236 times

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#209 Post by disciple »

Is there any chance of an advertising blurb in the first post or something?
How has it changed from the "original" gtkdialog1? What features are still missing compared to later gtkdialogs?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#210 Post by goingnuts »

Excellent suggestion! I will work on that. Meanwhile consider gtkdialog1 as a program which shares some of the historical code with newer versions of gtkdialog but with main focus on working for both gtk1 & gtk2 and with a limited number of widgets and functionality. Its more an advanced Xdialog (without the ncurses compatibility).

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#211 Post by technosaurus »

Nice, good to see the progress. You kinda fell off the map for a bit.

Would it be worth while to build all of my diffs from the original gtkdialog and the gtkdialog1 work into a unified history on github?

I've also been meaning to ask around about setting up a small distro "team" on github.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#212 Post by goingnuts »

Would it be worth while to build all of my diffs from the original gtkdialog and the gtkdialog1 work into a unified history on github?
Yes - I think that could be helpful if someone need to view the different steps that has been taken. I tend to change the code more for my own needs than for showing the diff from version to version...

Trying to do the documentation atm. - revising doc/gtkdialog.texi file. Thought that it is of more value than a comparison between newer versions of gtkdialog. And it might pinpoint bugs that needs fixing or simple enhancements to be included.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#213 Post by goingnuts »

Manual in html formate attached in first post.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#214 Post by technosaurus »

I found out from here that git comes with a perl script that exports a series of tarballs to a git history.

... right after I finally got rid of perl
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply