Subject: bin/18614: sort in -current 10/10/2002 (multiple issues)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <explorer@flame.org>
List: netbsd-bugs
Date: 10/10/2002 23:25:47
>Number:         18614
>Category:       bin
>Synopsis:       sort in -current 10/10/2002 (multiple issues)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 10 16:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     User explorer
>Release:        NetBSD 1.6I
>Organization:
flame.org:  yes, we do know everything
>Environment:
	
	
System: NetBSD speedy.flame.org 1.6I NetBSD 1.6I (GENERIC.MP) #0: Thu Oct 3 22:57:42 PDT 2002 explorer@speedy.flame.org:/u0/OS/src/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
When running sort on a large file (310,199,825 bytes, 46,701,436 lines)
the default file descriptor limits are not sufficient:

	explorer@here-there-be-dragons> sort -u -o foo fename.txt 
	sort: ftmp: mkstemp("/tmp/sort.003822ch"): Too many open files

Running "unlimit" first, which increases my open file litmit
to 12,560 files, produces:

	explorer@here-there-be-dragons> sort -u -o foo fename.txt
	sort: ftmp: mkstemp("/sort.003824xz"): Permission denied

(Note that the variable "tmpdir" is getting smashed here!)

If I put a "char unused_padding[10240];" line in sort.c, between
toutpath and tmpdir, I no longer get this message.  I then get
the "too many open files" again.

sort is quite clearly using too many of these temporary files.  It should
try to limit how many it uses to something that the system-default value
will allow -- 64 is, last I checked, the system default pretty much everywhere.
>How-To-Repeat:
If nothing else works, I can provide a file that I used.
>Fix:
None known.

>Release-Note:
>Audit-Trail:
>Unformatted: