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
Windows file references broken in P8 #3233
Comments
Does it fail on the space or what ? Can you be more specific ? And how come this did not get caught by unit tests ? |
I guess the "Document and Settings" is a shortcut and is not readable in your system. Right? |
@svenvc It seems to happen when you have this (or other permission restriced folders) on windows. So I guess something changed in the image or FilePlugin. |
@astares Opening a shortcut of some other folder works. |
Little observation: |
What's the value of errorNumber? |
When I run "'C:\Dokumente und Einstellungen' asFileReference children" errorNumber is -9 |
Thanks, Torsten. -9 is Can't Open Directory, which is consistent with it being a permissions problem. On Linux in Pharo 8 I get the same error as shown above when trying to access a directory that I don't have permissions for. But in Pharo 7 I get a DirectoryDoesNotExist error. I agree with Dennis that we should have a better error (e.g. CantOpenDirectory), but I think that both returning an empty array and raising DirectoryDoesNotExist is incorrect behaviour - the directory clearly does exist, and may contain entries. Sven: I haven't looked, but am fairly confident that this isn't covered by the existing tests. No file system tests were changed between Pharo 7 & 8 (that I remember). |
@akgrant43 Please note that returning an empty array is correct behavior as I asked for the children or directories within the directory, not the directory itself. So I'm not asking for the directory itself (which is existing and returned) - but anything below (entries, subdirs, children, ...) |
To get the entries below the directory you open the directory and read it, so if you don't have permission to do that you can't know what it contains, whether it is or isn't empty, e.g. if root has access to the files:
but I don't:
Even if I have access to the specific file, I can't get to it if I don't have access to the containing directory:
What am I missing? Cheers, |
True, and I realise that, but I don't have easy access to a Windows system, so was hoping that it would translate. Unfortunately it doesn't.
OK, this is a separate issue to what you originally raised. I'll respond to the next post. |
Pharo 7 appears to be inconsistent: FileSystem root directories second size returns 0, but: FileSystem root directories second inspect triggers a "DirectoryDoesNotExist Path / 'D:'". Pharo 8 is at least consistent: it triggers the does not exist error in both cases. Of course, the fact that basic tools like the inspector don't handle it isn't good. Going back to the original issue about 'C:\Documents and Settings': Attempting to read the directory in a DOS box:
Which is consistent with Pharo 8.
Shows that it is a "JUNCTION". I'll have to look at this. Pharo 8 handles symbolic links, but I don't remember seeing a junction. (cygwin displays it in the same way as a symbolic link). I should have added in my previous post: The double "FileDoesNotExist: '/C:/WORLD/...'" is because the GT inspector adds the '..' entry and Pharo 8 isn't handling the pseudo root directory on Windows. I'll start with that and then dig in to the other issues. |
Quick update: I believe I've resolved all of the issues raised above except the "Document and Settings" issue which will require an update to the FileAttributesPlugin to handle Windows junction entries. I'll add some automated tests and submit a PR. |
Thank you! |
Unix file systems have a common root which is handled by the OS file system. Windows doesn't have this, so the Pharo FileSystem needs to have a pseudo-root entry to be consistent across platforms. Fixes: pharo-project#3233
Windows 10
'C:\Dokumente und Einstellungen' asFileReference directories
works in Pharo 7 and gives empty Array (when not readable) - but not anymore in Pharo 8
Same for
'C:\Dokumente und Einstellungen' asFileReference children
The text was updated successfully, but these errors were encountered: