zsh-users
 help / color / mirror / code / Atom feed
* ulimit "command not found" when run from a script on NetBSD
@ 2005-09-19 19:21 Vincent Stemen
  2005-09-20  2:07 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Stemen @ 2005-09-19 19:21 UTC (permalink / raw)
  To: zsh-users

When I run ulimit from a script with "#!/bin/sh"  (with sh sym-linked to
zsh), I get "command not found: ulimit".  However, it works fine from
the command line or from a script with "#!/bin/zsh".  It also works if
I say "emulate sh" in the script as long as it is not run with
"#!/bin/sh".

Could this be a bug?

zsh version: zsh 4.2.4 (i386--netbsdelf)

-- 
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://inetaddresses.net/about_NSI.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-19 19:21 ulimit "command not found" when run from a script on NetBSD Vincent Stemen
@ 2005-09-20  2:07 ` Bart Schaefer
  2005-09-20  2:54   ` Andrey Borzenkov
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2005-09-20  2:07 UTC (permalink / raw)
  To: zsh-users

On Sep 19,  2:21pm, Vincent Stemen wrote:
}
} Could this be a bug?

The ulimit builtin comes from the rlimits module.  Modules are not
automatically loaded when zsh runs as "sh", to avoid polluting the
variable namespaces or replacing external commands with builtins.

Whether it's noncompliant from a POSIX point of view that "ulimit"
is not a "normal" builtin, I don't know.  (I ought to bookmark the
spec one of these days ...)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-20  2:07 ` Bart Schaefer
@ 2005-09-20  2:54   ` Andrey Borzenkov
  2005-09-20 14:54     ` Vincent Stemen
  0 siblings, 1 reply; 8+ messages in thread
From: Andrey Borzenkov @ 2005-09-20  2:54 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

On Tuesday 20 September 2005 06:07, Bart Schaefer wrote:
> On Sep 19,  2:21pm, Vincent Stemen wrote:
> }
> } Could this be a bug?
>
> The ulimit builtin comes from the rlimits module.  Modules are not
> automatically loaded when zsh runs as "sh", to avoid polluting the
> variable namespaces or replacing external commands with builtins.
>
> Whether it's noncompliant from a POSIX point of view that "ulimit"
> is not a "normal" builtin, I don't know.  (I ought to bookmark the
> spec one of these days ...)

well, ulimit shell builtin is part of current SUS:

Since ulimit affects the current shell execution environment, it is always 
provided as a shell regular built-in. 

I do not have POSIX to check.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-20  2:54   ` Andrey Borzenkov
@ 2005-09-20 14:54     ` Vincent Stemen
  2005-09-20 15:57       ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Stemen @ 2005-09-20 14:54 UTC (permalink / raw)
  To: zsh-users

On Tue, Sep 20, 2005 at 06:54:57AM +0400, Andrey Borzenkov wrote:
> On Tuesday 20 September 2005 06:07, Bart Schaefer wrote:
> > On Sep 19,  2:21pm, Vincent Stemen wrote:
> > }
> > } Could this be a bug?
> >
> > The ulimit builtin comes from the rlimits module.  Modules are not
> > automatically loaded when zsh runs as "sh", to avoid polluting the
> > variable namespaces or replacing external commands with builtins.
> >
> > Whether it's noncompliant from a POSIX point of view that "ulimit"
> > is not a "normal" builtin, I don't know.  (I ought to bookmark the
> > spec one of these days ...)
> 
> well, ulimit shell builtin is part of current SUS:
> 
> Since ulimit affects the current shell execution environment, it is always 
> provided as a shell regular built-in. 
> 
> I do not have POSIX to check.

I just downloaded the posix_std-1003.1-2004 document and it does indeed
say that.

I encountered the problem when running the mysql startup script for
NetBSD using zsh in place of sh.  It has the line
ulimit -n 4096
just before it starts up the mysql server.  The BSD shell works fine
with it. 

Is this something that can be easily corrected in zsh?

-- 
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://inetaddresses.net/about_NSI.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-20 14:54     ` Vincent Stemen
@ 2005-09-20 15:57       ` Bart Schaefer
  2005-09-20 16:39         ` Andrey Borzenkov
  2005-09-21  0:30         ` Vincent Stemen
  0 siblings, 2 replies; 8+ messages in thread
From: Bart Schaefer @ 2005-09-20 15:57 UTC (permalink / raw)
  To: zsh-users

On Sep 20,  9:54am, Vincent Stemen wrote:
} Subject: Re: ulimit "command not found" when run from a script on NetBSD
}
} Is this something that can be easily corrected in zsh?

Most immediately, you can put

  zmodload -ab -i zsh/rlimits ulimit

into /etc/zshrc.

Longer-term, the developers need to get the equivalent of that into
the (auto-generated) Src/bltinmods.list file.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-20 15:57       ` Bart Schaefer
@ 2005-09-20 16:39         ` Andrey Borzenkov
  2005-09-21  0:30         ` Vincent Stemen
  1 sibling, 0 replies; 8+ messages in thread
