public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rust-fd-find] rawhide: Fix test_follow_broken_symlink with ignore 0.4.28+
@ 2026-08-10 13:49 Michel Lind
  0 siblings, 0 replies; only message in thread
From: Michel Lind @ 2026-08-10 13:49 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rust-fd-find
            Branch : rawhide
            Commit : e610fe78e0a9f4dd3faaf4cb5a4eaca10ad8e770
            Author : Michel Lind <salimma@fedoraproject.org>
            Date   : 2026-08-10T14:43:56+01:00
            Stats  : +64/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rust-fd-find/c/e610fe78e0a9f4dd3faaf4cb5a4eaca10ad8e770?branch=rawhide

            Log:
            Fix test_follow_broken_symlink with ignore 0.4.28+

ignore 0.4.28 started attaching depth to walker IO errors, so the error
is now WithPath{WithDepth{Io}} rather than WithPath{Io}. The pattern
match in src/walk.rs only handled the flat shape, so under --follow a
broken symlink was reported as a walk error instead of being emitted as
an entry. Fedora currently ships rust-ignore 0.4.33.

Upstream switched to the recursive ignore::Error::io_error() accessor,
which unwraps any nesting. Merged after 10.4.2, so drop this on the next
release.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Michel Lind <salimma@fedoraproject.org>

---
diff --git a/fd-find-refactor-Get-io-error-from-method.patch b/fd-find-refactor-Get-io-error-from-method.patch
new file mode 100644
index 0000000..635215a
--- /dev/null
+++ b/fd-find-refactor-Get-io-error-from-method.patch
@@ -0,0 +1,59 @@
+From f898e95db5a90190fee6eb6e000e024615d2be85 Mon Sep 17 00:00:00 2001
+From: Thayne McCombs <astrothayne@gmail.com>
+Date: Wed, 1 Jul 2026 00:49:58 -0600
+Subject: [PATCH] refactor: Get io error from method
+
+use `ignore::Error::io_error()` to inspect the `std::io::Error` insted
+of pattern matching on `ignore::Error::Io`.
+
+This avoids relying on the implementation of ignore and how it organizes
+the error. In particular, this would allow us to handle if the IO error
+was wrapped in a `WithDepth`, as would be the case if
+BurntSushi/ripgrep#3458 was merged.
+
+This also allows us to remove some duplicate code.
+---
+ src/walk.rs | 30 ++++++++++--------------------
+ 1 file changed, 10 insertions(+), 20 deletions(-)
+
+diff --git a/src/walk.rs b/src/walk.rs
+index 73c03bd92..30128a0bc 100644
+--- a/src/walk.rs
++++ b/src/walk.rs
+@@ -487,26 +487,16 @@ impl WorkerState {
+                     Err(ignore::Error::WithPath {
+                         path,
+                         err: inner_err,
+-                    }) => match inner_err.as_ref() {
+-                        ignore::Error::Io(io_error)
+-                            if io_error.kind() == io::ErrorKind::NotFound
+-                                && path
+-                                    .symlink_metadata()
+-                                    .ok()
+-                                    .is_some_and(|m| m.file_type().is_symlink()) =>
+-                        {
+-                            DirEntry::broken_symlink(path)
+-                        }
+-                        _ => {
+-                            return match tx.send(WorkerResult::Error(ignore::Error::WithPath {
+-                                path,
+-                                err: inner_err,
+-                            })) {
+-                                Ok(_) => WalkState::Continue,
+-                                Err(_) => WalkState::Quit,
+-                            };
+-                        }
+-                    },
++                    }) if inner_err
++                        .io_error()
++                        .is_some_and(|io_error| io_error.kind() == io::ErrorKind::NotFound)
++                        && path
++                            .symlink_metadata()
++                            .ok()
++                            .is_some_and(|m| m.file_type().is_symlink()) =>
++                    {
++                        DirEntry::broken_symlink(path)
++                    }
+                     Err(err) => {
+                         return match tx.send(WorkerResult::Error(err)) {
+                             Ok(_) => WalkState::Continue,

diff --git a/rust-fd-find.spec b/rust-fd-find.spec
index c97f3f1..db1d366 100644
--- a/rust-fd-find.spec
+++ b/rust-fd-find.spec
@@ -16,6 +16,11 @@ Source:         %{crates_source}
 # * Allow lscolors 0.20
 # * Allow tikv-jemallocator 0.7: https://github.com/sharkdp/fd/pull/2027
 Patch:          fd-find-fix-metadata.diff
+# Fix test_follow_broken_symlink with ignore >= 0.4.28, which wraps the io::Error
+# in an extra Error::WithDepth layer that fd's pattern match did not expect, so
+# broken symlinks were reported as errors instead of entries. Merged upstream
+# after 10.4.2; drop on the next release.
+Patch:          https://github.com/sharkdp/fd/commit/f898e95db5a90190fee6eb6e000e024615d2be85.patch#/fd-find-refactor-Get-io-error-from-method.patch
 
 BuildRequires:  cargo-rpm-macros >= 24
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 13:49 [rpms/rust-fd-find] rawhide: Fix test_follow_broken_symlink with ignore 0.4.28+ Michel Lind

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox