[PD-dev] [PD] Problem in os x 10.5.1?

David Plans Casal dataflow at davidcasal.com
Sun Feb 10 21:13:30 CET 2008


Hey

Now that we have a nice clean SVN repo, can I just use svn diff and  
apply this patch myself?

And if so, what's the appropriate branch? branches/pd? branches / pd /  
pd-0.40-3?

David

On 10 Feb 2008, at 18:19, David Plans Casal wrote:

> Hi
>
> Russell was right and the sys_guicmd seems to have been the culprit,
> causing all the (you must exec!) os x framework errors.
>
> His patch places that call _before_ the fork, and pd 0.41's s_inter.c
> seems happier now. I've just tested through gdb and I see no errors.
>
> I've now filed a patch (# 1890705) on the tracker which fixes it.
>
> David
>
> On 1 Feb 2008, at 17:03, Miller Puckette wrote:
>
>> Aha, somehow I had persuaded myself that teh problem was when
>> starting from
>> the "App" (in which case Tcl/TK fork/execs pd) but now I gather it's
>> when
>> you start Pd from a shell so that it starts Tcl/Tk instead.  I'll go
>> try
>> that and see if I can make it fail for me :)
>>
>> M
>>
>> On Fri, Feb 01, 2008 at 08:54:17AM -0600, Russell Bryant wrote:
>>> David Plans Casal wrote:
>>>> I can't quite tell why it's complaining (since we -do- call execl),
>>>> but of course there is a whole lot of sprintf going on between the
>>>> two, so...
>>>
>>> It's extremely unlikely that any of the string handling is the
>>> problem.
>>> However, there are also a bunch of calls to stat() as well as a
>>> call to
>>> seteuid() which are more likely.
>>>
>>>> Any suggestions, anyone?
>>>
>>> Try the attached patch to see if moving building the sys_guicmd to
>>> before the
>>> fork fixes it.  If it doesn't, try commenting out the call to
>>> seteuid().
>>> Between those two, you should be able to find out what it's
>>> complaining about.
>>>
>>> On a sidenote, the string handling here is not safe.  It will crash
>>> if the path
>>> to your home directory is a lot longer than usual ...
>>>
>>> --
>>> Russell Bryant
>>
>>> Index: s_inter.c
>>> ===================================================================
>>> RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v
>>> retrieving revision 1.22
>>> diff -u -r1.22 s_inter.c
>>> --- s_inter.c	16 Jan 2008 21:54:11 -0000	1.22
>>> +++ s_inter.c	1 Feb 2008 14:43:37 -0000
>>> @@ -1018,6 +1018,73 @@
>>>
>>>
>>> #ifdef UNISTD
>>> +        if (!sys_guicmd) {
>>> +#ifdef __APPLE__
>>> +            char *homedir = getenv("HOME"), filename[250];
>>> +            struct stat statbuf;
>>> +                /* first look for Wish bundled with and renamed
>>> "Pd" */
>>> +            sprintf(filename, "%s/../../MacOS/Pd", guidir);
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            if (!homedir || strlen(homedir) > 150)
>>> +                goto nohomedir;
>>> +                /* Look for Wish in user's Applications.  Might or
>>> might
>>> +                not be names "Wish Shell", and might or might not  
>>> be
>>> +                in "Utilities" subdir. */
>>> +            sprintf(filename,
>>> +                "%s/Applications/Utilities/Wish shell.app/Contents/
>>> MacOS/Wish Shell",
>>> +                    homedir);
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            sprintf(filename,
>>> +                "%s/Applications/Utilities/Wish.app/Contents/MacOS/
>>> Wish",
>>> +                    homedir);
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            sprintf(filename,
>>> +                "%s/Applications/Wish shell.app/Contents/MacOS/
>>> Wish Shell",
>>> +                    homedir);
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            sprintf(filename,
>>> +                "%s/Applications/Wish.app/Contents/MacOS/Wish",
>>> +                    homedir);
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +        nohomedir:
>>> +                /* Perform the same search among system
>>> applications. */
>>> +            strcpy(filename,
>>> +                "/usr/bin/wish");
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            strcpy(filename,
>>> +                "/Applications/Utilities/Wish Shell.app/Contents/
>>> MacOS/Wish Shell");
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            strcpy(filename,
>>> +                "/Applications/Utilities/Wish.app/Contents/MacOS/
>>> Wish");
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            strcpy(filename,
>>> +                "/Applications/Wish Shell.app/Contents/MacOS/Wish
>>> Shell");
>>> +            if (stat(filename, &statbuf) >= 0)
>>> +                goto foundit;
>>> +            strcpy(filename,
>>> +                "/Applications/Wish.app/Contents/MacOS/Wish");
>>> +        foundit:
>>> +            sprintf(cmdbuf, "\"%s\" %s/pd.tk %d\n", filename,
>>> guidir, portno);
>>> +#else
>>> +            sprintf(cmdbuf,
>>> +                "TCL_LIBRARY=\"%s/tcl/library\" TK_LIBRARY=\"%s/tk/
>>> library\" \
>>> +                 \"%s/pd-gui\" %d\n",
>>> +                 sys_libdir->s_name, sys_libdir->s_name, guidir,
>>> portno);
>>> +#endif
>>> +            sys_guicmd = cmdbuf;
>>> +        }
>>> +
>>> +        if (sys_verbose)
>>> +            fprintf(stderr, "%s", sys_guicmd);
>>> +
>>>        childpid = fork();
>>>        if (childpid < 0)
>>>        {
>>> @@ -1045,75 +1112,10 @@
>>>                }
>>>            }
>>> #endif
>>> -            if (!sys_guicmd)
>>> -            {
>>> -#ifdef __APPLE__
>>> -                char *homedir = getenv("HOME"), filename[250];
>>> -                struct stat statbuf;
>>> -                    /* first look for Wish bundled with and
>>> renamed "Pd" */
>>> -                sprintf(filename, "%s/../../MacOS/Pd", guidir);
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                if (!homedir || strlen(homedir) > 150)
>>> -                    goto nohomedir;
>>> -                    /* Look for Wish in user's Applications.
>>> Might or might
>>> -                    not be names "Wish Shell", and might or might
>>> not be
>>> -                    in "Utilities" subdir. */
>>> -                sprintf(filename,
>>> -                    "%s/Applications/Utilities/Wish shell.app/
>>> Contents/MacOS/Wish Shell",
>>> -                        homedir);
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                sprintf(filename,
>>> -                    "%s/Applications/Utilities/Wish.app/Contents/
>>> MacOS/Wish",
>>> -                        homedir);
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                sprintf(filename,
>>> -                    "%s/Applications/Wish shell.app/Contents/MacOS/
>>> Wish Shell",
>>> -                        homedir);
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                sprintf(filename,
>>> -                    "%s/Applications/Wish.app/Contents/MacOS/Wish",
>>> -                        homedir);
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -            nohomedir:
>>> -                    /* Perform the same search among system
>>> applications. */
>>> -                strcpy(filename,
>>> -                    "/usr/bin/wish");
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                strcpy(filename,
>>> -                    "/Applications/Utilities/Wish Shell.app/
>>> Contents/MacOS/Wish Shell");
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                strcpy(filename,
>>> -                    "/Applications/Utilities/Wish.app/Contents/
>>> MacOS/Wish");
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                strcpy(filename,
>>> -                    "/Applications/Wish Shell.app/Contents/MacOS/
>>> Wish Shell");
>>> -                if (stat(filename, &statbuf) >= 0)
>>> -                    goto foundit;
>>> -                strcpy(filename,
>>> -                    "/Applications/Wish.app/Contents/MacOS/Wish");
>>> -            foundit:
>>> -                sprintf(cmdbuf, "\"%s\" %s/pd.tk %d\n", filename,
>>> guidir, portno);
>>> -#else
>>> -                sprintf(cmdbuf,
>>> -"TCL_LIBRARY=\"%s/tcl/library\" TK_LIBRARY=\"%s/tk/library\" \
>>> - \"%s/pd-gui\" %d\n",
>>> -                    sys_libdir->s_name, sys_libdir->s_name,
>>> guidir, portno);
>>> -#endif
>>> -                sys_guicmd = cmdbuf;
>>> -            }
>>> -            if (sys_verbose) fprintf(stderr, "%s", sys_guicmd);
>>>            execl("/bin/sh", "sh", "-c", sys_guicmd, (char*)0);
>>>            perror("pd: exec");
>>>            _exit(1);
>>> -        }
>>> +       }
>>> #endif /* UNISTD */
>>>
>>> #ifdef MSW
>>
>>> _______________________________________________
>>> PD-dev mailing list
>>> PD-dev at iem.at
>>> http://lists.puredata.info/listinfo/pd-dev
>>
>
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev





More information about the Pd-dev mailing list