VS Code was lost on shutdown with pending update (2018)
github.com
github.com
Clippy didn't die, MS just moved him into the background.
Sadly, the same can be said for a lot of other software these days.
After using Linux more as a daily driver lately, all that "convenience" you get with macOS and Windows - the form of automatic updates and notifications - is incredibly distracting.
... I actually like it most of the time. Not the annoying update message, but when I open a .rs file I actually do want the plugin for syntax highlighting. VSC makes getting such stuff wonderfully easy.
VS Code pops up three notification windows every time I open a .py despite me having closed them literally hundreds of times now.
Apparently it’s smarter than me, and just knows I need its plugins and system integrations despite a year of adamantly refusing.
1. Yeah it's easy, but it's not much easier than searching and installing a package in Sublime Text. And when I'm using a tool I want to be focused on the work, I don't want to be distracted by what MS thinks I want to see when I open my editor. Yeah it only takes a second to dismiss these things, but all these little distractions pulling you out of flow add up. It's amazing how relaxing it is when you don't have that all the time.
2. I don't want to become dependent on it honestly. Like what if VSCode starts to go in a direction I don't like, and I want to change editors, but my workflow depends on all these plugins which I don't even know what they are or how they work because I just installed them mindlessly like a monkey pressing a button in a lab to get a treat.
3. It's part of this whole ethos where software has to be constantly evolving, and developers need to collect data on everything users do to optimize for whatever KPI MS cares about. This goes along with things like A/B testing UI changes, so maybe one day I open VS Code and the menu options are different because they are testing something out on me. Ostensibly that's for my benefit, but it costs me productivity when I am just trying to get some work done.
A text editor is a simple thing. Basically I just don't need any of this extra stuff on top for a tiny little benefit.
Even if you did somehow manage to lose enough money that the damages could bankrupt Valve (or even pay for your lawyer), I doubt you would win. Basically all software these days disclaims all warranties. This wasn't malicious or particularly out of the ordinary for this industry.
Isn't the problem actually not being able to effectively close it to then replace it?
- update immediately(ish) seen by other users of the file (e.g. database); the default UNIX semantics, even for executables
- update seen by other users at the next point they open the file (what you want for update-without reboot, can be achieved on UNIX because deleted inodes hang around)
- it's completely impossible for other users to write, rename etc the file (Windows default)
1. It’s not built into Windows, requires separate download;
2. Searching is hit or miss.
File and it's directory entry are two separate things. So you can remove and replace open file, but the old handle will still point to the old file - it just won't be open-able using the original filename. Once all the processes will close the handle to the old file, and no directory entry points to it, it will be removed from the file system.
Many programs do the "write to temp file and rename on top of old file" trick, which is almost-atomic, and you can have multiple programs doing that to the same file at the same time without noticing.
(If you're on NFS writing to a deleted inode may do something different and probably broken)
I think part of my problem is I'm visualizing this as a shared file being updated by users, and not, say, system updates. System updates make sense - we can assume only the system will be modifying them, and it'll be relatively low touch, but I keep visualizing a shared text document.
Usually these multiple processes have some agreed way to take their turn on writing; or they use library like sqlite (or berkeley db in the past), that library brings that mutually-agreed locking mechanism with it.
The only thing that does work with shared writing is logiles with O_APPEND, where multiple processes can safely add to the end of a file.
(For historical examples of this, have a look at mbox locking versus maildir; the "mbox" format is basically keeping all your email as a huge text file, and locking protocols have developed around that so multiple mail clients can coexists without wrecking it)
> Isn't the problem actually not being able to effectively close it to then replace it?
Not sure what this is supposed to mean. The program that's keeping the file open could effectively close it. The problem is other programs can't, plus it's hard to hunt down the process that's hanging on to a file.
On Unix, the directory entry does not point directly to the file contents. It points to an "inode", which contains the file metadata (owner, permissions, timestamps) and points to the file contents. When you remove a file, you are actually removing the directory entry; the inode will only be removed when nothing else points to or is using it. An open file keeps a reference to the inode, so the system can still read the file just fine, even if the directory entry has been removed.
Some other operating systems, like MS-DOS and Windows 9x, do not have that distinction. On them, the directory entry has the same role as the inode on Unix-style systems, which means it cannot be removed while the file is in use. The Windows NT line, when using NTFS, does have something similar to the directory entry and inode split from Unix, but it still denies removing or replacing in-use files for compatibility with Windows 9x.
> Isn't the problem actually not being able to effectively close it to then replace it?
The problem is when another software (for instance, a file indexer or an antivirus) has the file open. You cannot force the other program to release its grip on the file; the workaround is to set the "pending delete" flag for the file and schedule a reboot.
Also, "You cannot force the other program to release its grip on the file; the workaround is to set the "pending delete" flag for the file and schedule a reboot. " is somewhat wrong. You can close the handle the other program holds on the file, it just might crash that other program.
It might do more than just crash that other program. Some other component within that program might open a new file (or even things which are not really files), and happen to get the same handle you had just closed (once the handle is closed, its number can be reused). Then the original component finishes what it was doing and closes the handle; the second component thinks it's still open. A third component opens a new file, and again gets the same handle. Now the second component tries to write to the handle (it might be something like a log file), and the write goes to the wrong place.
Force closing a handle on a different process leads to undefined behavior, and as always with undefined behavior, anything can happen.
Raymond Chen also has an article about this: http://technet.microsoft.com/en-us/magazine/2009.04.windowsc...
Examples of insane behavior of UNIX's lack of locking:
- A process can get its file corrupted because flock() is cooperative, so there isn't any enforcement that even if file locking is used, it actually works. Hence the dance with temporary lockfiles as workaround.
- A process can happily store important information into a file just to have it deleted under its feet after the usage count of the inode goes to zero, and good luck bringing the data back to life without forensics tools.
Quite sane indeed.
Many people also swear that only bad programmers write C programs with memory corruption bugs.
Files are just memory in a different storage device.
In theory only bad programmers write code with bugs related to Windows file locking, and yet... well just check the OP I guess
This happens when I start a script or a LaTex file etc by right-clicking in an empty folder to create a new text file, then changing the name of the file and its extension. It's an empty file with a .txt extension, yet windows has to ask me whether I'm sure I really want to perform this desperate and dangerous act that might cause some programs to not work any more.
the famous “we changed the names of common git operations, oh boy was that a bad idea” bug.
The first comment about just checking if shutdown is in progress should work.