r308432: Capsicumized `basename` make zsh prompt broken
Allan Jude
allanjude at freebsd.org
Mon Nov 28 07:12:11 UTC 2016
On 2016-11-27 23: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 <iblis at hs.ntnu.edu.tw> wrote:
>> Hi,
>> Here is a minimal config of zsh prompt invoking `basename`:
>> ```
>> └─[iblis at 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 at 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 at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
>
IIRC, bapt@ specifically mentioned this case in the review for
caph_limit_stdio() or one of the reviews that lead to the creation of
the helpers.
--
Allan Jude
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20161128/a44886dd/attachment.sig>
More information about the freebsd-current
mailing list