inotify reports paths relative to directory being watched
authorJoey Hess <joeyh@joeyh.name>
Fri, 13 Aug 2021 18:51:15 +0000 (14:51 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 13 Aug 2021 18:51:15 +0000 (14:51 -0400)
Sponsored-by: Dartmouth College's DANDI project
Annex/Verify.hs

index 368677a8f2e9767108299113df8632119c9fd5e4..72ac71b86891ca5f5e57ad26930f801e5977ac48 100644 (file)
@@ -199,13 +199,13 @@ tailVerify iv f finished =
        inotifycreate i cont = INotify.addWatch i evs (P.takeDirectory f) $ \case
                -- Ignore changes to other files in the directory.
                INotify.Created { INotify.filePath = fn }
-                       | fn /= f -> noop
+                       | fn /= basef -> noop
                INotify.MovedIn { INotify.filePath = fn }
-                       | fn /= f -> noop
+                       | fn /= basef -> noop
                INotify.Opened { INotify.maybeFilePath = fn }
-                       | fn /= Just f -> noop
+                       | fn /= Just basef -> noop
                INotify.Modified { INotify.maybeFilePath = fn }
-                       | fn /= Just f -> noop
+                       | fn /= Just basef -> noop
                _ -> cont
          where
                evs = 
@@ -215,6 +215,7 @@ tailVerify iv f finished =
                        , INotify.Open
                        , INotify.Modify
                        ]
+               basef = P.takeFileName f
        
        go = INotify.withINotify $ \i -> do
                h <- waitforfiletoexist i