views:

130

answers:

0

I'm encountering strange permission issues with Perforce when running it from a NAnt script - but only if that NAnt script is kicked off from a PHP script. Hopefully someone can enlighten me as to what's going on!

I've got a PHP script running in an application pool that is set up to use the "build.user" user account. The script currently looks like this:

<?php
echo exec("whoami");
exec("c:\\windows\\system32\\cmd.exe /c d:\\nant\\bin\\Nant.exe -v /f:d:\\build\\test.build test.build.target > d:\\build\\test.build.log");
?>

When run in a browser, it spits out domain\build.user. So far so good.

The NAnt script looks like this:

<?xml version="1.0"?>
<project name="test" basedir=".">
    <target name="test.build.target">
        <echo message="Local appdata path: ${environment::get-folder-path('LocalApplicationData')}" />
        <exec program="whoami.exe" />

        <echo message="==========================================================================================" />
        <exec program="c:\program files\perforce\p4.exe" failonerror="false">
            <arg value="set" />
        </exec>

        <echo message="==========================================================================================" />
        <exec program="c:\program files\perforce\p4.exe" failonerror="false">
            <arg value="where" />
            <arg value="//depot1/folder/file.ext" />
        </exec>
    </target>
</project>

And the relevant log file output:

[echo] Local appdata path: C:\Documents and Settings\Default User\Local Settings\Application Data
[exec] Starting 'whoami.exe ()' in 'd:\build'
[exec] domain\build.user
[echo] ==========================================================================================
[exec] Starting 'c:\program files\perforce\p4.exe (set)' in 'd:\build'
[exec] P4CLIENT=build_depot (set)
[exec] P4PASSWD=Password (set)
[exec] P4PORT=source01.domain.com:1666 (set)
[exec] P4USER=build.user (set)
[echo] ==========================================================================================
[exec] Starting 'c:\program files\perforce\p4.exe (where //depot1/folder/file.ext)' in 'd:\build'
[exec] Perforce password (P4PASSWD) invalid or unset.
[exec] d:\build\test.build(13,4):
[exec] External Program Failed: c:\program files\perforce\p4.exe (return code was 1)

So my two main questions are:

  1. Why is the local appdata path the "Default User" path instead of the "build.user" path, given that WhoAmI reports build.user as the current user?
  2. Why is P4 responding that P4PASSWD is invalid/unset when it's clearly valid and set?