Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Un-deletable" file/directory on HostFS #18

Open
zedtoo-de opened this issue Jun 6, 2019 · 2 comments
Open

"Un-deletable" file/directory on HostFS #18

zedtoo-de opened this issue Jun 6, 2019 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@zedtoo-de
Copy link

zedtoo-de commented Jun 6, 2019

Describe the bug
If a (HostFS) file has been "locked" by macOS, RPCEmu will be unable to delete or rename the file. In addition, if the "locked" file is deleted by macOS, RPCEmu will subsequently be unable to delete the owning directory. Part of this issue appeared in previous versions of RPCEmu, and it is possible that the issue is cross-platform.

To Reproduce

  1. Create a text file in a test directory in HostFS.
  2. Under macOS, navigate to that directory (in the "hostfs" folder) and lock the file.
  3. Back in RPCEmu, try to delete or rename the file.
  4. Under macOS, delete the locked file.
  5. Back in RPCEmu, try to delete the owning directory.

System information

  • Host machine: MacBook Pro 13-inch (2017 version)
  • rpcemu-macos release: 0.9.1-pp3 (recompiler or interpreter)
  • macOS version: Mojave 10.14.5
  • Emulated processor: StrongARM Risc PC
  • RISC OS versions: 3.7, 5.24 or 5.27(06-June-2019 build)

Additional context
If an attempt is made to delete the owning directory while a file has been locked by macOS, Filer will get stuck in a loop trying to delete the "locked" file. Click on "Abort" to escape.
RPCEmu 0.8.14-caliston-dev1 also suffered from the "un-deletable file" issue, but was able to delete the directory after the locked file was deleted from macOS.
At 0.9.1-pp3, the owning directory can be deleted if the file is unlocked, but not if the file is deleted by macOS.

@zedtoo-de
Copy link
Author

I think this issue needs a "Help wanted" label. I'd add it myself, but it seems GitHub (or my browser) won't let me.

@myelin myelin added bug Something isn't working help wanted Extra attention is needed labels Jun 6, 2019
@Septercius
Copy link

Septercius commented Jun 8, 2019

I've had a quick look at this, and the HostFS code that performs file deletes doesn't return an error back to RISC OS if the delete fails (see "hostfs_file_6_delete" in "hostfs.c"). It does log the error to the console log (which you can see if you're debugging in XCode).

It's also not checking whether the file is locked (see https://stackoverflow.com/a/13119512 for how to do this) - it should be checking this and returning a "file locked" error to RISC OS before attempting the delete. I bodged this into the source and it does (sort of) work, though you don't get a particularly informative error message from RISC OS.

Another issue is that HostFS doesn't seem to support locking files, at least that I can see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants