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

Google Drive: Files in explorer are wrongly assumed to be directories #69333

Closed
LeNouveau opened this issue Feb 25, 2019 · 27 comments
Closed

Google Drive: Files in explorer are wrongly assumed to be directories #69333

LeNouveau opened this issue Feb 25, 2019 · 27 comments
Assignees
Labels
nodejs NodeJS support issues *out-of-scope Posted issue is not in scope of VS Code upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@LeNouveau
Copy link

When opening a *.gsheet file synchronized with Google Drive, VSCode loops and is partially blocked. I can't use it anymore.
A simple reboot solves the looping.

Other behaviour : if a file is already opened, on opening the *.gsheet file, I have a message 'File is a Folder', but no looping.

For reminder, when clicking on this kind of file, Google Drive redirects us on the web interface.
The file isn't really accessible in local.

Demo of behaviour

Versions :

  • Version: 1.32.0-insider (system setup)
  • Commit: aeaef41
  • OS: Windows_NT x64 10.0.17763

Steps to Reproduce:

  1. Install "Google Drive File Stream". A g:\ device should appear.
  2. Through Google Drive web interface, create a *.gsheet file.
  3. Open g:\ folder with VSCode.
  4. Click on the *.gsheet file.

Does this issue occur when all extensions are disabled ? : Yes

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

I cannot open the video. What does looping mean?

@bpasero bpasero added the info-needed Issue requires more information from poster label Feb 27, 2019
@LeNouveau
Copy link
Author

When I click on the file, inside the tab "Open Editor", the file appears, disappears, appears, disappears, etc...
I can't select another file any more.

I think it's linked to the g:\ partition, created by Google Drive File Stream.
Another weird behaviour : when creating a file from VSCode, when asking for the filename, its disappears. The area is greyed, but there is no input field any more.

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

Please see if you can find any logged output that could help us find the source of the issue:

  • run code --verbose from the command line and attach the output
  • in Code select Help | Toggle Developer Tools and select the Console
  • attach any output you see in the Console you can find

Thanks!

@LeNouveau
Copy link
Author

@bpasero bpasero changed the title Looping on some Google Drive File Stream files Files in explorer are wrongly assumed to be directories Mar 1, 2019
@bpasero
Copy link
Member

bpasero commented Mar 1, 2019

@LeNouveau thanks I can see what is going on but I do not have an understanding why this happens:

  • you click on a file in the file explorer in VSCode
  • we try to open it as editor
  • we try to resolve the file contents to show the editor
  • somehow we get an error from node.js that the file is actually a folder
  • we close the editor and instead try to focus the folder in the explorer
  • this triggers an opening again of the file from the explorer
  • we end up in an endless loop

@isidorn would it be possible to get a new method from explorer service to either:

  • select but not open on select
  • find out the current selected resource (and then I can add the logic to not call this over and over again)

@LeNouveau could you try to use node.js to stat the path and see if the stat also tells it is a folder?

@isidorn
Copy link
Contributor

isidorn commented Mar 1, 2019

@bpasero if you just call explorerService.select that should select it and not open it.

@bpasero
Copy link
Member

bpasero commented Mar 1, 2019

@isidorn that is not what I see, I do this:

https://github.com/Microsoft/vscode/blob/804373ac4d5c84e96c8086cee5b9be132df88837/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts#L238

Steps:

  • return FileOperationResult.FILE_IS_DIRECTORY from IFileService#resolveStreamContent
  • open a file from the explorer
  • get an endless loop

@LeNouveau
Copy link
Author

LeNouveau commented Mar 2, 2019 via email

@bpasero
Copy link
Member

bpasero commented Mar 2, 2019

@LeNouveau could you try to use node.js to stat the path and see if the stat also tells it is a folder?

@LeNouveau
Copy link
Author

LeNouveau commented Mar 2, 2019 via email

@bpasero
Copy link
Member

bpasero commented Mar 2, 2019

@LeNouveau yeah, can you also do fs.statSync("Simple gsheet file.gsheet").isDirectory()?

@LeNouveau
Copy link
Author

LeNouveau commented Mar 4, 2019 via email

@bpasero
Copy link
Member

bpasero commented Mar 4, 2019

@LeNouveau which node version is that? Can you try with 10.2.0? That is the one VSCode currently uses.

@isidorn
Copy link
Contributor

isidorn commented Mar 4, 2019

@bpasero I just tried to repro and calling this.explorerService.select(uri, true);
does not open the uri for me in the editor.
Can you please file a new issue for me if you think that something is wrong on my side? Thanks a lot!

