Modify

Opened 11 months ago

Closed 8 months ago

Last modified 9 days ago

#3987 closed Bug (No Bug)

Aut2Exe creates a temp folder without deleting it

Reported by: lwc Owned by:
Milestone: Component: Aut2Exe
Version: 3.3.16.1 Severity: None
Keywords: Aut2Exe, SciTe, tmp Cc:

Description

3.3.9.11 added:

Aut2Exe:
- Changed: Compiling uses a subfolder of %localappdata% instead of %temp% for temporary files. Hopefully this fixes warnings from over-zealous AV.

However, #2936 admitted it was (secretly) reverted in v3.3.12.0 though I wonder why.

But all I ask is at least is just like v3.3.10.1 "Fixed: Aut2Exe was leaving a temporary file around.", please at least delete the folder of %LocalAppData%\AutoIt v3\ after finishing running the temp files there in Aut2exe (at least through SciTE=>Tools=>Build).

Otherwise it prevents AutoIt from being considered a fully portable software.

Attachments (0)

Change History (21)

comment:1 Changed 11 months ago by Jpm

Hi,
Using the standard autoit installation and even scite compilation does not reproduce your concern

so can you describe the environment you are running with?

comment:2 Changed 9 months ago by Jos

  • Resolution set to Works For Me
  • Status changed from new to closed

comment:3 Changed 9 months ago by Jos

Closed due to no response of the ticket creator and "works for me"

comment:4 follow-up: Changed 8 months ago by lwc

Can you please reopen? There are no notifications here, so I wasn't aware of what you asked.
I use AutoIt – Self Extracting Archive + SciTE4AutoIt3_Portable.zip.

It seems it's because SciTE4AutoIt3_Portable's AutoIt3Wrapper.au3 file has:

; set dir for all temporary files, fall back to @TempDir if it doesn't exist
Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
If Not FileExists($TempDir) Or $TempDir = "" Then
	$TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
	If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

Obviously the "fall back to @TempDir" is phrased wrongly since it can't fall back into itself. I argue it should fall back on %temp%.

But even if you want me to create AutoIt3WapperIni.ini it's a major pain because of this part:

Global $AutoIt3WapperIni
; Check for SCITE_USERHOME Env variable and used that when specified.
; Else use Program directory
If EnvGet("SCITE_USERHOME") <> "" And FileExists(EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper") Then
	$AutoIt3WapperIni = EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper\AutoIt3Wrapper.ini"
	$UserData = EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper"
ElseIf EnvGet("SCITE_HOME") <> "" And FileExists(EnvGet("SCITE_HOME") & "\AutoIt3Wrapper") Then
	$AutoIt3WapperIni = EnvGet("SCITE_HOME") & "\AutoIt3Wrapper\AutoIt3Wrapper.ini"
	$UserData = EnvGet("SCITE_HOME") & "\AutoIt3Wrapper"
Else
	$AutoIt3WapperIni = @ScriptDir & "\AutoIt3Wrapper.ini"
	$UserData = @ScriptDir
EndIf

Which due to the lack of "SCITE_X" env in the portable version means if I have 1,000 scripts I'm expected to have 1,000 AutoIt3WapperIni.ini with nothing in them but:

[Other]
TempDir=%temp%
Version 0, edited 8 months ago by lwc (next)

comment:5 in reply to: ↑ 4 ; follow-up: Changed 8 months ago by Jos

  • Resolution Works For Me deleted
  • Status changed from closed to reopened

Replying to lwc:

Can you please reopen? There are no notifications here, so I wasn't aware of what you asked.
I use AutoIt – Self Extracting Archive + SciTE4AutoIt3_Portable.zip.

sure.... no issue there.

It seems it's because SciTE4AutoIt3_Portable's AutoIt3Wrapper.au3 file has:

; set dir for all temporary files, fall back to @TempDir if it doesn't exist
Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
If Not FileExists($TempDir) Or $TempDir = "" Then
	$TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
	If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

Obviously the "fall back to @TempDir" is phrased wrongly since it can't fall back into itself. I argue it should fall back on %temp%.

Agree that the directory %LocalAppData%\AutoIt v3\ will be created when it doesn't exist, but doesn't aut2exe do the same?
We have changed from using @tempdir/%temp% when these AV companies started to kill the tempfiles generated by aut2exe or autoit3wrapper when they are updating the PE header of the compiled program to set all the defined resource information. In that way, you can easily exclude just this directory instead of %temp% as that should be something you do not want.
I will not change it to @tempdir / %temp% for that reason.

But even if you want me to create AutoIt3WapperIni.ini it's a major pain because of this part:

Global $AutoIt3WapperIni
; Check for SCITE_USERHOME Env variable and used that when specified.
; Else use Program directory
If EnvGet("SCITE_USERHOME") <> "" And FileExists(EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper") Then
	$AutoIt3WapperIni = EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper\AutoIt3Wrapper.ini"
	$UserData = EnvGet("SCITE_USERHOME") & "\AutoIt3Wrapper"
ElseIf EnvGet("SCITE_HOME") <> "" And FileExists(EnvGet("SCITE_HOME") & "\AutoIt3Wrapper") Then
	$AutoIt3WapperIni = EnvGet("SCITE_HOME") & "\AutoIt3Wrapper\AutoIt3Wrapper.ini"
	$UserData = EnvGet("SCITE_HOME") & "\AutoIt3Wrapper"
Else
	$AutoIt3WapperIni = @ScriptDir & "\AutoIt3Wrapper.ini"
	$UserData = @ScriptDir
EndIf

Which due to the lack of "SCITE_X" env in the portable version means if I have 1,000 scripts I'm expected to have 1,000 AutoIt3WapperIni.ini with nothing in them but:

[Other]
TempDir=%temp%

You lost me there, you would only need 1 autoit3wrapper.ini in the same directory as autoit3wrapper.au3 to set the default for autoit3wrapper, so do not understand this comment.

So what exactly is the big issue with leaving this directory behind giving you the option to exclude that in your AV?

comment:6 in reply to: ↑ 5 ; follow-up: Changed 8 months ago by lwc

Replying to Jos:

sure.... no issue there.

Thanks!

Agree that the directory %LocalAppData%\AutoIt v3\ will be created when it doesn't exist, but doesn't aut2exe do the same?

No, it doesn't. None of this happens when using just AutoIt – Self Extracting Archive wit the basic version of SciTE that doesn't include AutoIt3Wrapper.

You lost me there, you would only need 1 autoit3wrapper.ini in the same directory as autoit3wrapper.au3 to set the default for autoit3wrapper, so do not understand this comment.

But the code of AutoIt3WapperIni.au3 clearly states that - due to the lack of both "SCITE_USERHOME" and "SCITE_HOME" - it will use @ScriptDir, which takes us back to 1,000 scripts might require 1,000 AutoIt3WapperIni.ini files.

https://i.ibb.co/gRBk1CP/image.png

So what exactly is the big issue with leaving this directory behind giving you the option to exclude that in your AV?

Well, at least delete it after usage, surely in the Self Extracting Archive (i.e. portable) version.
Also, why not just using (and thus excluding) %temp%\AutoIt v3\Aut2exe?

comment:7 in reply to: ↑ 6 Changed 8 months ago by Jos

Replying to lwc:

Replying to Jos:

You lost me there, you would only need 1 autoit3wrapper.ini in the same directory as autoit3wrapper.au3 to set the default for autoit3wrapper, so do not understand this comment.

But the code of AutoIt3WapperIni.au3 clearly states that - due to the lack of both "SCITE_USERHOME" and "SCITE_HOME" - it will use @ScriptDir, which takes us back to 1,000 scripts might require 1,000 AutoIt3WapperIni.ini files.

https://i.ibb.co/gRBk1CP/image.png

No, this is an assumption which you didn't check ...right?
@scriptdir contains the directory of the script which is AutoIt3Wrapper, not the script AutoIt3Wrapper will run for you! ;)

comment:8 Changed 8 months ago by Jos

  • Resolution set to No Bug
  • Status changed from reopened to closed

Closed again due to lack of response, so assume it is working now.

comment:9 follow-up: Changed 8 months ago by lwc

Please give more days to answer. Could you reopen?
No, it did not fix. For some reason it still creates the localappdata folder.
If I change:

Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
If Not FileExists($TempDir) Or $TempDir = "" Then
        $TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

to

Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
MsgBox("", "", $TempDir)
If Not FileExists($TempDir) Or $TempDir = "" Then
        MsgBox("", "", "Entered here")
        $TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

Then only the first Msgbox displays (showing the full path of %temp%), so supposedly it works, but %LocalAppData%\AutoIt v3\ is created nonetheless.
What could it be? And why does it not happen in the non full SciTE?

Also, I think

If Not FileExists($TempDir) Or $TempDir = "" Then

should be changed to

If $TempDir <> "" And FileExists($TempDir) And Not FileExists($TempDir & "\AutoIt v3\Aut2exe") Then
        DirCreate($TempDir & "\AutoIt v3\Aut2exe")
ElseIf Not FileExists($TempDir) Or $TempDir = "" Then

Because obviously it's much more expected to exclude %temp%\AutoIt v3\Aut2exe instead of just %temp%, and also obviously one can't create %temp%\AutoIt v3\Aut2exe manually in advance since it's expected to be deleted. It should be on the fly.

Last edited 7 months ago by mLipok (previous) (diff)

comment:10 in reply to: ↑ 9 Changed 8 months ago by Jos

If I change:

Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
If Not FileExists($TempDir) Or $TempDir = "" Then
        $TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

to

Global $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", ""))
MsgBox("", "", $TempDir)
If Not FileExists($TempDir) Or $TempDir = "" Then
        MsgBox("", "", "Entered here")
        $TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

Then only the first Msgbox displays (showing the full path of %temp%), so supposedly it works, but %LocalAppData%\AutoIt v3\ is created nonetheless.
What could it be? And why does it not happen in the non full SciTE?

The SciTE included with AutoIt3 is simply only running aut2exe when you do a compile.
I can only assume that it will not be AutoIt3Wrapper as that is the only place the directory gets created when your provided TempDir in autoit3wrapper.ini doesn't exists.

Just looked at the aut2exe source and it really looks like it will try to create "%localappdata%\AutoIt v3\aut2exe" when it does a compile. Only when that fails it will use the %temp% path. So I renamed my current existing "%localappdata%\AutoIt" directory and performed an aut2exe.exe on a test.au3 and the directory was created. So you might want to recheck that!

Also, I think

If Not FileExists($TempDir) Or $TempDir = "" Then

should be changed to

If $TempDir <> "" And FileExists($TempDir) And Not FileExists($TempDir & "\AutoIt v3\Aut2exe") Then
        DirCreate($TempDir & "\AutoIt v3\Aut2exe")
ElseIf Not FileExists($TempDir) Or $TempDir = "" Then

Because obviously it's much more expected to exclude %temp%\AutoIt v3\Aut2exe instead of just %temp%, and also obviously one can't create %temp%\AutoIt v3\Aut2exe manually in advance since it's expected to be deleted. It should be on the fly.

Guess I could change that to the following, so the defined tempdir in the INI is created when missing:

If Not FileExists($TempDir) Or $TempDir = "" Then
        If $TempDir = "" Then $TempDir = @LocalAppDataDir & "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Then DirCreate($TempDir)
EndIf

I don't really need to add any subdirectories when a hardcode tempdir is provided.
... but this is null and void when aut2exe is also creating the "%localappdata%\AutoIt v3\Aut2exe" directory! :-)

