zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: ulimit behaviour of bash vs. zsh
Date: Mon, 06 Oct 2014 14:23:22 +0100	[thread overview]
Message-ID: <20141006142322.6bb84db0@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <2014-10-06T14-23-03@devnull.michael-prokop.at>

On Mon, 06 Oct 2014 14:30:46 +0200
Michael Prokop <news@michael-prokop.at> wrote:
> this is what Bash does:
> 
> $ ulimit -l
> 64
> $ ulimit -l unlimited
> bash: ulimit: max locked memory: cannot modify limit: Operation not permitted
> $ echo $?
> 1
> 
> While that's the behaviour of Zsh:
> 
> % ulimit -l
> 64
> % ulimit -l unlimited
> % echo $?
> 0
> % ulimit -l
> 64
> 
> I find this quite irritating. Is that behaviour by intention? :)

I think it might be, but it's a little obscure and took some tracking
down.  It turns out if you set a soft limit to unlimited the shell is
smart / overdesigned enough to know that the maximum you can actually
set it to successfully is the value of the hard limit, so it silently
downgrades your "unlimited" request to the maximum you can actually
get.  (Line 670 of Src/Builtins/rlimits.c for those following along not
at home; line 652 does the same if the limit isn't known by
name/letter.  Whether setting the internal limits structure before a
system call that may fail is also problematic I don't know.)

Why I'm not sure it's intentional is the documentation says there's a
special value "hard" to set the limit to the value of the hard limit; it
says nothing about do this with the value "unlimited" that I can see.
This bypasses a lot of internal shell logic but ends up doing roughly
the same thing.

I suppose it could at least warn about this.

pws


      reply	other threads:[~2014-10-06 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 12:30 Michael Prokop
2014-10-06 13:23 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141006142322.6bb84db0@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).