From: Andrey Borzenkov @ 2005-09-20 16:39 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Tuesday 20 September 2005 19:57, Bart Schaefer wrote:
> On Sep 20,  9:54am, Vincent Stemen wrote:
> } Subject: Re: ulimit "command not found" when run from a script on NetBSD
> }
> } Is this something that can be easily corrected in zsh?
>
> Most immediately, you can put
>
>   zmodload -ab -i zsh/rlimits ulimit
>
> into /etc/zshrc.
>
> Longer-term, the developers need to get the equivalent of that into
> the (auto-generated) Src/bltinmods.list file.

what's the point of having it as module then?

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-20 15:57       ` Bart Schaefer
  2005-09-20 16:39         ` Andrey Borzenkov
@ 2005-09-21  0:30         ` Vincent Stemen
  2005-09-21  2:21           ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: Vincent Stemen @ 2005-09-21  0:30 UTC (permalink / raw)
  To: zsh-users

On Tue, Sep 20, 2005 at 03:57:55PM +0000, Bart Schaefer wrote:
> On Sep 20,  9:54am, Vincent Stemen wrote:
> } Subject: Re: ulimit "command not found" when run from a script on NetBSD
> }
> } Is this something that can be easily corrected in zsh?
> 
> Most immediately, you can put
> 
>   zmodload -ab -i zsh/rlimits ulimit
> 
> into /etc/zshrc.
> 
> Longer-term, the developers need to get the equivalent of that into
> the (auto-generated) Src/bltinmods.list file.

Thanks Bart.

That worked fine.  I had to put it in the sh environment script
specified by $ENV, rather than /etc/zshrc, since zsh does not read
/etc/zshrc when run as sh.  I just though I would note that for anybody
else who might encounter this issue.

BTW, is there any particular reason there is no mention of the rlimits
module in the manual.  I did not find it when I searched zshall(1).  It
does cover ulimit under the build-in commands section.

Regards,
Vincent


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ulimit "command not found" when run from a script on NetBSD
  2005-09-21  0:30         ` Vincent Stemen
@ 2005-09-21  2:21           ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2005-09-21  2:21 UTC (permalink / raw)
  To: zsh-users

On Sep 20,  8:39pm, Andrey Borzenkov wrote:
} Subject: Re: ulimit "command not found" when run from a script on NetBSD
}
} 
} On Tuesday 20 September 2005 19:57, Bart Schaefer wrote:
} > Longer-term, the developers need to get the equivalent of that into
} > the (auto-generated) Src/bltinmods.list file.
} 
} what's the point of having it as module then?

I never understood why it was made into a module in the first place.
It's static-linked into the main binary so it's not like it's keeping
down the size of the executable.

On the assumption, however, that there was a reason for it (and not
just "because we can"), autoloading ulimit in POSIX mode is needed.
Ideally limit and unlimit would remain disabled unless explicitly
asked for, but that might be more difficult.

On Sep 20,  7:30pm, Vincent Stemen wrote:
} Subject: Re: ulimit "command not found" when run from a script on NetBSD
}
} BTW, is there any particular reason there is no mention of the rlimits
} module in the manual.

Yes; because it's statically linked into the main binary and (except in
sh emulation) all the commands in it are marked for autoloading, so it
does not behave like a module most of the time.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-09-21  2:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-19 19:21 ulimit "command not found" when run from a script on NetBSD Vincent Stemen
2005-09-20  2:07 ` Bart Schaefer
2005-09-20  2:54   ` Andrey Borzenkov
2005-09-20 14:54     ` Vincent Stemen
2005-09-20 15:57       ` Bart Schaefer
2005-09-20 16:39         ` Andrey Borzenkov
2005-09-21  0:30         ` Vincent Stemen
2005-09-21  2:21           ` Bart Schaefer

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