Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: What makes %# tick?

Tim Haynes <zsh@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>  | zsh, sauce 12:15PM piglet/ # id
>  | uid=1000(piglet) gid=1000(piglet)
>  | groups=10(wheel),16(cron),18(audio),19(cdrom),250(portage),1000(piglet)
>  | zsh, sauce 12:15PM piglet/ # 
>                               ^oops.
> I'm running zsh-4.2.5 on an amd64 box (gentoo linux) and am rather attached
> to my %# prompt specifier.

The test of %# uses the function privasserted which is commented thus:

/* Check whether the shell is running with privileges in effect.  *
 * This is the case if EITHER the euid is zero, OR (if the system *
 * supports POSIX.1e (POSIX.6) capability sets) the process'      *
 * Effective or Inheritable capability sets are non-empty.        */

I'm not sure what this feature gains in practice but it's possible your
realtime module means that there is something in the capability sets and
the shell therefore thinks that you are an enchanced lifeform.

There is a workaround.  The shell allows you to test for a particular
effective UID, and in this case there's no funny business about capability
sets.  You can make this otherwise mimic the behaviour of "%#" by replacing
that with "%(#.#.%%)".

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

Messages sorted by: Reverse Date, Date, Thread, Author