Diffusion Solid 5f97573881fe

[FstabWatcher] Fix loosing of fstab watcher

Authored by bruns on Apr 12 2020, 5:36 PM.

Description

[FstabWatcher] Fix loosing of fstab watcher

Summary:
In case the fstab is deleted (caused by editing it), the watch will be
removed. The code already partially dealed with this, i.e. it tried to
readd the watch, but did not check if the operation succeeded and dropped
any further changes if not.

Keep a watch on the containing folder and readd the fstab on change
events. Unfortunately QFilesystemWatcher does not allow fine granular
change events, though as /etc/ is likely mostly silent this should not
matter much.

The bug becomes apparent when e.g. editing the fstab with VIM, which
has a quite broken implementation of creating temporary/backup files
during save: it moves away the original file and creates the new file
directly under the original name, instead of using a atomic rename.

Test Plan:

  1. solid-hardware listen
  2. open fstab with vi, save a few times

Without the change, solid will loose the watch sooner or later.

Depends on D28779

Reviewers: Frameworks, ngraham, apol

Reviewed By: ngraham, apol

Subscribers: apol, kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D28780

Details

Committed
brunsApr 21 2020, 10:18 AM
Reviewer
ngraham
Differential Revision
D28780: [FstabWatcher] Fix loosing of fstab watcher
Parents
R245:3adf5d472448: [Fstab] Do not emit deviceAdded twice on fstab/mtab changes
Branches
Unknown
Tags
Unknown