From owner-freebsd-current@freebsd.org Fri Jul 31 02:37:23 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E02F36E048 for ; Fri, 31 Jul 2020 02:37:23 +0000 (UTC) (envelope-from gavin.d.howard@gmail.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4BHrz71VGPz4G1w for ; Fri, 31 Jul 2020 02:37:23 +0000 (UTC) (envelope-from gavin.d.howard@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 318BB36E047; Fri, 31 Jul 2020 02:37:23 +0000 (UTC) Delivered-To: current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3151836E3DE for ; Fri, 31 Jul 2020 02:37:23 +0000 (UTC) (envelope-from gavin.d.howard@gmail.com) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BHrz65yWVz4G9V; Fri, 31 Jul 2020 02:37:22 +0000 (UTC) (envelope-from gavin.d.howard@gmail.com) Received: by mail-oi1-x244.google.com with SMTP id v13so8902324oiv.13; Thu, 30 Jul 2020 19:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=lR8+2b6UvWZLL8gT+qZiLCmTLlk2/Ca/d/9/uLzbZos=; b=aptyivp8hQy3CvLlmo9eWbU9ELwnqWXcSWiWSIlTrP2GoN0SkOCnCrNgvVpXB60Rt/ u/HowkN+n/WMORA/4D92nzPVecEJZv5GUDlbwTgWtJiTIf7XrOmuhPs42o4tgYvfD5bC oLOugUK7DANoI0O4JjdrKcr/xEpIiMp1cyaQY82TiBKrhjWlnta7d4OKQP8/tBJwx/fj pfCPGuTqCxeOAkFtki7/ike5UCc6KsMRqQ/CGsa0FBiYqNo+wl56iaU16p1kbcmhn4I1 sIx8BOf4sRTw5VtmDxqxKEfUkzmbM5b4qIncrvi0gCx/i1WJV5GXb+ztRYM2NSaqWS0v j1kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=lR8+2b6UvWZLL8gT+qZiLCmTLlk2/Ca/d/9/uLzbZos=; b=S0e5/91Wbso/2G3UTfpTMFcixzJmp1JrWYhhAIr2qJet8tp3CTGwfYncEQAsrgEadX Uhf97EqmEsclZq5yB7zrI7pBTaSrWPk1jYs2l3YOPKbU+MWbUy3DVwBeffgXREu5c5U2 5rIXYqZYKk7BYwD40+cQOEzfB/JrSHospo1OOw26y5CwgrAFcNJeiaHA92ipvb/Ttrph pHdQw4fZUpjXoERkxWRmGPCMuAqxMc+w8cn1jzbev7woIfGi2HrxW8VAPnsDRU+jJoTw aK3XQmN83w4K/ycok4AlinR30IOexPsbESQ0lDuDzuZ9T7V5CG8oOwOtvRVr/b37R1vG HzDg== X-Gm-Message-State: AOAM531HHCDsnS2CMvwptOcN1sPBijhHX8PosYkfGiYoB3ukxe9ANbOd sLOeKjxohBXYzdbdoF73mzBBFTxn+1WtINlyzQXe9w== X-Google-Smtp-Source: ABdhPJy1jUWKIbRq1E7f84m38YW4pankiBg31TLgnwV5NU/tV1rMXrekwNCHtk5IegxiHn9Wh4QGpvTT1EZgcL8vm4w= X-Received: by 2002:aca:cfd0:: with SMTP id f199mr1373217oig.102.1596163041319; Thu, 30 Jul 2020 19:37:21 -0700 (PDT) MIME-Version: 1.0 References: <80DA1DEF-E455-470B-B68A-BE992C46590E@freebsd.org> In-Reply-To: <80DA1DEF-E455-470B-B68A-BE992C46590E@freebsd.org> From: Gavin Howard Date: Thu, 30 Jul 2020 20:36:09 -0600 Message-ID: Subject: Re: bc and dc -e/-f and Copyright To: Jessica Clarke Cc: John Baldwin , bapt@freebsd.org, rpokala@freebsd.org, current@freebsd.org, Stefan Esser Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4BHrz65yWVz4G9V X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-Spam: Yes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 31 Jul 2020 02:37:23 -0000 On Thu, Jul 30, 2020 at 4:25 PM Jessica Clarke wrote: > > On 30 Jul 2020, at 23:21, Jessica Clarke wrote: > > On 30 Jul 2020, at 20:35, Gavin Howard wrote= : > >> > >> Hello, > >> > >> My name is Gavin Howard, and I am the developer and maintainer of the > >> new bc and dc implementation in -CURRENT. Stefan E=C3=9Fer brought a > >> discussion about my bc to my attention, and I would like to solve the > >> problems. > >> > >> First, I will add some way to remove the printing of the copyright > >> header at compile time, and FreeBSD should be able to take advantage > >> of it as soon as I put out a new release, which should be within days > >> after this discussion is settled. > >> > >> Second, there seems to be those who are unhappy with my decision to > >> make bc and dc not exit when using the -e and -f options. While the > >> behavior of my bc is what I personally need, I have a few options to > >> change it back to what is expected: > >> > >> 1. I could make it a compile-time selection. I don't like this option, > >> to be honest. > >> > >> 2. I could restore the expected behavior of -e and -f and change the > >> environment variable to BC_EXPR_NO_EXIT (DC_EXPR_NO_EXIT) and reverse > >> the logic. I could do this one, but Stefan mentioned to me that he > >> would prefer less environment variables be used. I agree. > >> > >> 3. I could restore the expected behavior of -e and -f and add -E and > >> -F options that do the same thing but do not exit. I think I like this > >> option the best. I am willing to change -E and -F to something else if > >> that would be better. > > > > Rather than introducing new options like any of these you could instead= : > > > > 4. Make sure -f - reads from stdin. Then just append -f - to your uses. > > > > 5. Overload -i when used with -e/-f to also make it not exit. > > > > I personally prefer 4 as it doesn't require any confusing overloading > > (-f - should read from stdin as a well-behaved Unix tool regardless in > > my opinion), but does come with the downside that you can't just: > > > > alias bc=3D'bc -f -' > > > > for your case, you'd have to instead: > > > > bc() { command bc "$@" -f - } > > > > or equivalent in your shell of choice. > > NB: 4 already works with GNU dc. FreeBSD's old dc requires you to do -f > /dev/stdin instead as it doesn't treat - as special but otherwise also > works. I haven't looked to see whether your dc regards - as stdin or > not, but -f /dev/stdin surely already works. So 4 seems the most > consistent and/or compatible option when considering other > implementations. > > Jess All, I have made the following changes: bc does not print a copyright header unless the version options (-v, -V, and --version) are given. The -q and --quiet options are no-ops, but are kept for compatibility with GNU bc. I have ensured that -f - works; it basically disables exiting after processing all expressions and files given with -e and -f. I have found a way to make this work for me personally. If there are no objections within 24 hours or so, I will release the changes as 3.1.4. Gavin Howard