Linux file integrity: the same as Windows
- TAGS:gedit, Kubuntu, Linux, Notepad++, Ubuntu, Windows
- IT TOPICS:Linux, Mainframes & Supercomputers, Operating Systems, Windows & Microsoft
My previous posting described how Windows 7 lets two programs update the same file at the same time, with the inevitable result, data corruption. It's an accident waiting to happen. And the same is true of Linux.
KUBUNTU
Today, I tested with Kubuntu version 8.10 running KDE 4.1.2, the Kate text editor version 3.1.2 and OpenOffice.org Writer version 2.4.1.
I tested two instances of Kate running concurrently and editing the same file. I also tested Kate and Writer simultaneously editing the same file.
The results were the same as with Windows 7, file corruption. Not once was I warned about editing a file that was already being edited by another application.
For example, I opened a test file in Kate, then in Writer. I updated the file in Writer, saved it and exited Writer. Then I updated the file in Kate, saved it and exited Kate. Opening the file again, in either program, shows just the updates from Kate, the updates made in Writer were lost.
To further show how the operating system fails to protect its files, I opened a file in Writer, updated it, saved the updates, left Writer running, switched to the Dolphin file manager and deleted the file being edited. I also started Writer, created a new file, saved the file, switched to Dolphin and was able to delete the file while Writer was still running. This repeats the results I had earlier found in both Ubuntu 7.04 and Windows XP.
Windows 7 also lets you delete a file while it's in use. I opened WordPad, created a new file, saved it, then was able to delete it using Windows Explorer while WordPad was running. The same thing happens with IrfanView - Windows 7 deleted a file that IrfanView had just saved while IrfanView was still running.
UBUNTU
Kubuntu is my least favorite distro, so I also ran these tests on Ubuntu 8.10 running GNOME 2.24.1, gedit 2.24.2, OpenOffice.org Writer 2.4.1 and version 2.24.1 of the Nautilus file browser.
While gedit was editing a file, Nautilus let me delete it. Likewise, a file could be deleted while Writer was editing it.
To test concurrent updates, I opened a file with Writer, then opened it with gedit, updated the file in gedit, saved it and exited gedit. Then I updated the file in Writer, saved it and shut down Writer. As expected, the updates made in Writer clobbered the changes made in gedit.
HIGHER END APPLICATIONS
Higher end applications can offer the integrity that the operating system lacks.
On Windows, for example, my favorite text editor, Notepad++ will not create two instances of itself each editing the same file. The same goes for gedit under Ubuntu.
Both applications also detect changes made by another application. Below is the warning issued by gedit when it detected that Writer had updated the file it was also updating.
Notepad++ issues a similar warning under the same circumstances (it's far too wide however to fit in this web page and still be readable).
FINAL THOUGHTS
Commenters to the prior Windows 7 posting argued in favor of the current approach, data integrity be damned. Many people look at it as an application issue. I see it as an operating system issue. The operating system should protect its files from mistakes made by users (deleting a file while it's in use) and applications (editing a file that another application is already editing).
Still, I seem to be in the minority. Perhaps we get the operating systems we deserve.
Backup, backup backup.
NOTE: Linux supports multiple file systems and it could be that another file system would offer better integrity, I don't know. I'm not a Mac person, so I can't run these tests on OS X.



