[AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)? Topic is solved

Report problems with documented functionality
XKa-MSF-OCB
Posts: 2
Joined: 07 Dec 2021, 17:45
Contact:

[AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?

Post by XKa-MSF-OCB » 09 Dec 2021, 03:46

Hello,

As a large humanitarian medical organisation, we have thousands of remote Windows 10 workstations to manage in many (overseas) countries, sometimes in very challenging contexts (remote parts of unstable developing countries with very poor Internet connections), and we need practical yet robust yet open-source/free solutions ... and AutoHotkey is surely one of them! :thumbup:
Many thanks to all involved developers for the outstanding work. :clap:

I have not found yet in this forum nor on the Web any reference to this possible bug/regression only affecting the latest stable AutoHotkey version 1.1.33.10 - previous stable version 1.1.33.09 does not look affected.

Here is a simple script that can already reveal the problem:

Code: Select all

#Warn All, StdOut  ;; Enable warnings to assist with detecting common errors
#NoEnv  ;; Avoids checking empty variables to see if they are environment variables (recommended for all new scripts)
;#Persistent   ;; Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered)
#SingleInstance Ignore  ;; i.e. attempts to re-launch an already-running script are ignored (use AHK command-line option "/force" to launch unconditionally)
#NoTrayIcon   ;; Disables the showing of a tray icon (will be enabled later if the script is not running in silent mode)
;#ErrorStdOut   ;; N.B.: rather use standard AHK command-line switch "/ErrorStdOut"
;; N.B.: To redirect the script's both stdout and stderr streams to a file and also get the script exit code : << "%ComSpec%" /c " "myscript.exe" /ErrorStdOut > "myscript.log" 2>&1 " >>
;SetWorkingDir %A_ScriptDir%  ;; N.B.: may be used to ensure a consistent starting directory but not wanted with such scripts to forcibly change the current working directory
SendMode Input  ;; Recommended for new scripts due to its superior speed and reliability
Menu, Tray, Icon, , , 1   ;; Freeze the system tray icon (not changing e.g. when disabling hotkeys)
Suspend, On   ;; Disables all hotkeys and hotstrings (not used with such scripts)
SetRegView 64   ;; Sets the registry view (used by RegRead, RegWrite, RegDelete and registry loops) to view the registry as a 64-bit application would (so both 32-bit and 64-bit registry can be accessed at once, e.g. both key trees under "HKLM\Software\" and "HKLM\Software\WOW6432Node\")
;SetBatchLines, -1   ;; Never sleep (i.e. have the script run at maximum speed).

vErrorLevel := ""
vLastError := ""
vLastException := ""
try
{
  FileInstall, FileInstall\_ReadMe_01.txt, %A_ScriptDir%\_ReadMe_01.txt, 1
  vErrorLevel := ErrorLevel
  vLastError := A_LastError
}
catch e
{
  vLastException := e
  vErrorLevel := ErrorLevel
  vLastError := A_LastError
}

FileAppend, % ( "vErrorLevel: " vErrorLevel " | vLastError: " vLastError " | vLastException: " vLastException "`r`n" ), *

;; EOF

A dummy non-empty ReadMe text file "FileInstall\_ReadMe_01.txt" should be created (so in a sub-folder ".\FileInstall\" relative to the AHK script "FileInstall01.ahk"), e.g. with contents:

Code: Select all

Fake ReadMe file
___


And here is a Command Prompt session demonstrating the problem (suggesting other people to check as well):

Code: Select all

> ver

Microsoft Windows [Version 10.0.18363.1916]

> %ComSpec% /a/e:on/v:on/f:off/d/c " @for %A in ( "1.1.33.09" "1.1.33.10" ) do @for %B in ( "Ahk2Exe-FileInstall01.ahk_%~A.log" ) do ( ( "AutoHotkey_%~A\Compiler\Ahk2Exe.exe" /bin "AutoHotkey_%~A\Compiler\ANSI 32-bit.bin" /in "FileInstall01.ahk" /out "FileInstall01.ahk_%~A.exe" & echo ERRORLEVEL:"!ERRORLEVEL!" ) > "%~B" 2>&1 & @type "%~B" ) "

> (("AutoHotkey_1.1.33.09\Compiler\Ahk2Exe.exe" /bin "AutoHotkey_1.1.33.09\Compiler\ANSI 32-bit.bin" /in "FileInstall01.ahk" /out "FileInstall01.ahk_1.1.33.09.exe"   & echo ERRORLEVEL:"!ERRORLEVEL!"  ) 1>"Ahk2Exe-FileInstall01.ahk_1.1.33.09.log" 2>&1  & )
Successfully compiled: FileInstall01.ahk_1.1.33.09.exe
ERRORLEVEL:"0"

> (("AutoHotkey_1.1.33.10\Compiler\Ahk2Exe.exe" /bin "AutoHotkey_1.1.33.10\Compiler\ANSI 32-bit.bin" /in "FileInstall01.ahk" /out "FileInstall01.ahk_1.1.33.10.exe"   & echo ERRORLEVEL:"!ERRORLEVEL!"  ) 1>"Ahk2Exe-FileInstall01.ahk_1.1.33.10.log" 2>&1  & )
Successfully compiled as:
C:\Tmp\AHK\FileInstall01.ahk_1.1.33.10.exe
ERRORLEVEL:"0"

> %ComSpec% /a/e:on/v:on/f:off/d/c " @for %A in ( "1.1.33.09" "1.1.33.10" ) do @for %B in ( "FileInstall01.ahk_%~A.exe.log" ) do ( call "FileInstall01.ahk_%~A.exe" > "%~B" 2>&1 & echo {{{ & type "%~B" & echo }}} & echo [[[ & type "_ReadMe_01.txt" & echo ]]] ) "

> (call "FileInstall01.ahk_1.1.33.09.exe"   1>"FileInstall01.ahk_1.1.33.09.exe.log" 2>&1  & echo {{{   & type "FileInstall01.ahk_1.1.33.09.exe.log"   & echo }}}   & echo [[[   & type "_ReadMe_01.txt"   & echo ]]]  )
{{{
vErrorLevel: 0 | vLastError: 0 | vLastException:
}}}
[[[
Fake ReadMe file
___

]]]

> (call "FileInstall01.ahk_1.1.33.10.exe"   1>"FileInstall01.ahk_1.1.33.10.exe.log" 2>&1  & echo {{{   & type "FileInstall01.ahk_1.1.33.10.exe.log"   & echo }}}   & echo [[[   & type "_ReadMe_01.txt"   & echo ]]]  )
{{{
vErrorLevel: 0 | vLastError: 0 | vLastException:
}}}
[[[
]]]

>

So, it appears that at least in specific circumstances (yet to clarify) the latest stable AutoHotkey version 1.1.33.10 erroneously generates zero-length files with its built-in command "FileInstall". :think:

Just in case, we have also tried on Windows 7 (using different configuration, different anti-virus) but the problem still occurs, so it looks unlikely that this is related to a specific Windows set-up.

We would really need this functionality to work correctly for AHK scripts to run in our organisation, as it used to be with previous AHK stable versions.

Feel free to ask for any further explanations and/or details.

Many thanks again for the product and for its support! :bravo:

User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: [AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?

Post by haichen » 09 Dec 2021, 12:21

I have tried it and can confirm the different behavior.

TAC109
Posts: 1112
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: [AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?  Topic is solved

Post by TAC109 » 09 Dec 2021, 15:00

Thanks for the detailed bug report.

This is a known problem and is fixed in the latest beta version of Ahk2Exe, which can be found through this link.

Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe

XKa-MSF-OCB
Posts: 2
Joined: 07 Dec 2021, 17:45
Contact:

Re: [AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?

Post by XKa-MSF-OCB » 09 Dec 2021, 16:42

TAC109 wrote:
09 Dec 2021, 15:00
Thanks for the detailed bug report.

This is a known problem and is fixed in the latest beta version of Ahk2Exe, which can be found through this link.

Cheers
You are welcome.
Thanks a lot for the good news! :thumbup:

I assume in the fixes listed on the linked page, this is the relevant one (not found any other mention of 'FileInstall' there):
1.1.34.00_Beta_3, 11 September 2021
Fixes 'FileInstall' when a path is specified.
My apologies, I did not know about this page, I would have guessed from the fix description... :facepalm:

So, we are going perform various (stress) tests with command 'FileInstall' on that latest beta version of Ahk2Exe, and if any problems would still be encountered (hopefully none), we will report them in this forum again.

Cheers

User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: [AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?

Post by haichen » 10 Dec 2021, 04:43

Aah, I thought I had installed the latest version of Ahk2Exe. Was a mistake. Now I am back to the last version. Thank you. :)

lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [AHK v1.1.33.10] Bug/regression with built-in command "FileInstall" (erroneously generates zero-length files)?

Post by lexikos » 13 Jul 2022, 04:22

This fix was presumably included in the AutoHotkey v1.1.34.00 release, so I have marked the topic as solved.

Post Reply

Return to “Bug Reports”