bug-findutils
[Top][All Lists]
Advanced

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

[bug #14842] Incorrect "Cannot allocate memory" error in some cases.


From: Frédéric Jolliton
Subject: [bug #14842] Incorrect "Cannot allocate memory" error in some cases.
Date: Sun, 23 Oct 2005 06:09:51 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051017 Firefox/1.0.7

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14842>

                 Summary: Incorrect "Cannot allocate memory" error in some
cases.
                 Project: findutils
            Submitted by: fjolliton
            Submitted on: dim 23.10.2005 à 06:09
                Category: find
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 4.2.25
           Fixed Release: None

    _______________________________________________________

Details:

# uname -a
Linux tania 2.6.12.1-vs2.0-rc4 #1 Fri Jul 1 08:55:19 CEST 2005 i686 AMD
Duron(tm) processor AuthenticAMD GNU/Linux
# ls|wc -l
35396
# find
.
find: .: Cannot allocate memory

Using ltrace -S, here is the part that cause the above error:

23148 realloc(0xb7e45008, 524288 <unfinished ...>
23148 SYS_mremap(0xb7e45000, 266240, 528384, 1, 528384)                      
  = -12
23148 SYS_mmap2(0, 528384, 3, 34, -1)                                        
  = 0xb7dc4000
23148 SYS_munmap(0xb7e45000, 266240)                                         
  = 0
23148 <... realloc resumed> ) 

The SYS_mremap call return -12 (ENOMEM) which cause errno to be set to
this value. However, realloc then try mmap2 (and unmap previous memory
block.) What happen is that realloc succeed, but also set errno (which
is permitted by the C standard if I understand correctly.)

But, savedirinfo.c/xsavedir call extendbuf (which call realloc) and
keep errno to its value even if memory was correctly extended. At the
end of the xsavedir function, errno value is tested and cause result
to be discarded and NULL returned.

I think this behavior is wrong. In extendbuf, the errno value should
be reset to its initial value if it succeed.

(Unrelated: the 'tar' command seem to be affected by this behavior too.)






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14842>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/





reply via email to

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