<div dir="ltr">Does it apply cleanly for you? I&#39;m seeing:<div><br></div><div><div>WARNING: findutils-4.6.0-r0 do_patch: </div><div>Some of the context lines in patches were ignored. This can lead to incorrectly applied patches.</div><div>The context lines in the patches can be updated with devtool:</div><div><br></div><div>    devtool modify &lt;recipe&gt;</div><div>    devtool finish --force-patch-refresh &lt;recipe&gt; &lt;layer_path&gt;</div><div><br></div><div>Then the updated patches and the source tree (in devtool&#39;s workspace)</div><div>should be reviewed to make sure the patches apply in the correct place</div><div>and don&#39;t introduce duplicate lines (which can, and does happen</div><div>when some of the context is ignored). Further information:</div><div><a href="http://lists.openembedded.org/pipermail/openembedded-core/2018-March/148675.html">http://lists.openembedded.org/pipermail/openembedded-core/2018-March/148675.html</a></div><div><a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450">https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450</a></div><div>Details:</div><div>Applying patch 0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch</div><div>patching file NEWS</div><div>Hunk #1 succeeded at 42 with fuzz 2.</div><div>patching file doc/find.texi</div><div>patching file find/find.1</div><div>Hunk #1 succeeded at 479 with fuzz 1.</div><div>patching file find/pred.c</div><div><br></div><div>Now at patch 0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 19, 2018 at 12:25 PM Zhixiong Chi &lt;<a href="mailto:zhixiong.chi@windriver.com">zhixiong.chi@windriver.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">the &#39;-delete&#39; action no longer complains about disappeared files<br>
when the &#39;-ignore_readdir_race&#39; option is given, too. That action<br>
will also returns true in such a case now.<br>
<br>
Signed-off-by: Zhixiong Chi &lt;<a href="mailto:zhixiong.chi@windriver.com" target="_blank">zhixiong.chi@windriver.com</a>&gt;<br>
---<br>
 ...-honour-the-ignore_readdir_race-opti.patch | 145 ++++++++++++++++++<br>
 .../findutils/<a href="http://findutils_4.6.0.bb" rel="noreferrer" target="_blank">findutils_4.6.0.bb</a>              |   4 +-<br>
 2 files changed, 148 insertions(+), 1 deletion(-)<br>
 create mode 100644 meta/recipes-extended/findutils/findutils/0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch<br>
<br>
diff --git a/meta/recipes-extended/findutils/findutils/0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch b/meta/recipes-extended/findutils/findutils/0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch<br>
new file mode 100644<br>
index 0000000000..45e499a184<br>
--- /dev/null<br>
+++ b/meta/recipes-extended/findutils/findutils/0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch<br>
@@ -0,0 +1,145 @@<br>
+From 0afb2efada7e435ae18ef7d3db0758464189f44f Mon Sep 17 00:00:00 2001<br>
+From: Bernhard Voelker &lt;<a href="mailto:mail@bernhard-voelker.de" target="_blank">mail@bernhard-voelker.de</a>&gt;<br>
+Date: Tue, 30 Jan 2018 23:30:09 +0100<br>
+Subject: find: make -delete honour the -ignore_readdir_race option<br>
+<br>
+* find/pred.c (pred_delete): Return true when the -ignore_readdir_race<br>
+option is active and unlinkat() came back with ENOENT.<br>
+* doc/find.texi (Option -ignore_readdir_race): Document the change.<br>
+(Action -delete): Likewise.<br>
+* find/find.1: Likewise.<br>
+* NEWS (Bug Fixes): Mention the fix.<br>
+<br>
+For now, it seems a bit hard to add a proper test for this,<br>
+so the following shell snippet demonstrates the race:<br>
+<br>
+  $ seq 10 | xargs touch<br>
+  $ env time -f &#39;find exit status: %x\nfind time: %e&#39; \<br>
+      find -ignore_readdir_race -type f \<br>
+        -delete \<br>
+        -exec sh -c &#39;sleep $(basename {})&#39; \; \<br>
+        -printf &#39;find deleted: %p\n&#39; \<br>
+        &amp; \<br>
+    sleep 20; \<br>
+    seq 10 | xargs rm -fv; \<br>
+    wait $!<br>
+<br>
+Reported by Alexander Golubev in<br>
+<a href="https://savannah.gnu.org/bugs/?52981" rel="noreferrer" target="_blank">https://savannah.gnu.org/bugs/?52981</a><br>
+<br>
+Upstream-Status: Backport<br>
+Signed-off-by : Zhixiong Chi &lt;<a href="mailto:zhixiong.chi@windriver.com" target="_blank">zhixiong.chi@windriver.com</a>&gt;<br>
+---<br>
+ NEWS          |  4 ++++<br>
+ doc/find.texi | 15 ++++++++++++++-<br>
+ find/find.1   | 22 ++++++++++++++++++++++<br>
+ find/pred.c   |  6 ++++++<br>
+ 4 files changed, 46 insertions(+), 1 deletion(-)<br>
+<br>
+diff --git a/NEWS b/NEWS<br>
+index 88cf17d..9809bf4 100644<br>
+--- a/NEWS<br>
++++ b/NEWS<br>
+@@ -42,6 +42,10 @@<br>
+<br>
+ ** Bug Fixes<br>
+<br>
++#52981: find: the &#39;-delete&#39; action no longer complains about disappeared files<br>
++        when the &#39;-ignore_readdir_race&#39; option is given, too.  That action will<br>
++        also returns true in such a case now.<br>
++<br>
+ Applied patch #8688: Spelling fixes.<br>
+<br>
+ * Major changes in release 4.5.18, 2015-12-27<br>
+diff --git a/doc/find.texi b/doc/find.texi<br>
+index 3580be7..0089193 100644<br>
+--- a/doc/find.texi<br>
++++ b/doc/find.texi<br>
+@@ -1418,7 +1418,15 @@ gives a significant increase in search speed.<br>
+ If a file disappears after its name has been read from a directory but<br>
+ before @code{find} gets around to examining the file with @code{stat},<br>
+ don&#39;t issue an error message.  If you don&#39;t specify this option, an<br>
+-error message will be issued.  This option can be useful in system<br>
++error message will be issued.<br>
++<br>
++Furthermore, @code{find} with the @samp{-ignore_readdir_race} option<br>
++will ignore errors of the @samp{-delete} action in the case the file<br>
++has disappeared since the parent directory was read: it will not output<br>
++an error diagnostic, and the return code of the @samp{-delete} action<br>
++will be true.<br>
++<br>
++This option can be useful in system<br>
+ scripts (cron scripts, for example) that examine areas of the<br>
+ filesystem that change frequently (mail queues, temporary directories,<br>
+ and so forth), because this scenario is common for those sorts of<br>
+@@ -2779,6 +2787,11 @@ explicitly.<br>
+ <br>
+ If @samp{-delete} fails, @code{find}&#39;s exit status will be nonzero<br>
+ (when it eventually exits).<br>
++<br>
++Together with the @samp{-ignore_readdir_race} option, @code{find} will<br>
++ignore errors of the @samp{-delete} action in the case the file has disappeared<br>
++since the parent directory was read: it will not output an error diagnostic, and<br>
++the return code of the @samp{-delete} action will be true.<br>
+ @end deffn<br>
+ <br>
+ @node Adding Tests<br>
+diff --git a/find/find.1 b/find/find.1<br>
+index 0437cd8..0d44c37 100644<br>
+--- a/find/find.1<br>
++++ b/find/find.1<br>
+@@ -479,6 +479,17 @@ this option on and part of it with this option off<br>
+ (if you need to do that, you will need to issue two \fBfind\fR commands<br>
+ instead, one with the option and one without it).<br>
+ <br>
++Furthermore,<br>
++.B find<br>
++with the<br>
++.B \-ignore_readdir_race<br>
++option will ignore errors of the<br>
++.B \-delete<br>
++action in the case the file has disappeared since the parent directory was read:<br>
++it will not output an error diagnostic, and the return code of the<br>
++.B \-delete<br>
++action will be true.<br>
++<br>
+ .IP &quot;\-maxdepth \fIlevels\fR&quot;<br>
+ Descend at most \fIlevels\fR (a non-negative integer) levels of<br>
+ directories below the starting-points.<br>
+@@ -1030,6 +1041,17 @@ and<br>
+ .B \-delete<br>
+ together.<br>
+ <br>
++Together with the<br>
++.B \-ignore_readdir_race<br>
++option,<br>
++.B find<br>
++will ignore errors of the<br>
++.B \-delete<br>
++action in the case the file has disappeared since the parent directory was<br>
++read: it will not output an error diagnostic, and the return code of the<br>
++.B \-delete<br>
++action will be true.<br>
++<br>
+ .IP &quot;\-exec \fIcommand\fR ;&quot;<br>
+ Execute \fIcommand\fR; true if 0 status is returned.  All following<br>
+ arguments to<br>
+diff --git a/find/pred.c b/find/pred.c<br>
+index 7e2a7bd..af3bacb 100644<br>
+--- a/find/pred.c<br>
++++ b/find/pred.c<br>
+@@ -324,6 +324,12 @@ pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred<br>
+       }<br>
+       else<br>
+       {<br>
++        if (ENOENT == errno &amp;&amp; options.ignore_readdir_race)<br>
++          {<br>
++            /* Ignore unlink() error for vanished files.  */<br>
++            errno = 0;<br>
++            return true;<br>
++          }<br>
+         if (EISDIR == errno)<br>
+           {<br>
+             if ((flags &amp; AT_REMOVEDIR) == 0)<br>
+--<br>
+cgit v1.0-41-gc330<br>
diff --git a/meta/recipes-extended/findutils/<a href="http://findutils_4.6.0.bb" rel="noreferrer" target="_blank">findutils_4.6.0.bb</a> b/meta/recipes-extended/findutils/<a href="http://findutils_4.6.0.bb" rel="noreferrer" target="_blank">findutils_4.6.0.bb</a><br>
index 072d3b3c05..db03252f54 100644<br>
--- a/meta/recipes-extended/findutils/<a href="http://findutils_4.6.0.bb" rel="noreferrer" target="_blank">findutils_4.6.0.bb</a><br>
+++ b/meta/recipes-extended/findutils/<a href="http://findutils_4.6.0.bb" rel="noreferrer" target="_blank">findutils_4.6.0.bb</a><br>
@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = &quot;file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949&quot;<br>
<br>
 DEPENDS = &quot;bison-native&quot;<br>
<br>
-SRC_URI += &quot;file://0001-Unset-need_charset_alias-when-building-for-musl.patch&quot;<br>
+SRC_URI += &quot;file://0001-Unset-need_charset_alias-when-building-for-musl.patch \<br>
+            file://0001-find-make-delete-honour-the-ignore_readdir_race-opti.patch \<br>
+&quot;<br>
<br>
 SRC_URI[md5sum] = &quot;9936aa8009438ce185bea2694a997fc1&quot;<br>
 SRC_URI[sha256sum] = &quot;ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d&quot;<br>
-- <br>
2.17.1<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>