Pavel Lyalyakin <pavel.lyalya...@visualsvn.com> writes:

> [[
> Before Subversion calls a hook script, it removes all variables --
> including $PATH on Unix, and %PATH% on Windows -- from the
> environment. Therefore, your script can only run another program if
> you spell out that program's absolute name.
> ]]
>
> Is this statement true?
>
> I've just tested this with Windows 7 64bit and Apache Subversion
> 1.7.8: NO environment variables get removed.

It's certainly true for Unix platforms.  Subversion first calls
apr_procattr_cmdtype_set setting cmd=APR_PROGRAM and then calls
apr_proc_create passing env=NULL.  APR says that APR_PROGRAM doesn't
copy the environment.

On Unix the combination of APR_PROGRAM and env=NULL causes an empty
array to be passed to execve.  That gives an empty environment.

On Windows, as far as I can tell by looking at the code, it causes a
null pointer to be passed to CreateProcessW. The Microsoft documentation
says that will cause the environment to be inherited.

So it seems that there is a bug in apr_proc_create on Windows.
Subversion might be able to work around this bug by explicitly passing
an non-null, empty environment to apr_proc_create.

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download

Reply via email to