[PD] makefilename-bug (was: number to symbol)
Hans-Christoph Steiner
hans at eds.org
Thu Nov 17 19:29:33 CET 2005
It would be great to have all this info in a bug report:
http://puredata.org/dev/bugtracker/
.hc
On Nov 17, 2005, at 11:41 AM, Martin Peach wrote:
> s.koepf wrote:
>
>>> the solution is pretty simple: pd does a very bad job when it comes
>>> to escaping special characters. "{" and "}" are such special
>>> characters (in tcl world); this is why they are banned from normal
>>> user-input.
>>> however, 123 is the ascii value of "{", and by using [symbol\ you
>>> are sending this special symbol to the pd-gui (tcl/tk!); now tcl
>>> uses "{" for starting a list and WAITS for "}" to end the list.
>>> if you manage to send "}" (ascii 125) to the pd-gui, pd will
>>> unfreeze and everything is fine again.
>>>
>>> example:
>>>
>>> [123, 125(
>>> |
>>> [makefilename %c]
>>> |
>>> [symbol\
>>>
>>
>> Thanks IOhannes,
>>
>> I followed many ot those dicussions on the subject on this list, but
>> what I never saw is a complete list of all "dangerous" characters in
>> pd/tcl/tk. Would be nice to have one.
>>
> Here on WinXP and Miller's pd039_test7 it's the [print] that does it.
> [symbol] on its own is OK.
> In the source code 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.
>
>
>
> Martin
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
________________________________________________________________________
____
Using ReBirth is like trying to play an 808 with a long stick.
-David Zicarelli
More information about the Pd-list
mailing list