Last edited 7 months ago by mLipok (previous) (diff)

comment:11 Changed 7 months ago by lwc

So you might want to recheck that!

You're right, not sure why I thought otherwise.

I don't really need to add any subdirectories when a hardcode tempdir is provided.

My request then is to make an exception for:

[Other]
TempDir=%temp%

i.e. replace

        If Not FileExists($TempDir) Or $TempDir = "" Then

with

        If $TempDir = "%temp%" Then $TempDir &= "\AutoIt v3\Aut2exe"
        If Not FileExists($TempDir) Or $TempDir = "" Then

... but this is null and void when aut2exe is also creating the "%localappdata%\AutoIt v3\Aut2exe" directory! :-)

I don't think something shouldn't be fixed/added just because something else is not fixed/added. You could regardless modify Aut2exe, maybe make it also use $TempDir = _WinAPI_ExpandEnvironmentStrings(IniRead($AutoIt3WapperIni, "Other", "TempDir", "")) and if it's %temp% then $TempDir &= "\AutoIt v3\Aut2exe".

comment:12 Changed 7 months ago by Jos

Trying to understand how that would resolve the fact that aut2exe creates the directory?
AutoIt3Wrappper is just a wrapper around autoit.exe & aut2exe.exe, and is using the standards of those 2 programs, so in this case using the same temp directory as aut2exe is doing.

