[Python-Dev] [Windows, buildbot] kill_python.c mystery

Neal Norwitz nnorwitz at gmail.com
Thu Jul 27 05:43:38 CEST 2006


On 7/26/06, Tim Peters <tim.peters at gmail.com> wrote:
>
> Today I noticed this happened when the buildbot started to run tests,
> and I'm 100% sure it's due to this code in
> Tools/buildbot/kill_python.c (the buildbot log files showed that
> kill_python.c killed /some/ Python process, and the Python running
> release-build tests in my sandbox was the only plausible candidate):
>
>         if ((strstr(path, "build\\pcbuild\\python_d.exe") != NULL) ||
>             (strstr(path, "build\\python.exe") != NULL)) {
>                 printf("Terminating %s (pid %d)\n", path, pids[i]);
>                 if (!TerminateProcess(hProcess, 1)) {
>
> The second clause in the first `if` looks for a substring match on:
>
>     build\python.exe
>
> and that just happens to match a suffix of:
>
>     C:\Code\python\PCbuild\python.exe
>
> which is the release-build Python I happen to be running in my sandbox.
>
> Why is the second clause there?  That is, are we /trying/ to kill a
> release-build Python running from the user's sandbox, and if so why?

No, I don't believe that was the intent.  The exe on cygwin uses the
unix convention, not the Windows convention for the filename.  ie,
either a debug
or release build on cygwin are both called python.exe.

So the second clause is there to kill the process when it's running
under cygwin.
It's interesting that the process appears to be running as
./python.exe, but build shows up in filename.  From that I deduce that
it must contain the complete path.  Assuming that is true, we can
change the code to ensure that build is a directory since that's what
buildbot does (add the leading \\):

>             (strstr(path, "\\build\\python.exe") != NULL)) {

I tested this change with a different path, so I believe it will work
fine and not catch PCbuild.  I'll check in this change and add some
comments.

n


More information about the Python-Dev mailing list