Re: Seeming inconsistencies regarding ulimit between getrlimit(2), sh(1), POSIX.1-2008

2017-03-16 Thread Jason McIntyre
On Wed, Mar 15, 2017 at 06:46:54PM -0500, Scott Cheloha wrote:
> Hi,
> 
> getrlimit(2) says:
> 
> > Because this information is stored in the per-process information, this
> > system call must be executed directly by the shell if it is to affect all
> > future processes created by the shell; limit is thus a built-in command
> > to csh(1) and ulimit is the sh(1) equivalent.
> 
> sh(1) hasn't mentioned ulimit since jmc@ rewrote it for revision
> 1.101.
> 
> POSIX.1-2008 says ulimit is an XSI option here:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ulimit.html
> 
> sh(1) talks about how it is mostly POSIX.1-2008 compliant in its
> STANDARDS section.  You can use ulimit from /bin/sh, with or without
> POSIX mode.
> 
> ksh(1) defines ulimit in all its splendor, with its considerable
> capabilities (relative to the POSIX.1-2008 spec), but does not
> mention anything about POSIX, XSI, etc.
> 
> I think the simplest correction is to just change getrlimit(2)
> to say "ksh" instead of "sh" (trivial patch below), so that the
> documentation in the system itself is consistent... but elsewhere
> in the manpages XSI extensions are marked and such, so I don't
> know what else, if anything, should be changed.
> 
> Something just seems off, hence bugs@.
> 
> Thoughts?
> 

the confusion is that there's obviously been an update to posix (that i
didn;t know about) since i wrote sh(1). you are quoting from the 2016
edition, and sh(1) was based on the 2013 edition. from a quick scan, the
builtins hash, type, and unalias have all been added to the builtins.

so the fix is i have to update sh(1). and maybe some other man pages.
thanks for the mail,

jmc

> --
> Scott Cheloha
> 
> Index: getrlimit.2
> ===
> RCS file: /cvs/src/lib/libc/sys/getrlimit.2,v
> retrieving revision 1.27
> diff -u -p -r1.27 getrlimit.2
> --- getrlimit.2 7 Oct 2016 15:48:55 -   1.27
> +++ getrlimit.2 15 Mar 2017 23:00:25 -
> @@ -148,7 +148,7 @@ is thus a built-in command to
>  and
>  .Ic ulimit
>  is the
> -.Xr sh 1
> +.Xr ksh 1
>  equivalent.
>  .Pp
>  The system refuses to extend the data or stack space when the limits
> @@ -206,7 +206,7 @@ and the caller is not the superuser.
>  .El
>  .Sh SEE ALSO
>  .Xr csh 1 ,
> -.Xr sh 1 ,
> +.Xr ksh 1 ,
>  .Xr quotactl 2 ,
>  .Xr sigaction 2 ,
>  .Xr sigaltstack 2 ,



Seeming inconsistencies regarding ulimit between getrlimit(2), sh(1), POSIX.1-2008

2017-03-15 Thread Scott Cheloha
Hi,

getrlimit(2) says:

> Because this information is stored in the per-process information, this
> system call must be executed directly by the shell if it is to affect all
> future processes created by the shell; limit is thus a built-in command
> to csh(1) and ulimit is the sh(1) equivalent.

sh(1) hasn't mentioned ulimit since jmc@ rewrote it for revision
1.101.

POSIX.1-2008 says ulimit is an XSI option here:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ulimit.html

sh(1) talks about how it is mostly POSIX.1-2008 compliant in its
STANDARDS section.  You can use ulimit from /bin/sh, with or without
POSIX mode.

ksh(1) defines ulimit in all its splendor, with its considerable
capabilities (relative to the POSIX.1-2008 spec), but does not
mention anything about POSIX, XSI, etc.

I think the simplest correction is to just change getrlimit(2)
to say "ksh" instead of "sh" (trivial patch below), so that the
documentation in the system itself is consistent... but elsewhere
in the manpages XSI extensions are marked and such, so I don't
know what else, if anything, should be changed.

Something just seems off, hence bugs@.

Thoughts?

--
Scott Cheloha

Index: getrlimit.2
===
RCS file: /cvs/src/lib/libc/sys/getrlimit.2,v
retrieving revision 1.27
diff -u -p -r1.27 getrlimit.2
--- getrlimit.2 7 Oct 2016 15:48:55 -   1.27
+++ getrlimit.2 15 Mar 2017 23:00:25 -
@@ -148,7 +148,7 @@ is thus a built-in command to
 and
 .Ic ulimit
 is the
-.Xr sh 1
+.Xr ksh 1
 equivalent.
 .Pp
 The system refuses to extend the data or stack space when the limits
@@ -206,7 +206,7 @@ and the caller is not the superuser.
 .El
 .Sh SEE ALSO
 .Xr csh 1 ,
-.Xr sh 1 ,
+.Xr ksh 1 ,
 .Xr quotactl 2 ,
 .Xr sigaction 2 ,
 .Xr sigaltstack 2 ,