emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Failing filename completion in large NFS-mounted directories


From: Ben North
Subject: Failing filename completion in large NFS-mounted directories
Date: Wed, 31 Aug 2005 16:44:10 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2

I have been having a problem whereby filename completion in a large
directory which lives over a slow NFS link sometimes fails to complete
filenames which are not near the top of the directory (according to "ls
-U").

The machine exhibiting this problem gives

% uname -a
SunOS lukekelly 5.8 Generic_108528-15 sun4u sparc SUNW,Sun-Fire-280R Solaris

I Google'd and came across Stefan Monnier's email:

   http://lists.gnu.org/archive/html/emacs-devel/2005-08/msg00643.html

including this patch to dired.c:


--- dired.c     11 aoû 2005 05:27:35 -0400      1.117
+++ dired.c     14 aoû 2005 02:44:01 -0400      
@@ -224,7 +224,7 @@
 
 #ifdef EAGAIN
       if (dp == NULL && errno == EAGAIN)
-       continue;
+       { QUIT; continue; }
 #endif
 
       if (dp == NULL)
@@ -533,6 +533,10 @@
          dp = (*readfunc) (d);
 #else
          dp = readdir (d);
+#endif
+#ifdef EAGAIN
+         if (dp == NULL && errno == EAGAIN)
+           { QUIT; continue; }
 #endif
          if (!dp) break;


and tried it, but it didn't help.  truss suggested that the getdents64()
system call was being interrupted by SIGALRM, and putting some printf()s
into dired.c revealed that readdir() sometimes returned NULL with errno
set to EINTR rather than EAGAIN.  I modified Stefan's test so that it's

          if (dp == NULL && (errno == EAGAIN || errno == EINTR))

rather than just

          if (dp == NULL && errno == EAGAIN)

in both places, and this seems to have fixed my problem.  I also added
an assignment "errno = 0;" into file_name_completion() to match what's
done in directory_files_internal() and what the Solaris doc for
readdir() suggests.

Might this be useful more generally?  I'm afraid I don't have access to
very many systems so I don't know which systems return EAGAIN and which
EINTR (the system call itself returns ERESTART so perhaps that should be
checked for too?).  I guess this could become hairy but if there's a way
to do this portably it might fix this problem for all users.

Thanks,

Ben.

[I originally emailed Stefan directly and he suggested I passed it on to
the list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]