fix os.isdir() and os.mkdir() - #2759
Conversation
|
The current test needs to be run outside the “sandbox” in order to pass, due to the reasons mentioned above.
I am not sure which option would be the most appropriate. |
| local ok, err = os.mkdir("folder/ok.lua") | ||
| test.isnil(ok) | ||
| test.isequal("string", type(err)) | ||
| test.istrue(os.isfile("folder/ok.lua")) |
There was a problem hiding this comment.
I would move test.istrue(os.isfile("folder/ok.lua")) at the beginning. It is the prerequire for the failure of os.mkdir
| -- | ||
|
|
||
| function suite.mkdir_ReturnsTrue_OnExistingDirectoryLink() | ||
| -- BSD CI mounts the workspace through SSHFS, so keep topology tests on local storage. |
There was a problem hiding this comment.
https://github.com/premake/premake-core/actions/runs/30967252835/job/92183785538
after os.linkdir("folder/subfolder", "folder/subfolder2"), os.mkdir("folder/subfolder2") fail.
There was a problem hiding this comment.
I’m not sure. I can only guess that it has something to do with SSHFS.
There was a problem hiding this comment.
Likely related to issues that I started addressing with #2749, if I had to guess. Our BSD VM seems to be breaking quite a bit of code that works elsewhere. Not sure if it's with the VM set up or if it's BSD itself.
What does this PR do?
_wstatdoes not fully recognize reparse points (symbolic links);GetFileAttributesWneeds to be used instead.os.mkdirincorrectly returned success when the target already existed and was a file.os.isdir.os.mkdir. On FreeBSD CI, the workspace is mounted through SSHFS, which does not reliably support this symlink topology. The test therefore uses local temporary storage to exercise the actualos.mkdirbehavior without interference from the CI filesystem.How does this PR change Premake's behavior?
In the edge case where the target of
mkdiralready exists and is a file, the operation may now terminate earlier.Anything else we should know?
Did you check all the boxes?
closes #XXXXin comment to auto-close issue when PR is merged)You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!