If I set "verbose 4", the relevant snippet of output from makensis is as follows:
!define GZIP "Q:\Third Party Tools\gzip.exe"
!macro GZIPFILE SourceFile CompressedName
!tempfile GZIPTEMP
!system 'copy "${SourceFile}" "${GZIPTEMP}"' = 0
!system '"${GZIP}" -9v "${GZIPTEMP}"' = 0
File "/oname=${CompressedName}" "${GZIPTEMP}.gz"
!delfile "${GZIPTEMP}.gz"
!undef GZIPTEMP
!macroend
This is weird for a few reasons. First, the path to gzip.exe is being split up even though it's enclosed in quotes. Then, gzip is actually being invoked successfully, but !system returns 1 even though I'm fairly certain that gzip is returning 0.
!system: ""Q:\Third Party Tools\gzip.exe" -9v "C:\DOCUME~1\gknap\LOCALS~1\Temp\nst20C.tmp""
"Q:\Third: No such file or directory
Party: No such file or directory
Tools\gzip.exe": No such file or directory
C:\DOCUME~1\gknap\LOCALS~1\Temp\nst20C.tmp: 95.2% -- replaced with C:\DOCUME~1\gknap\LOCALS~1\Temp\nst20C.tmp.gz
!system: returned 1, aborting
Is there something wrong with my script, or does this look like an NSIS bug?
I came up with the following workaround:
Now the output is:
!system 'start "gzip" /b /wait "${GZIP}" -9v "${GZIPTEMP}"' = 0
The error messages still appear, but gzip runs to completion, and !system returns 0 as expected. I verified that gzip's return code is not lost by testing the following:
!system: "start "gzip" /b /wait "Q:\Third Party Tools\gzip.exe" -9v "C:\DOCUME~1\gknap\LOCALS~1\Temp\nst170.tmp""
"Q:\Third: No such file or directory
Party: No such file or directory
Tools\gzip.exe": No such file or directory
C:\DOCUME~1\gknap\LOCALS~1\Temp\nst170.tmp: 95.2% -- replaced with C:\DOCUME~1\gknap\LOCALS~1\Temp\nst170.tmp.gz
!system: returned 0
Sure enough, gzip reports that it can't find "nstXXX.tmpaaaa", and !system returns 1.
!system 'start "gzip" /b /wait "${GZIP}" -9v "${GZIPTEMP}aaaaa"' = 0