Re: r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org" >>> >>> ___ >>> freebsd-current@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-current >>> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" >>> >> ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: r308432: Capsicumized `basename` make zsh prompt broken
On Mon, Nov 28, 2016 at 02:05:49AM -0500, Allan Jude wrote: > 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 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-unsubscr...@freebsd.org" > > ___ > > freebsd-current@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-current > > To unsubscribe, send any mail to "freebsd-current-unsubscr...@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. I mention this is the review of the cap_helpers themselves. I still think caph_limit_stdio should grow a flag for testing that. I figured out the issue based on one of the conversion to capsicum by Conrad on I don't remember which tool. Bapt signature.asc Description: PGP signature
Re: r308432: Capsicumized `basename` make zsh prompt broken
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 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-unsubscr...@freebsd.org" > ___ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscr...@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 signature.asc Description: OpenPGP digital signature
Re: r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org" >> >> ___ >> freebsd-current@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" >> > ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
r308432: Capsicumized `basename` make zsh prompt broken
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-unsubscr...@freebsd.org"