Subject: bin/31377: ksh: cannot set limit indicated by ulimit -H
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <sjg@juniper.net>
List: netbsd-bugs
Date: 09/23/2005 16:41:00
>Number:         31377
>Category:       bin
>Synopsis:       ksh: cannot set limit indicated by ulimit -H
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 23 16:41:00 +0000 2005
>Originator:     sjg@juniper.net
>Release:        NetBSD 3.99.9
>Organization:
>Environment:
	
	
NetBSD frodo 3.99.9 NetBSD 3.99.9 (GENERIC) #1: Mon Sep 19 10:38:07 PDT 2005  sjg@swift.juniper.net:/c/sjg/work/NetBSD/current/obj/i386/obj/c/sjg/work/NetBSD/current/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	
My .profile uses a function to maximize certain limits, this function 
works on all previous NetBSD as well as many other systems.  The idea
is to set a limit to the value reported by ulimit -H as in:

max_limit() {
    # Linux uses bash as /bin/sh and unlike
    # every other sh like shell it does not
    # handle -<x>H but does handle -H<x>
    # -H -<x> works on some but not all bash versions <grrr/>
    for _ul in `IFS=" -"; echo $*`
    do
        _ulmax=`ulimit -H$_ul`
        ulimit -$_ul $_ulmax
    done
}

On 3.99.9 calling

max_limit -d

fails because:

: sjg:131; umlimit -Hd 
2097152
: sjg:132; ulimit -d 2097152  
ksh: ulimit: bad limit: Invalid argument
: sjg:133; ulimit -d 2097151 
: sjg:134; 

>How-To-Repeat:
	
: sjg:131; umlimit -Hd 
2097152
: sjg:132; ulimit -d 2097152
ksh: ulimit: bad limit: Invalid argument
: sjg:133; ulimit -d 2097151
: sjg:134; 

>Fix:
	

>Unformatted: