From owner-freebsd-current@freebsd.org Mon Nov 28 07:21:25 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81E36C5900D for ; Mon, 28 Nov 2016 07:21:25 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wj0-x233.google.com (mail-wj0-x233.google.com [IPv6:2a00:1450:400c:c01::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 220221C61; Mon, 28 Nov 2016 07:21:25 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wj0-x233.google.com with SMTP id v7so107294973wjy.2; Sun, 27 Nov 2016 23:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sQRiy94TGVUFSRErmGOhLMTadN9Jg9unSCSXKUEsghA=; b=DQYWm+VvWT1OHGSbXnRK9+bA8IXZE502lVbFmT1Z7zp0KoojTEE5vXt0NbYR3D/Dv2 37bxOEJH3hX57m4i5QPq8r2ICh29xLze8mMSH+XgKSCIETM94avzn8MNK5cam8uq7eN9 588w5KWhMnVyI7ZaN0mxVrnaGD00PKRpfxkhxe1rNwRxO3K5YuhOGw7oYgJL9+2vHkWi eymRplctwML0nH1axF4nD0bFC5XUTXz3hUMBcD3F5q3/n7PkdlQi7NPf6EsJqklNCk7e R6NP/VnYWZrzmTmAUHWrBIpO9+oDdRaROyvD70ix1qx8leO08zbxtpLoYzZzrt9Wcj68 sK8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=sQRiy94TGVUFSRErmGOhLMTadN9Jg9unSCSXKUEsghA=; b=fVBpABXZo6zMHhtQIk1MUfMUTSnu7uurLqmZVWeMbla0XtGvs7WYdfv6w/M1CXSaO1 iTZ9yxFfOThU8tE3pi3h70+2QGhYYzEoIOxvR0upEejFWtFY1G1QuIyYm0l7ywI2aUZv RtbVaR13KduWU/NP1zNQ+lvG/Mo57ruu4s+R4Iqi5bRIdBtrlT6h87d3SpE08K7i+nj5 s3+xIEmXdwSOhiM1L6HpaiYGxQ1/Y7TTjvxTaiXprGBO9r2GgnhwmYDC0qf4L5ccfZu/ yoX1tFzEsGvVFYRDeAb4+fWAMUkjXFBqET79tr7+8tuk9bXBbNfk2AGfOX/ozUFJhYF2 rkMA== X-Gm-Message-State: AKaTC02w9m2u37Ih6rpt6gbGQGD5uquD4/IBRaGas027xWYUIO5ICMZpMZxgBzx3cTNvLA== X-Received: by 10.194.146.228 with SMTP id tf4mr17462529wjb.183.1480317682857; Sun, 27 Nov 2016 23:21:22 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id t82sm27335969wmd.17.2016.11.27.23.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2016 23:21:21 -0800 (PST) Sender: Baptiste Daroussin Date: Mon, 28 Nov 2016 08:21:21 +0100 From: Baptiste Daroussin To: Allan Jude Cc: freebsd-current@freebsd.org Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken Message-ID: <20161128072121.aqxppnkkoakaex4l@ivaldir.etoilebsd.net> References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p6l6suqkeflbziyd" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161126 (1.7.1) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 07:21:25 -0000 --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 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--