Odd file creation with Visual Studio Code, VirtualBox, and Windows
by rnturn from LinuxQuestions.org on (#5JPV1)
Typical work arrangement: everyone gets Windows but all of our work happens on Linux. Visual Studio Code is our "standard" editor and when used with remote Linux systems via SSH, everything's great. Trying to use it to access a CentOS8 VM running under VirtualBox has not been possible (or I haven't discovered the correct incantations yet). A co-worker suggested setting up a shared Windows/VirtualBox folder (hosted on Win10) in order to edit code on the VM (where it runs during testing).
While editing through the Windows/VirtualBox works, I ran into a strange problem yesterday: When quick changes are made to files in the shared directory mount on the VM (using an editor on the VM), copies of the files appear in the directory that are prefixed with ".#". For example, while editing a file containing a set of variables to be read by an Ansible playbook:
Code:$ cd <shared-folder>/vars
$ ls
included_data.vars
$ emacs included_data.vars
[make changes]After a short time, what I see in that directory is:
Code:$ ls
.#included_vars.yml included_vars.yml included_vars.yml~When the Ansible script runs, it complains because it's finding the ".#" file first -- which either contained errors or was missing something (hence the need for the edit) -- and crashes the playbook. A suitable workaround is to include "ignore: '.#'" in the playbook. While that works, these files would still be clutter in the file menus making it harder to find real files to edit.
I never see this sort of file getting created when working with files on systems that I'm accessing via SSH.
Q: Any ideas as to which piece of this setup is creating the ".#" files? I suspected VS Code but I can find nothing in the settings that mentions anything about backup files. The VirtualBox settings also don't mention anything about creating and naming backup files like this. (I wouldn't even know where to begin trying to find out whether Win10 is creating these odd files.)
When these files are created, the only sure-fire means of removing them is from the Windows side of the setup. Neither "rm -f '.#filename'" nor the same command via sudo works (permissions). Right-click/Delete in VSCode and/or Win10's file manager will delete them. I can't recall (as I'm writing this) whether I was able to remove them via Emacs dired.
Another co-worker suggested running VSCode directly on the VM -- which would neatly remove the need for the Win10/VirtualBox connection -- but by the time VirtualBox's window title bar, menu/status bars, and then a similar number of title/menu/status bars from VSCode are displayed, there's precious little screen real estate left to do actual editing unless I make the editor typeface too small for my tired eyes.
TIA for any ideas as to where I can disable the creation of these files?
While editing through the Windows/VirtualBox works, I ran into a strange problem yesterday: When quick changes are made to files in the shared directory mount on the VM (using an editor on the VM), copies of the files appear in the directory that are prefixed with ".#". For example, while editing a file containing a set of variables to be read by an Ansible playbook:
Code:$ cd <shared-folder>/vars
$ ls
included_data.vars
$ emacs included_data.vars
[make changes]After a short time, what I see in that directory is:
Code:$ ls
.#included_vars.yml included_vars.yml included_vars.yml~When the Ansible script runs, it complains because it's finding the ".#" file first -- which either contained errors or was missing something (hence the need for the edit) -- and crashes the playbook. A suitable workaround is to include "ignore: '.#'" in the playbook. While that works, these files would still be clutter in the file menus making it harder to find real files to edit.
I never see this sort of file getting created when working with files on systems that I'm accessing via SSH.
Q: Any ideas as to which piece of this setup is creating the ".#" files? I suspected VS Code but I can find nothing in the settings that mentions anything about backup files. The VirtualBox settings also don't mention anything about creating and naming backup files like this. (I wouldn't even know where to begin trying to find out whether Win10 is creating these odd files.)
When these files are created, the only sure-fire means of removing them is from the Windows side of the setup. Neither "rm -f '.#filename'" nor the same command via sudo works (permissions). Right-click/Delete in VSCode and/or Win10's file manager will delete them. I can't recall (as I'm writing this) whether I was able to remove them via Emacs dired.
Another co-worker suggested running VSCode directly on the VM -- which would neatly remove the need for the Win10/VirtualBox connection -- but by the time VirtualBox's window title bar, menu/status bars, and then a similar number of title/menu/status bars from VSCode are displayed, there's precious little screen real estate left to do actual editing unless I make the editor typeface too small for my tired eyes.
TIA for any ideas as to where I can disable the creation of these files?