... All editors I've used in Linux do use temporary files, either in user-specific temporary directory....
Try turning off the power unexpectedly for the system or removing the battery from the laptop.
It's happened to me often enough with my small Linux SBC's. I know very, very well how to deal with it in Linux. The only thing that tends to get harmed is if I have to use an SD card for the storage; they really don't like losing power in the middle of a write, generally speaking.
What happens is that data already written to the filesystem journal (I use the default 30 second time limit) is autorecovered on the next boot, and data not written to disk yet is lost. Applications that use temporary files that they apply
fsync() on will be able to recover from the crash.
There is no scenario in Linux where application data would appear in random files on the filesystem. LVM2 does not affect this, nor does mdraid/dmraid/hardware RAID.
Linux uses the inode model, where filesystem entries (file and directory names) are opaque byte sequences delimited by NUL (0), path components delimited by / (47), and each refers to an inode. An inode contains both the data and metadata (size, owner user and group, access mode, extended attributes). An anonymous temporary file is one where the filesystem entry ("name") has been deleted, but the file is open by at least one process. An unnamed temporary file is one opened using the
O_TMPFILE flag, specifying only the directory where the unnamed temporary file may be named later using the
linkat() syscall, in Linux. If the operating system crashes, these will be lost; although a custom invocation of
fsck can recover these into named files on many filesystems, including ext4. If recovered, these will have the contents that were written to disk (or journaled) before the OS crashed. In no case will the temporary file data be scattered or confused somehow.
Windows, even NTFS, works very differently, so the behaviour between Linux and Windows (including WSL, and when running Windows applications in Linux using Wine), is very different.
As to the resolv.conf mess, I would inspect the resolver part of systemd. Standard C library reads
/etc/resolv.conf at run time when certain POSIX functions are run, so network service managers often replace it dynamically whenever the configuration changes, keeping the actual configuration somewhere else. (Similarly for
nsswitch.conf for name services in general, although services typically do not need to modify this one at run time.)
If you write C code, in Linux you should use POSIX
getaddrinfo() for name-to-address translation, and
getnameinfo() for address-to-name translation, not
gethostbyname()/
gethostbyaddr(). The underlying issue is the same as open-coding opendir()/readdir()/closedir(), instead of using the POSIX
nftw() or
scandir() or
glob(), the latter having been available in the same standard C libraries for decades. (Well, except that gethostbyname() and gethostbyaddr() are actually deprecated already nowadays.)