From owner-freebsd-current@freebsd.org Mon Nov 28 05:02:29 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E53CCC59575 for ; Mon, 28 Nov 2016 05:02:29 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B217B12C8 for ; Mon, 28 Nov 2016 05:02:29 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f172.google.com with SMTP id a124so211495149ioe.2 for ; Sun, 27 Nov 2016 21:02:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=+P+kbf5KyL+tlJIGic4MkLUz8nKZ4WqFyu39ewv/V+A=; b=bSpMb6jc4vu+MzTRvijIYJcGxoUROWToWmqd9rDn1laUvUwLTVQskZB/pHzgBca80a 0/cfbdc3UIpHxW/N85bRTDirY8zhQWi0xH727gWX7m5dz7vtXMz8N0MNf/wkh+4tRWq2 HuA+7VNbXeFkQnfepxN5PnckoU51AkUwKnYO9vLlOQ8ev9pHSRDCJ9Bu4XtNYCcKpNC1 Q1QCmpuoUSnpOwaH9QySfmAjhHSRbTRspnaXr57iq2/pZZl1mmTTLN4kGWgeXIM1OuFM zKm7/kcsB/oI3d9HaL+a92p0WhRq5wf+qUq+YCZ1Wa46MHpgxZwoeGcGOpVkPjUlBo+W GTPA== X-Gm-Message-State: AKaTC02KaQV6WmnmAqzZeDZVjsQVq04OuZuUa0hsdOCscfdAbnYjEhaex1mC77Qxy8Vypw== X-Received: by 10.36.25.211 with SMTP id b202mr16451669itb.77.1480308942831; Sun, 27 Nov 2016 20:55:42 -0800 (PST) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com. [209.85.223.177]) by smtp.gmail.com with ESMTPSA id v74sm19374993ioi.2.2016.11.27.20.55.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2016 20:55:42 -0800 (PST) Received: by mail-io0-f177.google.com with SMTP id m5so73480290ioe.3 for ; Sun, 27 Nov 2016 20:55:42 -0800 (PST) X-Received: by 10.36.7.71 with SMTP id f68mr13058262itf.104.1480308942411; Sun, 27 Nov 2016 20:55:42 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.109.68 with HTTP; Sun, 27 Nov 2016 20:55:42 -0800 (PST) In-Reply-To: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> From: Conrad Meyer Date: Sun, 27 Nov 2016 20:55:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken To: iblis Cc: FreeBSD Current Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 05:02:30 -0000 Hi Iblis, I see no such problem running 'basename $HOME' in a normal shell environmen= t: > $ basename $HOME > cmeyer I suppose in your use, perhaps stdin is already closed? I think this is a limitation of caph_limit_stdio() in general. Can you try instead: function set_prompt { prompt=3D"$(basename $HOME < /dev/null) >" } And see if it resolves the issue? Thanks, Conrad On Sun, Nov 27, 2016 at 8:33 PM, iblis wrote: > Hi, > Here is a minimal config of zsh prompt invoking `basename`: > ``` > =E2=94=94=E2=94=80[iblis@abeing]% cat /home/ib-test/.zshenv > > function set_prompt { > prompt=3D"$(basename $HOME) >" > } > > function zle-line-init zle-keymap-select { > set_prompt > zle reset-prompt > } > > zle -N zle-line-init > zle -N zle-keymap-select > > set_prompt > ``` > > and launching zsh will get something like this: > > ``` > =E2=94=94=E2=94=80[iblis@abeing]% sudo su ib-test > > ib-test >basename: capsicum: Bad file descriptor >> >>basename: capsicum: Bad file descriptor >> > ``` > > > To be honest, I have no idea about what casper/caspicum is. I just change= d > the `basename.c` and zsh work again. > > Index: basename.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- basename.c (revision 309213) > +++ basename.c (working copy) > @@ -65,7 +65,7 @@ > > setlocale(LC_ALL, ""); > > - if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno !=3D ENOSYS)) > + if (cap_enter() < 0 && errno !=3D ENOSYS) > err(1, "capsicum"); > > aflag =3D 0; > > > Any idea? > > -- > Iblis Lin > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= "