Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Masatake YAMATO <yamato@redhat.com>
To: nabijaczleweli@nabijaczleweli.xyz
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] lsfd: error if extraneous argument given
Date: Fri, 17 Mar 2023 05:32:18 +0900 (JST)	[thread overview]
Message-ID: <20230317.053218.162189423146300973.yamato@redhat.com> (raw)
In-Reply-To: <20230316160859.zksrhccvnnslkgyd@tarta.nabijaczleweli.xyz>

From: наб <nabijaczleweli@nabijaczleweli.xyz>
Subject: [PATCH] lsfd: error if extraneous argument given
Date: Thu, 16 Mar 2023 17:08:59 +0100

> The manual and help string both spec lsfd [options];
> actually stick to that instead of ignoring subsequent arguments.
> 
> This is particularly a weird thing to allow given that lsof path
> is legal and does something (either same as
> lsfd -Q "MAJ:MIN == \"$(stat -c %Hd:%Ld path)\"" if it's a mountpoint or
> lsfd -Q "NAME ~= '$path'" (sans the regex and escaping) otherwise).
> 
> This mirrors ec96a89ed9551ffacfc58b3056c8070444e3a2f3 for largely the
> same reason.
> ---
>  misc-utils/lsfd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c
> index 27a0ada01..4b21bf6d2 100644
> --- a/misc-utils/lsfd.c
> +++ b/misc-utils/lsfd.c
> @@ -1943,6 +1943,8 @@ int main(int argc, char *argv[])
>  			errtryhelp(EXIT_FAILURE);
>  		}
>  	}
> +	if (argv[optind])
> +		errtryhelp(EXIT_FAILURE);
>  
>  #define INITIALIZE_COLUMNS(COLUMN_SPEC)				\
>  	for (i = 0; i < ARRAY_SIZE(COLUMN_SPEC); i++)	\
> -- 
> 2.30.2

Tested-by: Masatake YAMATO <yamato@redhat.com>


      reply	other threads:[~2023-03-16 20:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 16:08 [PATCH] lsfd: error if extraneous argument given наб
2023-03-16 20:32 ` Masatake YAMATO [this message]

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=20230317.053218.162189423146300973.yamato@redhat.com \
    --to=yamato@redhat.com \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    --cc=util-linux@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).