Blame SOURCES/0029-fish-fix-dir-completion-on-filesystems-w-o-dirent.d_.patch

0d20ef
From 07ac79e2f53f17e79977ea60e42441591e619879 Mon Sep 17 00:00:00 2001
0d20ef
From: Pino Toscano <ptoscano@redhat.com>
0d20ef
Date: Fri, 31 Oct 2014 17:37:22 +0100
0d20ef
Subject: [PATCH] fish: fix dir completion on filesystems w/o dirent.d_type
0d20ef
 (RHBZ#1153844).
0d20ef
0d20ef
On filesystems whose dirent.d_type is DT_UNKNOWN or some unknown value,
0d20ef
manually check whether an entry is a directory, thus completing in the
0d20ef
proper way.
0d20ef
0d20ef
(cherry picked from commit a8b95a5535480c7b382fab82dcaf18eb67e5278a)
0d20ef
---
0d20ef
 fish/destpaths.c | 8 +++++++-
0d20ef
 1 file changed, 7 insertions(+), 1 deletion(-)
0d20ef
0d20ef
diff --git a/fish/destpaths.c b/fish/destpaths.c
0d20ef
index f224106..df1ec00 100644
0d20ef
--- a/fish/destpaths.c
0d20ef
+++ b/fish/destpaths.c
0d20ef
@@ -191,7 +191,13 @@ complete_dest_paths_generator (const char *text, int state)
0d20ef
                   else {
0d20ef
                     words = w;
0d20ef
                     words[nr_words].name = p;
0d20ef
-                    words[nr_words].is_dir = dirents->val[i].ftyp == 'd';
0d20ef
+                    if (dirents->val[i].ftyp == 'u'
0d20ef
+                        || dirents->val[i].ftyp == '?') {
0d20ef
+                      int is_dir = guestfs_is_dir_opts (g, words[nr_words].name,
0d20ef
+                        GUESTFS_IS_DIR_OPTS_FOLLOWSYMLINKS, 1, -1);
0d20ef
+                      words[nr_words].is_dir = is_dir;
0d20ef
+                    } else
0d20ef
+                      words[nr_words].is_dir = dirents->val[i].ftyp == 'd';
0d20ef
                     nr_words++;
0d20ef
                   }
0d20ef
                 }
0d20ef
-- 
0d20ef
1.8.3.1
0d20ef