Date: Mon, 28 Nov 2016 08:21:21 +0100 From: Baptiste Daroussin <bapt@freebsd.org> To: Allan Jude <allanjude@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken Message-ID: <20161128072121.aqxppnkkoakaex4l@ivaldir.etoilebsd.net> In-Reply-To: <b830385e-5c47-cea2-9aa6-3f7f1182714c@freebsd.org> References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> <CAG6CVpUbRq-%2BY8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com> <b830385e-5c47-cea2-9aa6-3f7f1182714c@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--p6l6suqkeflbziyd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 28, 2016 at 02:05:49AM -0500, Allan Jude wrote: > On 2016-11-27 23:55, Conrad Meyer wrote: > > Hi Iblis, > >=20 > > I see no such problem running 'basename $HOME' in a normal shell enviro= nment: > >=20 > >> $ basename $HOME > >> cmeyer > >=20 > > I suppose in your use, perhaps stdin is already closed? I think this > > is a limitation of caph_limit_stdio() in general. > >=20 > > Can you try instead: > >=20 > > function set_prompt { > > prompt=3D"$(basename $HOME < /dev/null) >" > > } > >=20 > > And see if it resolves the issue? > >=20 > > Thanks, > > Conrad > >=20 > > 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 cha= nged > >> 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.o= rg" > >=20 >=20 > 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 iss= ue based on one of the conversion to capsicum by Conrad on I don't remember wh= ich tool. Bapt --p6l6suqkeflbziyd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlg72u0ACgkQY4mL3PG3 PlozixAA34m45hL7LH+Nmz6/Sp5Vuz8tvlPNZKendQVWHfwFa6thf0190zOB0ZPk vjBu3hrx6QuAblQE9UDdunFfITKwPc+Z9AIPfiXBN95DA/oaUtnQPkyzIIDChVzy 3U3Iw/67XhkpAeKR82+EQs58maArYWvCg0JLizR2Ej/YDn6R0NYWhGww/iD+k2nE CBL93aOyObsa6NcgFBoheo2ZrumrVktSBi7jFwSm1gp36l56lFuZ92J8dHdn3OeW XpMapx4GFAPGRMgFiwArOs+p7RQC7qVPVnUmQwHMEwjN+EVv5UrAJxei0i6g0dUZ jZng4pIDrBYcHZDBhg/QZQFSCdslkRQP/FoIKa7+kPJHQYC9R0AjnyfavW8PDkPf XI23a8j45BgAskAh9Eb/a1Qop2l1eDnr0de4GMTMOalYOMYOroNq72XkEwk2FQfu L7AT105Lgs3fUQ86O82rKpYkk4Fvghj8SkxYzDVeqahHAeUYkgGoEOBUv41aYrSb hFF+8toO+0rwBPNPMHadPCe/rxrO4AX9/Pd5iPFQppCOvUGG2EuNuyzqfS6FD1IF kn0LMD5cTcsqVLP4COHLQrlTGSyj97TrYtRbaRMREuEidhTxNn+Sb6//Nuj/0k+8 qaHMERL6oazL7ckan1g0buyhZva/V/UZPTzy9pnAhxK7ndOJcQM= =Ml+V -----END PGP SIGNATURE----- --p6l6suqkeflbziyd--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161128072121.aqxppnkkoakaex4l>