From owner-freebsd-current@freebsd.org Mon Nov 28 06:40:56 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 51A8DC582E2 for ; Mon, 28 Nov 2016 06:40:56 +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 1CFDD107D; Mon, 28 Nov 2016 06:40:55 +0000 (UTC) (envelope-from iblis@hs.ntnu.edu.tw) Received: by mail.hs.ntnu.edu.tw (Postfix, from userid 800) id 364F71C6450; Mon, 28 Nov 2016 14:40:46 +0800 (CST) Received: from [140.113.215.9] (IP-215-9.cs.nctu.edu.tw [140.113.215.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: iblis@hs.ntnu.edu.tw) by mail.hs.ntnu.edu.tw (Postfix) with ESMTPSA id 15B761C647B; Mon, 28 Nov 2016 14:40:46 +0800 (CST) Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken To: cem@freebsd.org References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> Cc: FreeBSD Current From: iblis Message-ID: Date: Mon, 28 Nov 2016 14:40:45 +0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.499948, 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: Mon, 28 Nov 2016 06:40:56 -0000 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" >