@bpasero
Copy link
Member

bpasero commented Mar 4, 2019

@isidorn do you get the endless loop with the changes from #69333 (comment)

@LeNouveau
Copy link
Author

@bpasero

PS G:\Mon Drive\test> node --version
v10.2.0
PS G:\Mon Drive\test> node
> fs.statSync("Simple gsheet file.gsheet")
Stats {
  dev: 428019990,
  mode: 33206,
  nlink: 0,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: undefined,
  ino: 0,
  size: 1,
  blocks: undefined,
  atimeMs: 1551282892782,
  mtimeMs: 1551282892782,
  ctimeMs: 1551282892782,
  birthtimeMs: 1551282856784,
  atime: 2019-02-27T15:54:52.782Z,
  mtime: 2019-02-27T15:54:52.782Z,
  ctime: 2019-02-27T15:54:52.782Z,
  birthtime: 2019-02-27T15:54:16.784Z }
> fs.statSync("Simple gsheet file.gsheet").isDirectory()
false

@isidorn
Copy link
Contributor

isidorn commented Mar 5, 2019

@bpasero yes I can repro.
The issue is that here you are passing focus to the explorer. If I change that boolean to false, there will be no loop.
Currently explorer is designed in such a way that when focus is passed if there is no active editor that it will try to open the editor - we can potentially also change that.

Sorry for the slow response.

@bpasero
Copy link
Member

bpasero commented Mar 5, 2019

@isidorn I pushed a change to not move focus into the explorer. I think that is a good change anyway because otherwise focus gets lost from the editor without explicit user choice.

@bpasero
Copy link
Member

bpasero commented Mar 5, 2019

@LeNouveau can we try another thing with node.js, which is to fs.open() the path and then fs.read() it and see if an error is returned? You can also try with fs.readFileSync() to begin with.

@isidorn
Copy link
Contributor

isidorn commented Mar 5, 2019

@bpasero cool, thanks. Makes sense to me

@LeNouveau
Copy link
Author

@bpasero

The script :

fs = require('fs')

fs.open('Simple gsheet file.gsheet', 'w', 0o666, (err, fd) => {
    if (err) {
        console.error(err);
    } else {
        fs.fstat(fd, (err2, stats) => {
            if (err2) {
                console.error(err2);
            } else {
                var bufferSize = stats.size,
                    chunkSize = 512,
                    buffer = Buffer.alloc(bufferSize),
                    bytesRead = 0;

                while (bytesRead < bufferSize) {
                    if ((bytesRead + chunkSize) > bufferSize) {
                        chunkSize = (bufferSize - bytesRead);
                    }
                    fs.read(fd, buffer, bytesRead, chunkSize, bytesRead);
                    bytesRead += chunkSize;
                }
                console.log(buffer.toString('utf8', 0, bufferSize));
                fs.close(fd, (err3) => {
                    if (err3) {
                        console.error(err3)
                    }
                });
            }
        });
    }
})

The result :

PS G:\Mon Drive\test> node .\bla.js
OK read

Ready to close

As it is a *.gsheet file on the sync Drive, nothing is saved inside, even if I fill lines.
It's always 1ko.
It's like a link, it opens the browser.

@bpasero
Copy link
Member

bpasero commented Mar 5, 2019

@LeNouveau any difference if you open with r flag instead of w? And leave out the mode.

@LeNouveau
Copy link
Author

@bpasero No, exact same output, with r flag.

Google Drive File Stream version : 29.1.85.2056
(for information, if results evolve)

@LeNouveau
Copy link
Author

Sorry, miss click

@LeNouveau LeNouveau reopened this Mar 5, 2019
@bpasero
Copy link
Member

bpasero commented Mar 5, 2019

ok super weird, I am out of ideas why we think the files are folders :-/

@bpasero bpasero added upstream Issue identified as 'upstream' component related (exists outside of VS Code) nodejs NodeJS support issues and removed info-needed Issue requires more information from poster labels Mar 5, 2019
@bpasero bpasero changed the title Files in explorer are wrongly assumed to be directories Google Drive: Files in explorer are wrongly assumed to be directories Mar 5, 2019
@vscodebot vscodebot bot added the *out-of-scope Posted issue is not in scope of VS Code label Oct 8, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 8, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@lcharbon
Copy link

lcharbon commented Nov 3, 2019

Can this be reconsidered considering the additional duplicate issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nodejs NodeJS support issues *out-of-scope Posted issue is not in scope of VS Code upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants