From owner-freebsd-current@freebsd.org Thu Dec 1 18:56:00 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 608AFC619DF for ; Thu, 1 Dec 2016 18:56:00 +0000 (UTC) (envelope-from iblis@hs.ntnu.edu.tw) Received: from mail.hs.ntnu.edu.tw (mail.hs.ntnu.edu.tw [140.131.149.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06E751AD9; Thu, 1 Dec 2016 18:55:59 +0000 (UTC) (envelope-from iblis@hs.ntnu.edu.tw) Received: by mail.hs.ntnu.edu.tw (Postfix, from userid 800) id D0F0D1C6474; Fri, 2 Dec 2016 02:55:46 +0800 (CST) Received: from mail.hs.ntnu.edu.tw (localhost [127.0.0.1]) (Authenticated sender: iblis@hs.ntnu.edu.tw) by mail.hs.ntnu.edu.tw (Postfix) with ESMTPA id 9A2551C6450; Fri, 2 Dec 2016 02:55:46 +0800 (CST) Received: from 140-113-138-96.Dorm12.NCTU.edu.tw ([140.113.138.96]) by mail.hs.ntnu.edu.tw with HTTP (HTTP/1.1 POST); Fri, 02 Dec 2016 02:55:46 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 02 Dec 2016 02:55:46 +0800 From: Iblis Lin To: cem@freebsd.org Cc: FreeBSD Current Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken In-Reply-To: References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> Message-ID: User-Agent: HSNU Mail X-Bogosity: Ham, tests=bogofilter, spamicity=0.499958, version=1.2.4 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: Thu, 01 Dec 2016 18:56:00 -0000 Tnx a lot! The new `basename` works fine now. --- Iblis Lin Conrad Meyer 於 2016-12-02 01:30 寫到: > Hello Iblis, > > Please try reinstalling libcapsicum after r309366, rebuilding > basename, and then removing the stdout kludge from your shell script. > Let me know if there's still a problem! > > Thanks, > Conrad > > On Sun, Nov 27, 2016 at 11:08 PM, Conrad Meyer wrote: > Hi Iblis, > > Yes, I think caph_limit_stdio will break many similar programs in > similar use. I think we'll need to change that behavior. Something > like this: > > https://reviews.freebsd.org/D8657 > > Best, > Conrad > > On Sun, Nov 27, 2016 at 10:40 PM, iblis wrote: > Hi Conrad, > Thanks for your reply. > > I revert the basename.c and `< /dev/null` do the trick! > I'm also curious that will `caph_limit_stdio` break lots of program > work > with some shell scripts? > > -- > Iblis Lin > > On 11/28/2016 12:55, Conrad Meyer wrote: > Hi Iblis, > > I see no such problem running 'basename $HOME' in a normal shell > environment: > > $ 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="$(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`: > ``` > └─[iblis@abeing]% cat /home/ib-test/.zshenv > > function set_prompt { > prompt="$(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: > > ``` > └─[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 > changed > the `basename.c` and zsh work again. > > Index: basename.c > =================================================================== > --- basename.c (revision 309213) > +++ basename.c (working copy) > @@ -65,7 +65,7 @@ > > setlocale(LC_ALL, ""); > > - if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) > + if (cap_enter() < 0 && errno != ENOSYS) > err(1, "capsicum"); > > aflag = 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" _______________________________________________ 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"