[PD-dev] [ pure-data-Bugs-1359216 ] print character 123 freezes gui

SourceForge.net noreply at sourceforge.net
Tue May 2 13:17:38 CEST 2006


Bugs item #1359216, was opened at 2005-11-17 19:14
Message generated for change (Comment added) made by claudiusmaximus
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1359216&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: print character 123 freezes gui

Initial Comment:
On WinXP and Miller's pd039_test7 typing '{' (ascii
123) after print in an object box hangs the gui,
apparently because the tcl is waiting for a closing '}'
before proceeding.

In the source code, dopost() in s_print.c, it looks
like four characters are  escaped: '\', '{', '}', and ';'.
But if they are escaped they should not freeze the gui...

static void dopost(const char *s)
{
...
           if (c == '\\' || c == '{' || c == '}' || c
== ';') <- if  it's a dangerous character for tcl
               upbuf[ptout++] = '\\'; <- add a
backslash before the  dangerous character
           upbuf[ptout] = s[ptin]; <- then put the
character
...
       sys_vgui("pdtk_post {%s}\n", upbuf); <- then
send it to tcl  interpreter

If I try entering them in a print box I get different
results. '\' and  '}' are rejected:
\}: dropped
\\: dropped
';' is accepted
'{' freezes the gui.

In g_editor.c:

void canvas_key(t_canvas *x, t_symbol *s, int ac,
t_atom *av)
{

...
   if (keynum == '\\' || keynum == '{' || keynum ==
'}') <-a dangerous  character
   {
       post("%c: dropped", (int)keynum); <-should be
dropped, but for  '{' this doesn't get printed
       return;
   }
...dopost() is called from post() so '{' is causing
trouble even when  it is escaped with a backslash.

Submitted by Martin Peach
martinrp at vax2.condordia.ca


----------------------------------------------------------------------

Comment By: ClaudiusMaximus (claudiusmaximus)
Date: 2006-05-02 11:17

Message:
Logged In: YES 
user_id=769033

In pd-0.39-2, typing { in a new object box hangs pd-gui
until you type a corresponding }, at which point the
following is printed in the console:

\{: dropped
\{: dropped
\}: dropped
\}: dropped

The text typed (exclusively) between { and } is entered into
the object box when the } is typed, too.


----------------------------------------------------------------------

Comment By: Thomas Grill (xovo)
Date: 2005-12-07 01:49

Message:
Logged In: YES 
user_id=350252

second:

it's pretty clear that the bug must be in the socket
receiver code for pd.tk inside t_tkcmd.c. In pd_readsocket
starting with line 168 it says: 
/* search for locations that terminate a complete TK
command.  These are carriage returns which are not inside
any braces.  Braces can be escaped with backslashes (but
backslashes themselves can't.) */

When a "{: dropped" post comes in, the code in pd_readsocket
must get confused because a brace is opened but none closed.
There's no command-delimiting newline character found in
that case.


----------------------------------------------------------------------

Comment By: Thomas Grill (xovo)
Date: 2005-12-07 01:08

Message:
Logged In: YES 
user_id=350252

first, Matju 's fixes for the dopost function in s_print.c

static void dopost(const char *s) 
{
    if (sys_printhook) 
        (*sys_printhook)(s);
    else if (sys_printtostderr)
        fprintf(stderr, "%s", s);
    else 
    {
        char upbuf[MAXPDSTRING];
        int i,j=0;
        for(i=0; s[i] && j<MAXPDSTRING-16; i++) 
        {
            if (strchr("\\\"[]$\n",s[i])) upbuf[j++]='\\';
	        if (s[i]=='\n') upbuf[j++]='n'; 
            else upbuf[j++] = s[i];
        }
        upbuf[j] = 0;
        sys_vgui("pdtk_post \"%s\"\n",upbuf);
    }
}


----------------------------------------------------------------------

Comment By: Mathieu Bouchard (matju)
Date: 2005-12-03 06:57

Message:
Logged In: YES 
user_id=801174

fixed in DesireData today. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1359216&group_id=55736




More information about the Pd-dev mailing list