File: inotify-0.10.patch

package info (click to toggle)
rust-notify 8.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 288 kB
  • sloc: makefile: 2
file content (88 lines) | stat: -rw-r--r-- 3,613 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
This patch is based on the upstream commits described below, adapted for use
in the Debian package by Peter Michael Green.

commit 6ac5105a493db58584def456605c4c6ada5f9fba
Author: Fredrik Fornwall <fredrik@fornwall.net>
Date:   Mon Nov 13 09:43:45 2023 +0100

    Update inotify to 0.10
    
    See https://github.com/hannobraun/inotify-rs/blob/main/CHANGELOG.md
    
    This requires updating the MSRV from 1.60 to 1.63.

commit 2a06e5f267ab8881d011d88310b927c5d6e55ea6
Author: Fredrik Fornwall <fredrik@fornwall.net>
Date:   Wed Nov 29 11:31:11 2023 +0100

    Adopt to inotify not consuming `WouldBlock`

Index: rust-notify-6.1.1/src/inotify.rs
===================================================================
--- rust-notify-6.1.1.orig/src/inotify.rs
+++ rust-notify-6.1.1/src/inotify.rs
@@ -411,7 +411,7 @@ impl EventLoop {
         if let Some(ref mut inotify) = self.inotify {
             log::trace!("adding inotify watch: {}", path.display());
 
-            match inotify.add_watch(&path, watchmask) {
+            match inotify.watches().add(&path, watchmask) {
                 Err(e) => {
                     Err(if e.raw_os_error() == Some(libc::ENOSPC) {
                         // do not report inotify limits as "no more space" on linux #266
@@ -442,7 +442,8 @@ impl EventLoop {
                     log::trace!("removing inotify watch: {}", path.display());
 
                     inotify
-                        .rm_watch(w.clone())
+                        .watches()
+                        .remove(w.clone())
                         .map_err(|e| Error::io(e).add_path(path.clone()))?;
                     self.paths.remove(&w);
 
@@ -451,7 +452,8 @@ impl EventLoop {
                         for (w, p) in &self.paths {
                             if p.starts_with(&path) {
                                 inotify
-                                    .rm_watch(w.clone())
+                                    .watches()
+                                    .remove(w.clone())
                                     .map_err(|e| Error::io(e).add_path(p.into()))?;
                                 self.watches.remove(p);
                                 remove_list.push(w.clone());
@@ -471,7 +473,8 @@ impl EventLoop {
         if let Some(ref mut inotify) = self.inotify {
             for (w, p) in &self.paths {
                 inotify
-                    .rm_watch(w.clone())
+                    .watches()
+                    .remove(w.clone())
                     .map_err(|e| Error::io(e).add_path(p.into()))?;
             }
             self.watches.clear();
Index: rust-notify-6.1.1/Cargo.toml
===================================================================
--- rust-notify-6.1.1.orig/Cargo.toml
+++ rust-notify-6.1.1/Cargo.toml
@@ -72,7 +72,7 @@ manual_tests = []
 timing_tests = []
 
 [target."cfg(any(target_os=\"linux\", target_os=\"android\"))".dependencies.inotify]
-version = "0.9"
+version = "0.10"
 default-features = false
 
 [target."cfg(any(target_os=\"linux\", target_os=\"android\"))".dependencies.mio]
--- notify/src/inotify.rs
+++ notify/src/inotify.rs
@@ -370,6 +370,10 @@ impl EventLoop {
                             break;
                         }
                     }
+                    Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {
+                        // No events read. Break out.
+                        break;
+                    }
                     Err(e) => {
                         self.event_handler.handle_event(Err(Error::io(e)));
                     }