Re: [PATCH] man: Document ulimit -v

2016-01-20 Thread Jérémie Courrèges-Anglas
Gioele Barabucci  writes:

> Document that `ulimit` can set the `RLIMIT_AS` limit (virtual memory) with
> the `-v` flag.

I don't know much about RLIMIT_AS, but I know that it isn't supported on
all systems where dash runs, eg OpenBSD.  Maybe is it Linux-specific?

Anyway, it would be better if the manpage said that the -v flag may not
be implemented on all platforms.

The same could be said about ulimit -w. (I did not check the other flags).

> Fixes: https://bugs.debian.org/78556
> Reported-by: Vincent Lefevre 
> Signed-off-by: Gioele Barabucci 
> ---
>  src/dash.1 | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/dash.1 b/src/dash.1
> index 832eae7..8b8026d 100644
> --- a/src/dash.1
> +++ b/src/dash.1
> @@ -2114,7 +2114,7 @@ printed; for commands and tracked aliases the complete 
> pathname of the
>  command is printed.
>  .It ulimit Xo
>  .Op Fl H \*(Ba Fl S
> -.Op Fl a \*(Ba Fl tfdscmlpn Op Ar value
> +.Op Fl a \*(Ba Fl tfdscmlpnv Op Ar value
>  .Xc
>  Inquire about or set the hard or soft limits on processes or set new
>  limits.
> @@ -2164,6 +2164,9 @@ show or set the limit on the number of processes this 
> user can
>  have at one time
>  .It Fl n
>  show or set the limit on the number files a process can have open at once
> +.It Fl v
> +show or set the limit on the total virtual memory that can be
> +in use by a process (in kilobytes)
>  .It Fl r
>  show or set the limit on the real-time scheduling priority of a process
>  .El

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH dash] [BUILTIN] ensure LC_COLLATE is not overriden

2014-08-05 Thread Jérémie Courrèges-Anglas
Chema Gonzalez ch...@google.com writes:

 If the user environment has either LC_ALL or LANG defined, the setting
 of LC_COLLATE in src/mkbuiltins is overriden. With a non-POSIX locale,
 the orders of dotcmd (remember that '.' is 0x2e in ascii) and truecmd
 (':' is 0x3a in ascii) are reversed, which makes the : command fail
 in the bsearch.

Actually the problem should only occur when you set LC_ALL, which
overrides LANG and LC_COLLATE.  Even though some may find nice to
protect the unwary, but I'd expect lots of brokenness in this unusual
build situation, and this not limited to dash.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] \e in echo and printf builtins

2014-07-23 Thread Jérémie Courrèges-Anglas
Adam Borowski kilob...@angband.pl writes:

 On Sat, Jun 28, 2014 at 07:27:22PM +0200, Adam Borowski wrote:
 On Sat, Jun 28, 2014 at 06:52:51PM +0200, Harald van Dijk wrote:
  On 28/06/14 06:56, Adam Borowski wrote:
   I'm not sure what's your policy towards extensions, but \e as \033 is
   something ubiquitous in the Unix world.  C compilers (gcc, clang, icc and
   tcc -- but not MSVC), perl, shells (bash and zsh -- but not dash), etc.
  
  No comment on whether dash itself should accept \e, but [...]

 So... can I has an answer whether dash should indeed accept \e ?
 Being told no or go away, we hate you is fine, I just dislike having
 patches rot forever.  And not having this shorthand is annoying if you
 like using colour for highlights -- it works in perl and bash, then
 suddenly Oops! not in /bin/sh = dash.

I agree with Erik Blake, IMO there is no reason for dash to support \e
unless POSIX standardizes it first.  Except if you want to encourage
unportable scripts, of course.  /bin/sh is not necessarily bash or dash.

$ /bin/sh
$ type echo
echo is a shell builtin
$ echo '\033[1m hello \033[0m'
 hello # (bold)
$ /bin/echo '\033[1m hello \033[0m'
\033[1m hello \033[0m
$ echo '\e[1m hello \e[0m'
\e[1m hello \e[0m
$ /bin/echo  '\e[1m hello \e[0m'
\e[1m hello \e[0m
$

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] implement privmode support in dash

2013-08-23 Thread Jérémie Courrèges-Anglas
Tavis Ormandy tav...@google.com writes:

 On Thu, Aug 22, 2013 at 1:35 PM, Jilles Tjoelker jil...@stack.nl wrote:
 I think there is no reason to deviate from other shells here. Therefore,
 please call it privileged.


 Agreed.

 In bash and FBSD, after starting with -p, set +p can be used to drop
 privileges. With your patch, dash accepts set +p, but silently ignores it.

 How does something like the attached, to be applied on top of your
 patch, look?

 [snip]
 + if (!on  (uid != geteuid() || gid != getegid())) {
 + setuid(uid);
 + setgid(gid);
 + /* PS1 might need to be changed accordingly. */
 + choose_ps1();
 + }
 +}

 This code tries to use setuid() and setgid() to drop all privilege,
 which is only correct if the privilege to be dropped is UID 0, or on BSD
 systems. It would be better to use setresuid() or setreuid(), and change
 the GID before changing the UID.

 This is logic duplicated from pdksh and bash, I'm slightly reluctant
 to do things differently, unless it's not going to get committed
 otherwise.

pdksh is only maintained by OpenBSD, afaik (mksh syncs regularly).
The current code rather looks like this:

if (f == FPRIVILEGED  oldval  !newval) {
gid_t gid = getgid();

setresgid(gid, gid, gid);
setgroups(1, gid);
setresuid(ksheuid, ksheuid, ksheuid);
} ...

 You can see some code snippets here:
 http://blog.cmpxchg8b.com/2013/08/security-debianisms.html

 Apart from that, it is better to check the return value from setuid()
 and similar functions. In particular, some versions of Linux may fail
 setuid() for [EAGAIN], leaving the process running with the same
 privileges.

 I don't think this is true anymore, but I have no strong objection to
 adding it, so long as it's noted that bash and pdksh do not do this.

 Tavis.

-- 
jca | PGP: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: (another) patch for dash

2013-01-10 Thread Jérémie Courrèges-Anglas
Hi,

with Aleksey we briefly discussed the mdoc compatibility of the manpage,
here's a patch that makes mandoc 1.12.1 happier and behaves correctly
against groff 1.21.  I want to include it in the staging dash-0.5.7
OpenBSD port.

Regards,
-- 
Jérémie Courrèges-Anglas
GPG Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494



patch-src_dash_1
Description: Binary data


pgpBJglqWpAyl.pgp
Description: PGP signature


Re: patch for dash

2013-01-06 Thread Jérémie Courrèges-Anglas
Aleksey Cheusov v...@gmx.net writes:

 Hi. The following patch fixes dash build failure on Solaris
 where /usr/bin/nl (which is in default PATH) is not POSIX compatible.
 POSIX-ly correct version is in /usr/xpg4/bin but I think it's easier
 to fix use of nl(1).

Hi.  I'd like to submit this slightly different patch that uses awk
instead of nl.  This is useful for example on OpenBSD, which doesn't have
nl in the base system.

Regards,
-- 
Jérémie Courrèges-Anglas
GPG Fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494



patch-src_mkbuiltins
Description: Binary data