You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IFileSystem.fileExists returns false even when a file exists. #8890
These environments are no longer listed as interpreters, hence absolutely nothing works for conda or virtual environments.
In master.
I believe the logic of checking the file stat is incorrect.
We're checking if the file type == FIle when checking if a file exists.
However fstat could indicate that its a symbolic link.
Not sure this is the issue, but likely. Either way still is incorrect.
I.e. I don't think we should be comparing == File, we might want to check if !== Directory instead. I.e. allow other values except directory. I.e. its possible Unknown could be returned for a file (just as with symbolic links & others).
Proposed solution
If checking for a file, then ensure fstat !== direcrtory
If checking for a directory, then ensure fstat !== file
changed the title [-]IFileSystem.fileExists returns true even when a file exists.[/-][+]IFileSystem.fileExists returns false even when a file exists.[/+]on Dec 4, 2019
The old code for fileExists() used fs.Stats.isFile(), which is equivalent to checking for FileType.File. I don't think there's a need to change that approach.
Activity
[-]IFileSystem.fileExists returns true even when a file exists.[/-][+]IFileSystem.fileExists returns false even when a file exists.[/+]DonJayamanne commentedon Dec 4, 2019
The problem is we're treating the
FileTypeas an enum and comparing===.However these are bit values and we need to use bitwise operations.
DonJayamanne commentedon Dec 4, 2019
Other issues across the code:
if (await this.fs.fileExists(dir)) {find replace).===instead of using bitwise operations.Eric Snow (@ericsnowcurrently) Karthik Nadig (@karthiknadig) /cc
ericsnowcurrently commentedon Dec 4, 2019
The old code for
fileExists()usedfs.Stats.isFile(), which is equivalent to checking forFileType.File. I don't think there's a need to change that approach.DonJayamanne commentedon Dec 4, 2019
Eric Snow (@ericsnowcurrently)
Please see my comment here #8890 (comment)
That's where the bug is.
ericsnowcurrently commentedon Dec 4, 2019
Right. I have a fix for that. :)
Revert all the FS-related changes. (#8970)