Chimera-1.70p1 - old browser reborn...

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

Chimera-1.70p1 - old browser reborn...

#1 Post by goingnuts »

In my search for tiny graphical browsers I have found chimera and spend some time getting it to compile and tried to fix various things. It compiles to approx. 620K static linked and do a decent job with todays web-pages. BUT it is not a stable program - you might experience segment fault. I have tried to track and fix errors but with limited success.
Attached archive with build script and my patches - contributions to further stabilize this old software are welcome!

My patches fix some javascript being showed, add possibility for showing png-images (unstable!) and various other fixes - view content of the diff-files in the archive for details.

Different sources for chimera can be found - latest seems to be at amigos repo: http://distro.ibiblio.org/amigolinux/do ... 01.tar.bz2
This contains some siag-oriented patches so I have tried to find last official source. This seems to be chimera_1.70p1 of which I got a copy from:
ftp://koyanet.lv/debian-archive/debian/ ... rig.tar.gz - dated 18 june 1999.

If you just want to try it - I have attached a pet of it.
Updated 20170620: New build pet and build script with further patches and fixes.
Source and binary for png2jpg.
Updated 20170704: New build pet and build script with further patches and fixes - most important update is use of stb_image for build in image handling of bmp, jpg, png a.o.
Attachments
chimera-1.70p1.orig-i486.pet
pet package...
(139.79 KiB) Downloaded 176 times
chimera-1.70p1_reborn.tar.gz
build script and patches
(70.22 KiB) Downloaded 141 times
png2jpg-1.1.tar.gz
png2jpg source and binary
(10.09 KiB) Downloaded 158 times
snap0000.jpg
(66.92 KiB) Downloaded 709 times
Last edited by goingnuts on Tue 04 Jul 2017, 15:12, edited 3 times in total.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#2 Post by Keef »

Tried it on the latest Slacko and also FatDog. It seems quite slow to load pages, and yes, it is a bit prone to crashing. It cannot find the homepage, but the pet puts it in
"/usr/X11R7/lib/X11/chimera/home.html".
Don't know if you know of this site:
http://browsers.evolt.org/
(couldn't make a clickable link without the post disappearing!)
Got lots of old and obscure browsers, including Chimera. The source looks the same as yours though.They have the source for 1.70p0 and also 2.0 alpha. The site looks dormant now.

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

#3 Post by goingnuts »

Hi Keef
Thank you for testing and reporting your findings! Yes - it seems slow and unfortunately crashes a great deal. I will look into the not finding homepage - probably setting it in /etc/X11/app-defaults/Chimera can fix it - or fix HOME_URL ref at compile time.
Did not know about http://browsers.evolt.org/ - will look at that.
I tried to work with chimera-2 but it has an unforgivable bug not showing http://www.murga-linux.com/puppy/index.php correctly after loading and scrolling - although it has attractive build in image handling.

My hope is that bugs in chimera-1.70p1 can be fixed and that speed can be improved. Compared to dillo and links2 the speed is horrible - but the size is 1/2 to 1/4 when static linked...fits well to a single floppy distro.

I have tried to debug using gdb and valgrind but most of the output from these programs I do not understand.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#4 Post by slavvo67 »

Any known security issues with using? I want to test her out but I'm a little reluctant because of potential security holes normally found with older browsers.

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

#5 Post by goingnuts »

I have no idea - expect holes as code is before security was major concern. And how do we test if holes exist?

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#6 Post by amigo »

GN, you are such a brave fellow! I think I was probably the last guy to get that to compile before you -and probably nobody else had the idea.

I wish you had done some work on the old /CGTK1 dillo browser. I have a pretty patched up version with tabs, drag-n-drop and a few other things, and a separate version which can be compiled using either gtk or gtk2. Unfortunately, the tabs patch touches major parts of the code and never could finish integrating the gtk2 changes into the other version. Gladly send you tarballs if you want them. Old dillo with all the above, plus optional javascript support would be great.

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

#7 Post by goingnuts »

Thanks amigo - you know why I focused on chimera :)
I wish old dillo was 50% in size as it is fast and stable but for the moment I will focus on stabilising chimera.
I even found viola (https://en.m.wikipedia.org/wiki/ViolaWWW) and got it to compile, but I never made it actually show a webpage.
Most old graphical browsers from the 90.th. needs Motif but viola has a Xlib only version. Too big though, so did not spend a lot of time with it.
Wish I had better programming and debugging skills but probably too late to catch up on that...

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

#8 Post by goingnuts »

Small steps forward using valgrind - below output from valgrind obtained by starting chimera and then quit:

Code: Select all

# valgrind --leak-check=full src/./chimera
==8029== Memcheck, a memory error detector
==8029== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==8029== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==8029== Command: src/./chimera
...
==8029== Invalid write of size 1
==8029==    at 0x8052941: ReadIndexFilenames (local.c:86)
...
==8029== Invalid read of size 1
==8029==    at 0x8052946: ReadIndexFilenames (local.c:86)
patch to get rid of this:

Code: Select all

--- ./src/local.c.01	2017-06-11 10:50:48.000000000 +0000
+++ ./src/local.c	2017-06-11 10:51:12.000000000 +0000
@@ -81,7 +81,7 @@
     *ilist = (char *)NULL;
     return;
   }
-  filenames = (char *)alloc_mem(sl * sizeof(char));
+  filenames = (char *)alloc_mem(sl * sizeof(char)+1);
   colons = 2;			/* count final delimiters */
   for (cp=filelist,cp2=filenames; (*cp2 = *cp) != '\0'; cp++,cp2++)
   {
After recompile rerun valgrind:

Code: Select all

# valgrind --leak-check=full src/./chimera
==8029== Memcheck, a memory error detector
==8029== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==8029== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==8029== Command: src/./chimera
==8029== 
==8029== Conditional jump or move depends on uninitialised value(s)
==8029==    at 0x8060030: ViewRedisplay (HTML.c:1815)
Rerun valgrind with:

Code: Select all

# valgrind --track-origins=yes src/./chimera
==13396== Memcheck, a memory error detector
==13396== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==13396== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==13396== Command: src/./chimera
==13396== 
==13396== Conditional jump or move depends on uninitialised value(s)
==13396==    at 0x8060030: ViewRedisplay (HTML.c:1815)
...
==13396==    by 0x80537B3: main (main.c:297)
==13396==  Uninitialised value was created by a stack allocation
==13396==    at 0x806014E: ViewClearAndRefresh (HTML.c:1870)
The codepart at HTML.c:1870 can be disabled by removing CFLAG "-DFAKE_EXPOSE".
So recompile without it removes this. Leaving us with this report:

Code: Select all

# valgrind --leak-check=full src/./chimera
...
==15432== 87 bytes in 1 blocks are definitely lost in loss record 434 of 611
==15432==    at 0x401DEBC: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==15432==    by 0x407F192: XtMalloc (in /usr/lib/libXt.so.6.0.0)
==15432==    by 0x807DB2D: alloc_string (dmem.c:70)
==15432==    by 0x805A1DF: AddButtons (widget.c:81)
==15432==    by 0x805A5AA: CreateWidgets (widget.c:175)
==15432==    by 0x8053776: main (main.c:289)
which I havent been able to get rid of...

#########################
Now starting valgrind, open bookmarks, load google.com, dismiss bookmarks and quit:

Code: Select all

# valgrind --leak-check=full src/./chimera
...
==16708== Conditional jump or move depends on uninitialised value(s)
==16708==    at 0x804B562: HasExpired (cache.c:64)
==16708==    by 0x804C038: WriteCache (cache.c:501)
==16708==    by 0x80551E3: HandleDoc (main.c:1086)
==16708==    by 0x80557D0: OpenDocument (main.c:1286)
==16708==    by 0x8056AAD: BookmarkCallback (main.c:2281)
==16708==    by 0x407F75B: XtCallCallbackList (in /usr/lib/libXt.so.6.0.0)
==16708==    by 0x805D8AB: BMarkSelect (Bookmark.c:657)
==16708==    by 0x40B440E: HandleActions (in /usr/lib/libXt.so.6.0.0)
==16708==    by 0x40B4AFC: _XtTranslateEvent (in /usr/lib/libXt.so.6.0.0)
==16708==    by 0x408CBC9: XtDispatchEventToWidget (in /usr/lib/libXt.so.6.0.0)
==16708==    by 0x408D44A: _XtDefaultDispatcher (in /usr/lib/libXt.so.6.0.0)
==16708==    by 0x408C2EC: XtDispatchEvent (in /usr/lib/libXt.so.6.0.0)
==16708== 
==16708== Conditional jump or move depends on uninitialised value(s)
==16708==    at 0x804B56A: HasExpired (cache.c:64)
...
==16708==    by 0x408C2EC: XtDispatchEvent (in /usr/lib/libXt.so.6.0.0)
Rerun to get origins:

Code: Select all

# valgrind --track-origins=yes src/./chimera
...
==17369== Conditional jump or move depends on uninitialised value(s)
==17369==    at 0x804B562: HasExpired (cache.c:64)
==17369==    by 0x804C038: WriteCache (cache.c:501)
==17369==    by 0x80551E3: HandleDoc (main.c:1086)
==17369==    by 0x80557D0: OpenDocument (main.c:1286)
==17369==    by 0x8056AAD: BookmarkCallback (main.c:2281)
==17369==    by 0x407F75B: XtCallCallbackList (in /usr/lib/libXt.so.6.0.0)
==17369==    by 0x805D8AB: BMarkSelect (Bookmark.c:657)
==17369==    by 0x40B440E: HandleActions (in /usr/lib/libXt.so.6.0.0)
==17369==    by 0x40B4AFC: _XtTranslateEvent (in /usr/lib/libXt.so.6.0.0)
==17369==    by 0x408CBC9: XtDispatchEventToWidget (in /usr/lib/libXt.so.6.0.0)
==17369==    by 0x408D44A: _XtDefaultDispatcher (in /usr/lib/libXt.so.6.0.0)
==17369==    by 0x408C2EC: XtDispatchEvent (in /usr/lib/libXt.so.6.0.0)
==17369==  Uninitialised value was created by a stack allocation
==17369==    at 0x8057D91: ParseExpiresDate (mime.c:342)
==17369== 
==17369== Conditional jump or move depends on uninitialised value(s)
...
==17369==  Uninitialised value was created by a stack allocation
==17369==    at 0x8057D91: ParseExpiresDate (mime.c:342)
The code at mime.c:342 can be bypassed by removing CFLAG "-DHAVE_MKTIME" leaving us with:

Code: Select all

# valgrind --leak-check=full src/./chimera
==19308== Memcheck, a memory error detector
==19308== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==19308== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==19308== Command: src/./chimera
==19308== 
==19308== 
==19308== HEAP SUMMARY:
==19308==     in use at exit: 226,037 bytes in 2,965 blocks
==19308==   total heap usage: 9,589 allocs, 6,624 frees, 1,457,528 bytes allocated
==19308== 
==19308== 2 bytes in 2 blocks are definitely lost in loss record 12 of 698
==19308==    at 0x401DEBC: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==19308==    by 0x407F192: XtMalloc (in /usr/lib/libXt.so.6.0.0)
==19308==    by 0x807401B: MakeHiddenWidget (HTMLwidgets.c:1872)
==19308==    by 0x80752EB: MakeWidget (HTMLwidgets.c:2467)
==19308==    by 0x8069B57: TriggerMarkChanges (HTMLformat.c:3419)
==19308==    by 0x806ADAD: FormatChunk (HTMLformat.c:4163)
==19308==    by 0x806B17F: FormatAll (HTMLformat.c:4358)
==19308==    by 0x805F720: ReformatWindow (HTML.c:1468)
==19308==    by 0x8064674: HTMLSetText (HTML.c:5127)
==19308==    by 0x80543EB: DisplayCurrent (main.c:689)
==19308==    by 0x8055543: HandleDoc (main.c:1175)
==19308==    by 0x80557A0: OpenDocument (main.c:1286)
...
Which can be eliminated with:

Code: Select all

--- ./mxw/Bookmark.c.01	2017-06-11 12:41:12.000000000 +0000
+++ ./mxw/Bookmark.c	2017-06-11 12:41:26.000000000 +0000
@@ -666,7 +666,7 @@
   {
     XtAppWarning(BREC.appcon, BREC.noCurrentMark);
   }
-
+  XtFree ((char *) lr);
   return;
 }
 
After this valgrind says:

Code: Select all

 # valgrind --leak-check=full src/./chimera
...
==26353== 2 bytes in 2 blocks are definitely lost in loss record 12 of 696
==26353==    at 0x401DEBC: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==26353==    by 0x407F192: XtMalloc (in /usr/lib/libXt.so.6.0.0)
==26353==    by 0x8074027: MakeHiddenWidget (HTMLwidgets.c:1872)
This can be fixed with patch:

Code: Select all

--- ./libhtmlw/HTMLwidgets.c.01	2017-06-11 16:11:17.000000000 +0000
+++ ./libhtmlw/HTMLwidgets.c	2017-06-11 16:12:16.000000000 +0000
@@ -1869,7 +1869,7 @@
   char *value;
 
   value = ParseMarkTag (text, MT_INPUT, "VALUE");
-  if (value == NULL) XtNewString("");
+  //if (value == NULL) XtNewString("");
 
   return (AddNewWidget (hw, NULL, W_HIDDEN, id, x, y,
 			name, value, NULL, False));
 
###########
Loading other web pages shows loads of reports from valgrind - and who knows what my ignorant fixes introduce...

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#9 Post by slavvo67 »

I use howsmyssl.com but it seems Chimera didn't work with that website or it could be the version I'm using...

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#10 Post by BarryK »

Here is a paper describing how Chimera works:

https://www.researchgate.net/publicatio ... eb_browser
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#11 Post by BarryK »

Chimera 1.65 source, plus extra patch, available here:

http://jim.rees.org/apollo-archive/

goingnuts, I know you have a later version, but maybe the patch is useful?
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#12 Post by BarryK »

Chimera 2.0 goes up to a19 here:

https://archive.org/download/chimera-ev ... 2.0_alpha/

There is a patch to fix libpng crash for a19:

https://bugs.debian.org/cgi-bin/bugrepo ... bug=130902

a19 source is here, and a patches package:

https://packages.debian.org/jessie/chimera2

patches pkg:
chimera2_2.0a19-8.diff.gz
[url]https://bkhome.org/news/[/url]

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

#13 Post by goingnuts »

slavvo67: No https - at all.
BarryK: Thanks a lot - the png patch for 2.0a19 is very nice. Chimera2 is faster and more stable than 1.70p1 and it has build in jpeg and png support. Applied the full debian patch but had to disable the io.c and ChimeraStream.h patches to get google.com react on search submit.
None of the patches removed the missing fonts when scrolling/resizing window when on this forum though...if that could be fixed version2 would be the way to go.

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

#14 Post by goingnuts »

Chimera2 is indeed tempting - create smaller static linked binary, has build in png and jpg support and is more stable. BUT I haven't been able to create a static linked binary that actually works - major problems finding Xdisplay. Tracked down to version of Xlib but got no further.

So...continued with version 1.70 and managed to stabilize further. The png support now is almost stable. I have updated first post with new .pet, build script and added a png2jpeg-package. You need djpeg too - normally installed already.
https obvious not working and chimera is not very informative when web-pages fails to load...how hard is it to get https implemented???

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

#15 Post by goingnuts »

I have worked on "png2jpg" to reduce size and get bmp support.
Result is "img2jpg" which is based on stb_image and libjpeg.
Static linked bin is 95K and compressed with upx 50K. This compared to png2jpg based on libpng and libjpeg which was 159K and 83K upxed.
So "img2jpg" adds png and bmp support to chimera.

Chimera has build in support for gif, xbm, xpm and pbm.
png, jpg and bmp use external converters, img2jpg and djpeg.

To change from png2jpg to img2jpg revise the /usr/X11/lib/X11/chimera/convert:

Code: Select all

#inline image/png image/gif cat %s | png2jpg | djpeg -gif
inline image/png image/gif img2jpg -i %s -s | djpeg -gif
inline image/bmp image/gif img2jpg -i %s -s | djpeg -gif
To have Chimera recognize bmp the attached patch must be applied - it will be included in a later updated build-script.

Source and static linked bin in attachment.
Attachments
img2jpg-0.1.tar.gz
img2jpg source and bin
(150.81 KiB) Downloaded 146 times
chimera-1.70p1_17_mime.diff.gz
patch to add bmp recognition to Chimera
(328 Bytes) Downloaded 146 times

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

#16 Post by goingnuts »

Use of stb_image for build in image handling now working - so bmp, png, jpg, tga a.o image formats no more need external loaders. Uploaded new build script and patches - and a fresh pet-package - in first post.
Missing support for tif and svg but there might be solutions for that too.
Static linked bin using uclibc and tinyxlib (+upx) is now 290K...

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

#17 Post by technosaurus »

goingnuts wrote:Missing support for tif and svg but there might be solutions for that too.
My image viewer that you patched uses nanosvg which is quite small and uses the same output format as stb_image... does anyone come across tiff files in web pages anyhow? I'd probably add webp before tiff.

Edit:
There is another example patch to use them for an older version of jwm at https://gist.github.com/technosaurus/76 ... bdcc81d1fb
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:

#18 Post by goingnuts »

Unfortunatly chimera postproces the image delivered by stb_image so quality decrease. Tried a lot of different ways to modify the source to avoid this - but with no luck. Would be cool to let stb_image handle all images and stripout all original image code. Eventually use it as a cheap image browser as well.

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

#19 Post by technosaurus »

I'd have to look at the code, but i assume it has to do with resizing (there is another stb_* header for image resizing)... I'm currently moving, so will be posting from my phone till September, but if someone puts it on GitHub, I can take a look though.

IIRC, netsurf-framebuffer isn't much bigger statically compiled with xcb... most of the size is openSSL, but that could be eleminated by using curl equivalents and using a lighter SSL backend.
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:

#20 Post by goingnuts »

Resizing seems not the problem (chimera does not resize images) but more likely function "reduce" from xloadimage - reduces colors to max 256.
The external conversion from img->jpg and then from jpg->gif (via img2jpg and djpeg) gives no problems with image quality (but slow down browsing...).
So worked further with img2jpg and reduced bin size more by using tiny_jpeg.h to replace libjpeg (for writing jpg). Source attached.

If external image-conversion should be optimized further (in respect to chimera users) - a direct conversion from img2gif would be nice, but I found no simple gif-writer.

Also attached screen shot of chimera using internal stb_image (left image) and chimera using external img2jpg/djpeg (right image) - showing the decrease in image quality.
Attachments
snap0005.png
(197.3 KiB) Downloaded 296 times
img2jpg-0.2.tar.gz
(211.45 KiB) Downloaded 134 times

Post Reply