From owner-freebsd-current@freebsd.org Thu Dec 1 17:30:34 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 518DBC6092B for ; Thu, 1 Dec 2016 17:30:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (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 1C70B19B8 for ; Thu, 1 Dec 2016 17:30:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id j65so435780532iof.0 for ; Thu, 01 Dec 2016 09:30:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=akRohK1LxhUyGmL80a++v4kd184UPypix+4KG5DEdZ0=; b=j4VgTadxrt9u/cn4xWl+rUKVIvauYpB01DBWcAhCA80DgKdIr5yHmjQjwzxqGv+T4Y fH/eUXBfB3BndK2f2/2Rh77kw/Ie+nCWthqTJ0hM7rmExiseMx4LY7VE5v9JQKAiNqSG oMnNE0ZSKxTfnDPKSFAFCafU+ZbnxOW8XpxpHNmADtiDtiIcArzMzfQ9SmkyC3CzEc5H 4cc37PM0VEpdtIEPdLNQ3doD39EeeTXkyCJrlL/MnV4r1djFTI2zkFo+5Rt7ayj8EwDJ cFL26PWnwbjOAtCi7BzknpQNP0puLttCYBp3qgqC8Bm82xu+TepVdu7ftFfn/y2cAG/V Vq5A== X-Gm-Message-State: AKaTC02xOifeB9Y1jSPCYwxNJwcMx+0oYkUppyQKonqctewBtEiRjzAb+3LFrHkH5AE3kw== X-Received: by 10.107.167.5 with SMTP id q5mr31143579ioe.75.1480613426936; Thu, 01 Dec 2016 09:30:26 -0800 (PST) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id a23sm4748666itb.11.2016.12.01.09.30.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 09:30:26 -0800 (PST) Received: by mail-io0-f174.google.com with SMTP id j65so435779971iof.0 for ; Thu, 01 Dec 2016 09:30:26 -0800 (PST) X-Received: by 10.107.140.65 with SMTP id o62mr33391395iod.17.1480613426515; Thu, 01 Dec 2016 09:30:26 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.15.203 with HTTP; Thu, 1 Dec 2016 09:30:26 -0800 (PST) In-Reply-To: References: <5874fe09-4261-5616-9c0a-a71581c4d548@hs.ntnu.edu.tw> From: Conrad Meyer Date: Thu, 1 Dec 2016 09:30:26 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: r308432: Capsicumized `basename` make zsh prompt broken To: iblis Cc: FreeBSD Current Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Thu, 01 Dec 2016 17:30:34 -0000 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 w= ork >> 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 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.o= rg" >>> >>