Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Nov 2016 02:05:49 -0500
From:      Allan Jude <allanjude@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Baptiste Daroussin <bapt@freebsd.org>
Subject:   Re: r308432: Capsicumized `basename` make zsh prompt broken
Message-ID:  <b830385e-5c47-cea2-9aa6-3f7f1182714c@freebsd.org>
In-Reply-To: <CAG6CVpUbRq-%2BY8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com>
References:  <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> <CAG6CVpUbRq-%2BY8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Wr5EnQSJdRkUlxwLM0rPagQEVdgPdDi0K
Content-Type: multipart/mixed; boundary="NMtugp0P3ek0nEiDHEHR4rrCTEitcPv8X";
 protected-headers="v1"
From: Allan Jude <allanjude@freebsd.org>
To: freebsd-current@freebsd.org
Cc: Baptiste Daroussin <bapt@freebsd.org>
Message-ID: <b830385e-5c47-cea2-9aa6-3f7f1182714c@freebsd.org>
Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken
References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw>
 <CAG6CVpUbRq-+Y8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com>
In-Reply-To: <CAG6CVpUbRq-+Y8akXRsKqt6NvWuoPJKnfCJ2dzK1cVRHxGc0Sw@mail.gmail.com>

--NMtugp0P3ek0nEiDHEHR4rrCTEitcPv8X
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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

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.

--=20
Allan Jude


--NMtugp0P3ek0nEiDHEHR4rrCTEitcPv8X--

--Wr5EnQSJdRkUlxwLM0rPagQEVdgPdDi0K
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (MingW32)

iQIcBAEBAgAGBQJYO9dRAAoJEBmVNT4SmAt+MaEP/1luhDEW5/SRh/4KIF1gtawi
eVS8UuSb9K3+jAlpboBOZNcRKnNaGXyfgBWcp+cLjt5jDCeCt1HL7UZDtNGSFOX0
xN2hvH3wGuy+81p1776kJ84cGKdsbMCWhuBrR+XZSQLwMhyI2/Z/VqqFSA/ss5SM
/KVVz9WGyrai7rmmUBbmejn1uZ2wgDpiv5Xiondg0NrI5pNQNimLuqzKvi59qMD1
ztO5i+v8/bmwgYStTPH/4tF6eaImohCamGeVHoNJ3/2Zdsv9748/YGc+q561by84
hlRZeSG3KGE0OwDOns4gDiClmX18rQg/2aNvGSmdLSY0Xf64IRtH7Bp2HSeUVjdq
cnw5WWAifPwEOwRPNdC0olttESRGNr2W8VJ2MCvKFzy0DhPRcZE560+YFc/72J8H
saQ3trssIS7iKkm79iVrJjlp9ChFkPBx8BDn/9fMnvcZWd4ewelxx/95fAN1hl3o
QOVO5Zm7ZX6I7iSHjVddEtm+lS+EsFrchNxcjUJ3tvzYMynpLt9QyAoEYGRiMJ8O
x4duS5l9cxVzTo1ipd5/1gsf4DDzCd0/O2pEm/PFNJvOLO2CC2IuF4KAXpzBdeQk
wi+pbbih3KIxilJ2IHRsbt7N8TkCnxEqxOpJYH4EUuiGbuiqy/q+t9frciwt8hW8
Owr6GZdqh67HmA6foi8S
=MzNS
-----END PGP SIGNATURE-----

--Wr5EnQSJdRkUlxwLM0rPagQEVdgPdDi0K--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b830385e-5c47-cea2-9aa6-3f7f1182714c>