Linux Netfilter development
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de
Subject: Re: [PATCH nft,RFC] main: remove need to escape quotes
Date: Tue, 17 Dec 2019 01:42:57 +0100	[thread overview]
Message-ID: <20191217004257.GI14465@orbyte.nwl.cc> (raw)
In-Reply-To: <20191216214157.551511-1-pablo@netfilter.org>

Hi Pablo,

On Mon, Dec 16, 2019 at 10:41:57PM +0100, Pablo Neira Ayuso wrote:
> If argv[i] contains spaces, then restore the quotes on this string.
> 
> There is one exception though: in case that argc == 2, then assume the
> whole input is coming as a quoted string, eg. nft "add rule x ...;add ..."
> 
> This patch is adjusting a one test that uses quotes to skip escaping one
> semicolon from bash. Two more tests do not need them.

I appreciate your efforts at making my BUGS note obsolete. :)
In this case though, I wonder if this really fixes something: I use
quotes in only two cases:

A) When forced by the parser, e.g. with interface names.
B) To escape the curly braces (and any semi-colons inside) in chain or
   set definitions.

Unless I miss something, case (A) will still need escaped quotes since
interface names usually don't contain whitespace. In case (B), your
patch would typically bite me as I merely quote the braces, like so:

| # nft add chain inet t c '{ type filter hook input priority filter; policy drop; }'

Of course that's a matter of muscle memory, but IIUC, your fix won't
work if one wants to pass flags in addition to a quoted command. Or does
getopt mangle argc?

Cheers, Phil

  reply	other threads:[~2019-12-17  0:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 21:41 [PATCH nft,RFC] main: remove need to escape quotes Pablo Neira Ayuso
2019-12-17  0:42 ` Phil Sutter [this message]
2019-12-17 10:42   ` Pablo Neira Ayuso
2019-12-17 12:04     ` Phil Sutter

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=20191217004257.GI14465@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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