tools icon indicating copy to clipboard operation
tools copied to clipboard

rdmd on windows can't run files with "setup" or "install" in the name

Open huglovefan opened this issue 4 years ago • 1 comments

Describe the bug windows has a helpful compatibility feature where having the words "setup" or "install" in an executable's name automatically causes it to require admin privileges to run

this affects rdmd because it names the compiled executable after the source file

D source files with those words in the name fail to run through rdmd with The requested operation requires elevation.

the trigger words are case-insensitive and there might be more of them

Platform OS: Windows 7 64-bit Compiler: DMD 2.098.0

To Reproduce in command prompt:

  1. echo void main(){} > setup.d
  2. rdmd setup.d
C:\Users\qemu\Desktop>rdmd setup.d

std.process.ProcessException@std\process.d(1360): Failed to spawn process "C:\Users\qemu\AppData\Local\Temp\.rdmd\rdmd-setup.d-8A16DDD3DC3B0E380C43708A28BDC4D0\setup.exe" (The requested operation requires elevation.)
----------------
0x004661EC
0x004531B0
0x004044AA
0x0040452E
0x00467927
0x004678A1
0x0046773A
0x00454352
0x00405B28
0x764E344D in BaseThreadInitThunk
0x76FD9802 in RtlInitializeExceptionChain
0x76FD97D5 in RtlInitializeExceptionChain

one workaround to avoid the behavior is to set the __COMPAT_LAYER=RunAsInvoker environment variable, but that might be unacceptable for rdmd since it applies to subprocesses of the D program too. i don't know if there's a way to start just one child process with the setting

huglovefan avatar Nov 11 '21 16:11 huglovefan

Is that a RDMD bug ? It's a Windows limitation, and rdmd correctly informs the user of the failure. I'm tempted to say that we should not try to be helpful here.

Geod24 avatar Nov 13 '21 19:11 Geod24

Yes, this is not rdmd's problem to fix.

CyberShadow avatar Apr 30 '23 06:04 CyberShadow