[elinks-users] garbled error messages

Jonas Fonseca fonseca at diku.dk
Fri May 6 11:47:47 PDT 2005


Miciah Dashiel Butler Masters <miciah at myrealbox.com> wrote Fri, May 06, 2005:
> On Fri, May 06, 2005 at 01:50:24PM +0100, Jon Shapcott wrote:
> > [...]
> > > Jon Shapcott <eden at xibalba.demon.co.uk> wrote Fri, May 06, 2005:
> > > > During my current hacking, I've had some trouble with the alert_lua_error
> > > > function. Instead of displaying the desired message, it prints some garbled
> > > > text instead. I've checked that I'm not feeding it broken messages by
> > > > printing them to stderr as well, and checking that output. Is this a known
> > > > problem? If so, is there any known way of kicking it into proper behaviour?
> > [...]
> > Sorry for the second response. I'm hacking elinks-0.10.5. I've tracked the
> > text for alert_lua_error through open_box and msg_box in src/bfu/msg_box.c,
> > and add_dlg_text in src/bfu/text.c. It doesn't get garbled in any of those
> > places, so I must be stamped on somewhere between there and being displayed.
> > As I was doing this, every now and then the leading part of the string would
> > be be mangled,, but the trailing part of the text would be shown normally.
> 
> Here is my guess: Something changes (maybe frees) the string after
> passing it to alert_lua_error, which never does a strdup or similar.

This sounds very likely.

> RCS file: /home/cvs/elinks/elinks/src/scripting/lua/core.c,v
> retrieving revision 1.198
> diff -u -u -r1.198 core.c
> --- core.c      29 Apr 2005 07:40:52 -0000      1.198
> +++ core.c      6 May 2005 17:01:03 -0000
> @@ -717,9 +717,9 @@
>  alert_lua_error(unsigned char *msg)
>  {
>         if (errterm) {
> -               info_box(errterm, MSGBOX_NO_TEXT_INTL,
> +               info_box(errterm, MSGBOX_NO_TEXT_INTL, MSGBOX_FREE_TEXT,

                                    MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT,

The two MSGBOX flags should be ORed together.

>                         N_("Lua Error"), ALIGN_LEFT,
> -                       msg);
> +                       stracpy(msg));
>                 return;
>         }
> [...]
> > It looks like this sort of work is best done on the unstable version. Is the
> > unstable version updated daily on the download page?
> 
> Yes, when nothing is broken. [...]

Hmm, maybe the mail from failing crontabs should be forwarded! ;)

-- 
Jonas Fonseca



More information about the elinks-users mailing list