Skip to content

[Lua] Failed Extract leaves open file handle #31

@DerfJagged

Description

@DerfJagged

It looks like there might be a bug in Aurora's Lua for zip handling.

If I have an invalid zip at PATH_TO_ZIP and run this:

local zip = ZipFile.OpenFile(PATH_TO_ZIP);
if zip == nil then
	Script.ShowMessageBox("ERROR", "Failed to open zip!", "OK");
	return false;
end
local result = zip.Extract(zip, downloadsPath.."tmp\\");
FileSystem.DeleteFile(http.OutputPath);
if result == false then
	Script.ShowMessageBox("ERROR", "Extraction failed!", "OK");
else
	-- Do stuff
end

Then it will fail the zip.Extract and show the "Extraction failed!" error, as you'd expect.
However, it seems to keep an open file handle on the zip file, and the FileSystem.DeleteFile command fails, and you can't even manually delete the file via FTP until you reboot Aurora. I don't see any script developer accessible ZipFile.CloseFile command, so I think Aurora source needs to be adjusted to close the file upon Extract failure.

The log shows this message:
{ "time" : "17:32:28.500", "thread" : "0xF9000004", "type" : "normal", "filter" : "RecursiveDeleteDirectory", "message" : "Failed to delete file: Game:\User\Scripts\Utility\HomebrewStore\Downloads\tmp.7z. Error Code: 32" }


For a practical example, I had a typo on a link in the Homebrew Store and it caused that download to fail, but since it kept an open file handle, it would not allow any subsequent downloads to extract since they were trying to write to the same place.

If you want to test it, I've made an item called "DO NOT DOWNLOAD" at the very bottom of the "Other" section of the homebrew store which will trigger this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions