dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: Dimitar Yurukov <mscalindt@gmail.com>, dash@vger.kernel.org
Subject: Re: [PATCH] expand: Recognize '^' as a negation character in BE
Date: Fri, 16 Jul 2021 11:00:31 +0100	[thread overview]
Message-ID: <0c417093-cc75-7ac6-c2a8-6b46041168c8@gigawatt.nl> (raw)
In-Reply-To: <20210716094227.15177-1-mscalindt@gmail.com>

On 16/07/2021 10:42, Dimitar Yurukov wrote:
> While parsing bracket expression ('[...]'), DASH recognizes only '!' as
> a special character for negation/inversion, but POSIX specifies '^'.
> 
> The POSIX specification (2018 edition) states:
> 
>    ^ The <circumflex> shall signify a non-matching list expression when
>      it occurs first in a list, immediately following a
>      <left-square-bracket> (see RE Bracket Expression).

It also states:

   the <exclamation-mark> character ( '!' ) shall replace the 
<circumflex> character ( '^' ) in its role in a non-matching list in the 
regular expression notation

and

   A bracket expression starting with an unquoted <circumflex> character 
produces unspecified results.

See 2.13.1 Patterns Matching a Single Character.

So both the dash and the bash behaviour are permitted and this patch 
does not address a correctness issue. Scripts that rely on ^ for 
negation should be modified to use !.

The patch may still be worthwhile to increase compatibility, but in that 
case the same change also needs to be made to expmeta().

Cheers,
Harald van Dijk

  reply	other threads:[~2021-07-16 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  9:42 [PATCH] expand: Recognize '^' as a negation character in BE Dimitar Yurukov
2021-07-16 10:00 ` Harald van Dijk [this message]
2021-07-16 12:46   ` Dimitar Yurukov
2021-07-16 12:50 ` [PATCH v2] " Dimitar Yurukov
2021-07-19  5:13   ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c417093-cc75-7ac6-c2a8-6b46041168c8@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=dash@vger.kernel.org \
    --cc=mscalindt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).