On 2018-03-13 at 15:39, Joe wrote: > On Tue, 13 Mar 2018 14:49:56 +0100 <to...@tuxteam.de> wrote:
>> On Tue, Mar 13, 2018 at 10:33:43PM +0900, Mark Fletcher wrote: >>> Unless I've misunderstood the question, you can tell if >>> something is mounted at a mount point by checking if anything is >>> present under the mount point [...] >> >> Not if the file system is really empty (and no, lost+found doesn't >> really count, since not all file systems have that). > > But one use-case is unattended synchronisation, possibly over a > network. If the directory is mounted, but with some kind of problem, > then a check for mounting could succeed without any data being > visible to the synchronising application. In the worst case, the > backup directory might be synchronised to an apparently empty > one.... > > I prefer to test for the existence of a known lower directory in > this case, which tests not only for mounting but for a successful > read. That test can be spoofed, however, by the creation of a directory with the same name (and/or other characteristics) under the mount point while the mount is not active. Even if you don't think anything malicious is ever going to try to spoof this in whatever case is at hand, can you be sure no script (or, for that matter, user) will ever attempt to create that directory under the mistaken impression that the mount is active? -- The Wanderer The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. -- George Bernard Shaw
signature.asc
Description: OpenPGP digital signature