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


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

Submitter:  Frédéric Jolliton <fjolliton>
Submitted:  Sun 23 Oct 2005 06:09:51 AM UTC
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.2.25 Fixed Release:  4.2.27
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


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 Administrator
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 #1 Fri Jul 1 08:55:19 CEST 2005 i686 AMD Duron(tm) processor AuthenticAMD GNU/Linux
# ls|wc -l
# 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 Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.





Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-12-06 jay Open/ClosedOpen Closed
    Fixed ReleaseNone 4.2.27
2005-11-19 jay StatusNone Fixed
    Assigned toNone jay

Back to the top

Powered by Savane 3.9