MSVC link.exe won't run smoothly as restricted user
---------------------------------------------------
Key: MPNATIVE-19
URL: http://jira.codehaus.org/browse/MPNATIVE-19
Project: maven-native-plugin
Issue Type: Bug
Environment: win32 (WinXP), Maven 2.0.4, JDK 1.4.2, JDK 1.5, JDK 1.6,
VS.NET 2003
Reporter: Hans-Gunnar Vold
Running Maven as a restricted user causes link.exe to fail since it wants to
write temporary files to C:\WINDOWS. TEMP and TMP variables are evidently
unset/ not set.
Possible solution: Set TMP and TEMP variables in environment factory to point
to the user's temp directory (i.e. C:\DOCUME~1\username\LOCALS~1\Temp).
Shouldn't be hardcoded to C:\ obviously.
I monitored file access using Sysinternals Filemon, here's a snippet:
198 09:03:25 link.exe:3812 QUERY INFORMATION C:\Program
Files\Microsoft Visual Studio .NET 2003\VC7\LIB\MSVCRTD.lib SUCCESS Length:
442910
199 09:03:25 link.exe:3812 QUERY INFORMATION C:\WINDOWS
SUCCESS Attributes: D
200 09:03:25 link.exe:3812 CREATE C:\WINDOWS\lnkED0.tmp ACCESS
DENIED username
201 09:03:25 link.exe:3812 CLOSE C:\Program Files\Microsoft
Visual Studio .NET 2003\VC7\LIB\MSVCRTD.lib SUCCESS
202 09:03:25 link.exe:3812 SET INFORMATION
D:\Eclipse\VersionTesting\jni-example\native\win32\target\hello.dll SUCCESS
Length: 0
Build output snippet:
[INFO] [native:link]
[INFO] link.exe /DEBUG /INCREMENTAL:NO /DLL oldnames.lib kernel32.lib
/out:D:\...
target\HelloWorld.obj
Microsoft (R) Incremental Linker Version 7.10.6030
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
LINK : fatal error LNK1104: cannot open file 'TEMPFILE'
[INFO] -----------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] -----------------------------------------------------------------------
[INFO] Error executing command line. Exit code:1104
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira