bugfindutils - Bugs: bug #14842, Incorrect "Cannot allocate...

 
 

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

Submitted by:  Frédéric Jolliton <fjolliton>
Submitted on:  Sun 23 Oct 2005 06:09:51 AM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Open/Closed: Closed
Release: 4.2.25Fixed Release: 4.2.27

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 06 Dec 2005 07:28:01 AM UTC, comment #3:

lib/savedir.c has diverged from gnulib. However, thanks for the suggestion.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 20 Nov 2005 11:00:32 PM UTC, comment #2:

James, please update lib/savedir.c (and lib/getcwd.c as well) from gnulib.

Dmitry V. Levin <ldv>
Sun 30 Oct 2005 04:47:58 AM UTC, comment #1:

btw, I reported the same problem on bug-tar ML. See http://lists.gnu.org/archive/html/bug-tar/2005-10/msg00031.html

Frédéric Jolliton <fjolliton>
Sun 23 Oct 2005 06:09:51 AM UTC, original submission:

# 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.)

Frédéric Jolliton <fjolliton>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Tue 06 Dec 2005 07:28:01 AM UTCjayOpen/ClosedOpen=>Closed
  Fixed ReleaseNone=>4.2.27
Sat 19 Nov 2005 10:10:57 PM UTCjayStatusNone=>Fixed
  Assigned toNone=>jay

Back to the top


Powered by Savane 3.1-cleanup1