Date: Sun, 27 Nov 2016 23:08:35 -0800 From: Conrad Meyer <cem@freebsd.org> To: iblis <iblis@hs.ntnu.edu.tw> Cc: FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken Message-ID: <CAG6CVpWxqnWNcehPWo8N18ZwffDfptL%2BtnMBg9KR9mre4DCjtQ@mail.gmail.com> In-Reply-To: <e112d5d1-a64e-9647-8b1a-96461bf84d6f@hs.ntnu.edu.tw> References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> <CAG6CVpUbRq-%2BY8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com> <e112d5d1-a64e-9647-8b1a-96461bf84d6f@hs.ntnu.edu.tw>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <iblis@hs.ntnu.edu.tw> 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 wo= rk > 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=3D"$(basename $HOME < /dev/null) >" >> } >> >> And see if it resolves the issue? >> >> Thanks, >> Conrad >> >> On Sun, Nov 27, 2016 at 8:33 PM, iblis <iblis@hs.ntnu.edu.tw> 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 >>> changed >>> 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" >> >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.or= g" >> >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWxqnWNcehPWo8N18ZwffDfptL%2BtnMBg9KR9mre4DCjtQ>