ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: [sisyphus] Re: zsh и wks26
Date: Tue, 17 May 2005 13:04:46 +0400
Message-ID: <20050517090446.GR3554@solemn.turbinal.org> (raw)
In-Reply-To: <20050429174842.GA8593@eugene-home.ikz.ru>

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

On Fri, Apr 29, 2005 at 11:48:43PM +0600, Eugene Vlasov wrote:
> eugene ~ # grep PROMPT .zshrc
> PROMPT='%n %4~ %(!.#.$) '
> 
> Раньше с такими настройками zsh отображал #, если работаешь из под
> root и $ в противном случае. А теперь все время показывает #. bash все
> показывает как надо. Можно конечно поменять PROMPT, но хотелось бы
> понять, в чем может быть дело.

$ info zsh 'Prompt Expansion'

%#
     A `#' if the shell is running with privileges, a `%' if not.
     Equivalent to `%(!.#.%%)'.  The definition of `privileged', for
     these purposes, is that either the effective user ID is zero, or,
     if POSIX.1e capabilities are supported, that at least one
     capability is raised in either the Effective or Inheritable
     capability vectors.

В prompt.c используется функция privasserted().

$ zsh-4.2.5/Src
$ sed -ne '/^privasserted/,/^}$/p' utils.c
privasserted(void)
{
    if(!geteuid())
        return 1;
#ifdef HAVE_CAP_GET_PROC
    {
        cap_t caps = cap_get_proc();
        if(caps) {
            /* POSIX doesn't define a way to test whether a capability set *
             * is empty or not.  Typical.  I hope this is conforming...    */
            cap_flag_value_t val;
            cap_value_t n;
            for(n = 0; !cap_get_flag(caps, n, CAP_EFFECTIVE, &val); n++)
                if(val) {
                    cap_free(caps);
                    return 1;
                }
            cap_free(caps);
        }
    }
#endif /* HAVE_CAP_GET_PROC */
    return 0;
}
$

Что не так с этим кодом?

> -- 
> С уважением, Евгений                          mailto:eugvv@altlinux.ru

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

  parent reply	other threads:[~2005-05-17  9:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-29 17:48 [sisyphus] " Eugene Vlasov
2005-04-29 18:31 ` [sisyphus] " Konstantin A. Lepikhov
2005-05-17  9:04 ` Alexey Tourbin [this message]
2005-05-17 10:44   ` Dmitry V. Levin
2005-05-17 10:56     ` Alexey Rusakov
2005-05-17 11:15       ` Alex Yustasov
2005-05-17 14:48         ` Alex Yustasov
2005-05-17 14:15       ` Alexey Tourbin
2005-05-17 15:03         ` Alexey Rusakov
2005-05-18 20:44         ` Konstantin A. Lepikhov

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=20050517090446.GR3554@solemn.turbinal.org \
    --to=at@altlinux.ru \
    --cc=sisyphus@altlinux.ru \
    /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

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git