comment:13 Changed 7 months ago by lwc

Because 1 bug doesn't mean there should be 2.
The alternatives are:

  1. Just make SciTE in general delete %LocalAppData%\AutoIt v3\ on exit
  2. Allow both AutoIt3Wrappper and autoit.exe to use %temp\AutoIt v3\ instead

comment:14 Changed 7 months ago by Jos

Let's agree to disagree: I will use the same directory in AutoIt3Wrapper as aut2exe does.
You are welcome to make whatever change locally you feel is desired for yourself.

comment:15 Changed 7 months ago by lwc

Would you consider at least to accept a command line parameter like -portable to SciTE.exe, which will delete the folder upon exiting SciTE?

comment:16 Changed 7 months ago by Jos

SciTE parameter? SciTE doesn't play any role in this!
Do you mean AutoIt3Wrapper parameter?
So you expect AutoIt3Wrapper the delete it? This is not going to happen since, when somebody runs AutoIt3Wrappper for some reason mistakenly uses the parameter -portable, that person will potentially lose the total content of %localappdata%/autoit v3/* with all its config settings for SciTE and Utilities and I will not want to be held responsible for that.
When you need to make this change in your environment then feel free to do so in your version or write your own wrapper to do the extra steps as that can be too hard for your specific requirements.

comment:17 Changed 7 months ago by lwc

Which is why I think it should be part of SciTE. While technically it's not related, it is the place that is most likely to be used for compilations, and this way once you exit it then it will delete leftovers from all edited scripts.

comment:18 Changed 7 months ago by Jos

Excuse me, but this last post is really nonsense, so I am done debating this.
Request stays closed as "No Bug"

comment:19 Changed 7 months ago by lwc

There's really no reason for offending like this.

comment:20 Changed 7 months ago by Jos

Read my answer in whatever way you feel like, but you know very well you are asking for something that is a LWC special and is not making any sense doing it that way, like you more or less state yourself ... hence "nonsense"

comment:21 Changed 9 days ago by sl23

I would like to add that I much prefer portable apps and also am in great favour of them being fully stealth, ie, leaving no trace on the system they are run. No trace means no empty files or folders left behind.

I often switch to new apps that have this as standard if my current one isn't fully stealth. Although I understand that installing apps for multiple users requires using the User folders, etc, I think that these days all apps should be fully portable and fully self contained. App files are small enough that very little extra disk space is required to add them to several set ups.

For example, my AutoIT/SCiTe portable set up is 76MB. That includes 4 X-Launchers to fully portablise the app that claims to be portable but leaves things on my PC. I mean no disrespect, after all, this is a free app and I am only learning the basics. I just wish to point out that there is a whole community of supporters for portable, and stealth, apps.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.