Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Stephane Chazelas Newsgroups: gnu.bash.bug Subject: Re: Incorrect option processing in builtin printf(1) Date: Mon, 22 Jul 2019 21:10:54 +0100 Lines: 28 Approved: bug-bash@gnu.org Message-ID: References: <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> <20190722201054.pintfyjl3fqq66wx@chaz.gmail.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1563826263 10401 209.51.188.17 (22 Jul 2019 20:11:03 GMT) X-Complaints-To: action@cs.stanford.edu Cc: kre@munnari.OZ.AU, bug-bash@gnu.org To: Eric Blake Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DxyOXYZ9ukN1WwECIqsrPYA7yELSUO/mGuhLdNz7ID0=; b=MLVJMcnRVzF8raMj82+I/RzZlpm4Nml1eZAUwWWbIS8lvr2MtMPqHcrr745UuGZxOA tRO97c5DfGveIaA+ydOXW1wPIuDuuPJFcn7/BAaEDGz/E2ue3gsGg5+BK3234ttmINPr uL82OfVbWwZH52xxnPK2u7KsMYo45mPoaIa7gTN+QgGqpiyC3nr1kUfrmP9voyS8JJD9 TAs7MaDGH3ErLqle54WdTpD1x5N45V/H40vX96ZpSfmxZJFmpc2VEKq3rHO+gUAYmkfe Tfh+8af6O+r7qNxM+6jnLuA90Db+KJJzYllwub14PgXgojjo8LwQJjZv3VBFEOEVdKzE ALEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DxyOXYZ9ukN1WwECIqsrPYA7yELSUO/mGuhLdNz7ID0=; b=nuvICtiuCDk+O8xYBnlUsoS77K6IupqaAQvkbhQ4p3INW/gGdiJCKUAU1bTUeTulxx LsfyKbOHg1NxfRPDXzDeBrPDpuDKq4wtjB65ksS/TwlJAk7Ur0+nRdeSjNvvE6G7XzEw ETAg2cmQYWZ4MFQwdcTgcTfJEBv5j4ktuHz3n2wWuKp3Z5fNrs97RhuIJmGCZkYvJ0E/ oiZqwbfKeF3BW6+Bx+wNgUi4DO1ut9kDpiQmzR7z8bIlJVb17d4USGrnq+I9gy1j2VXB 7eVhucRIyw+9HP7TzStjoA9ZQg+Yi+I650ObOo2Yn3UaZsb+BHDNYUmSEB5tB5sDVv5R hb3Q== X-Gm-Message-State: APjAAAW8yTPQ8Bb8rFXP3A1sD0KwV+B20+eFiyupVtrlZYAI6SxD1PTb dUs2aGrnUOFCEisSL6jrUzY= X-Google-Smtp-Source: APXvYqzViWxycKoKmtxVfbSlt3f3bCTCW1+qw9C6tb8BcIVgqbhxicBJv1r/uK6HkZEN17Wid5AhZA== X-Received: by 2002:a05:6000:4b:: with SMTP id k11mr73593350wrx.82.1563826256701; Mon, 22 Jul 2019 13:10:56 -0700 (PDT) Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190722201054.pintfyjl3fqq66wx@chaz.gmail.com> X-Mailman-Original-References: <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> Xref: csiph.com gnu.bash.bug:15203 2019-07-22 14:55:05 -0500, Eric Blake: [...] > > Even if POSIX didn't mandate > > > > printf -- -%s x > > > > to output -x, I'd say it would be a bug in the POSIX > > specification (it looks like it is). > > POSIX _does_ mandate 'printf -- -%s x' to output exactly '-x', by virtue > of the fact that it mandates all utilities (other than special builtins) > with the specification 'OPTIONS None.' to parse and ignore '--' as the > end of options, whether or not the utility takes options as an > extension. If NetBSD broke that behavior, that is a bug in NetBSD's > shell, not bash nor POSIX. [...] Yes, thanks for pointing to the right section. I wish POSIX made it clearer. Having it spread like that in different sections with no full linking within them is suboptimal. The special treatment of special builtins seems bogus to me as well (like the fact that it seems it makes : "$x" unspecified unless $x can be guaranteed not to start with -; the description of the colon utility with its "expands its arguments" is bogus anyway). -- Stephane