Inode not changing on file save - causes problems with docker binds


#1

So if I understand it correctly the docker bind system will only refresh a file if it’s inode changes: https://github.com/docker/docker/issues/15793

After doing some tests atom doesn’t change the inode at all, Is there any way to change this?

❯  Project [master] ls -li 404.php
12059475 -rwxr-xr-x 1 oscar root 465 Nov 29 15:51 404.php

** edits file **

❯  Project [master] ls -li 404.php
12059475 -rwxr-xr-x 1 oscar root 465 Nov 29 15:51 404.php

#2

There is a big difference between “inode changing” and “inode number (or inumber) changing”, to my understanding. The inode is the data structure describing information about data on disk. The inode number (which you’re referring to in your screen dump) is just the address of the data structure. You could change everything about the inode without changing the inode number at all.

Atom doesn’t do anything special. It doesn’t use atomic saves. And unless you activate “Back Up Before Saving” it doesn’t do anything other than a standard open→write→close system.

One thing to double check, you say “edits file” but you don’t mention anything about “saving” the file. In your test are you saving the file?


#3

Yeah, I’m saving the file. I don’t know much about the Linux Filesystem so I’m not really sure.

I don’t have that setting in my settings panel, Is it supposed to be there v1.2.4?

I’ve posted on the docker issue so I will wait for a reply from that. Unless anyone else has had this issue?


#4

People have complained of Atom saving more often than they want and it triggering tools that watch for saves, but nobody has complained that Atom doesn’t trigger those tools enough that I can recall.


#5

When using Vim I had to learn how to configure saving behavior, because this can have important semantic implications if you edit soft or hard links — see docs for the backupcopy option. The two options describe how to save while creating a backup:

  • make a copy of the file and overwrite the original one
  • rename the file and write a new one

Docs contain examples where either behavior is needed:

[If creating the backup file by renaming the original] A program that opens a file, invokes Vim to edit that file, and then tests if the open file was changed (through the file descriptor) will check the backup file instead of the newly created file. “crontab -e” is an example.

And

This [Breaking symbolic or hard links] can be useful for example in source trees where all the files are symbolic or hard links and any changes should stay in the local source tree, not be propagated back to the original source.

Those use cases require an editor with specific behavior, so Atom should choose whether it wants to support them — possibly by allowing plugins to choose.


#6

Atom’s backup-before-saving system is deceptively simple. Nothing nearly as complicated as vim’s or Sublime’s specifically because of the issues you mention. All Atom does is:

  1. Save a copy of the text in memory to a file in the same directory with a different name
  2. Save the text in memory to the file in question

This way, if #2 fails, you still have #1 (or if #1 fails because the disk is full then at least you still have the last saved version of the file) and it doesn’t break links of any kind.


#7

I added the local-history plugin, which seems to trigger inode changes

(A bit of a hack rather than a solution as it adds complexity, but its working now with my docker containers)