bug-coreutils
[Top][All Lists]
Advanced

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

Re: mv fails with "Too many open files" when moving _many_ files


From: Jim Meyering
Subject: Re: mv fails with "Too many open files" when moving _many_ files
Date: Mon, 18 Oct 2004 11:00:05 +0200

Cyril Bouthors <address@hidden> wrote:
> I'm having problems when moving everything from a directory that
> contains 10852 top level directories and a total of ~300000+ files and
> subdirectories with this command:

Thanks a lot for that report.
It is indeed a bug.

Here's the fix:

        Plug a leak that would cause rm or a cross-device mv to fail when
        operating on too many command-line-specified nonempty directories.
        * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
        top of the stack before returning.  This usually closes the file
        descriptor that was used to return to the original working directory.
        Reported by Cyril Bouthors in
        http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
        * NEWS: Mention it here.

Index: remove.c
===================================================================
RCS file: /fetish/cu/src/remove.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -p -u -r1.116 -r1.117
--- remove.c    22 Sep 2004 20:13:09 -0000      1.116
+++ remove.c    18 Oct 2004 08:59:12 -0000      1.117
@@ -1151,7 +1151,10 @@ remove_dir (Dirstack_state *ds, char con
        free (empty_dir);
 
        if (AD_stack_height (ds) == 1)
-         break;
+         {
+           free_cwd (&AD_stack_top(ds)->u.saved_cwd);
+           break;
+         }
       }
     }
 




reply via email to

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