GNU bug report logs - #48330
The xargs -r, --no-run-if-empty Option Is Ignored When a Delimiter Is Passed

Previous Next

Package: coreutils;

Reported by: Kurt von Laven <kurt.von.laven <at> gmail.com>

Date: Mon, 10 May 2021 06:50:03 UTC

Severity: normal

Tags: notabug

Merged with 48329

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48330 in the body.
You can then email your comments to 48330 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#48330; Package coreutils. (Mon, 10 May 2021 06:50:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kurt von Laven <kurt.von.laven <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 10 May 2021 06:50:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kurt von Laven <kurt.von.laven <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Re: The xargs -r, --no-run-if-empty Option Is Ignored When a
 Delimiter Is Passed
Date: Sun, 9 May 2021 23:07:18 -0700
[Message part 1 (text/plain, inline)]
P.S. Apologies, the || in that last command should be a &&. Here is the
corrected command:

[[ $input = *[![:space:]]* ]] && xargs --null -I str echo str <<< "$input"

El dom, 9 may 2021 a las 23:04, Kurt von Laven (<kurt.von.laven <at> gmail.com>)
escribió:

> Hello,
>
> When the -r, --no-run-if-empty option is combined with the -d, --delimiter
> or -0, --null options, the -r, --no-run-if-empty option does not
> take effect. The manual describes the intended behavior of the -r,
> --no-run-if-empty option: "If the standard input does not contain any
> nonblanks, do not run the command.  Normally, the command is run once even
> if there is no input.  This option is a GNU extension."
>
> The following command correctly outputs nothing.
> xargs --no-run-if-empty -I str echo str <<< ""
>
> The following command incorrectly outputs 1 empty line.
> xargs --no-run-if-empty --delimiter="\n" -I str echo str <<< ""
>
> The following command incorrectly outputs 2 empty lines.
> xargs --no-run-if-empty --null -I str echo str <<< ""
>
> As a workaround according to this Stack Overflow answer
> <https://stackoverflow.com/a/17287097/3866835>, the following commands
> output nothing when the input consists only of whitespace.
> [[ $input = *[![:space:]]* ]] && xargs --delimiter="\n" -I str echo str
> <<< "$input"
> [[ $input = *[![:space:]]* ]] || xargs --null -I str echo str <<< "$input"
>
> Be well,
> Kurt von Laven
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#48330; Package coreutils. (Mon, 10 May 2021 12:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 48330 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Kurt von Laven <kurt.von.laven <at> gmail.com>, 48330 <at> debbugs.gnu.org
Subject: Re: bug#48330: The xargs -r, --no-run-if-empty Option Is Ignored When
 a Delimiter Is Passed
Date: Mon, 10 May 2021 14:55:47 +0200
tag 48330 notabug
close 48330
stop

On 5/10/21 8:07 AM, Kurt von Laven wrote:
> [[ $input = *[![:space:]]* ]] && xargs --null -I str echo str <<< "$input"

You have reached the GNU coreutils mailing list, and 'xargs' is not part
of the coreutils [1].

[1] https://www.gnu.org/software/coreutils/

Instead, 'xargs' is part of the 'findutils' package, so you're better off asking
on their mailing list or bug tracker.

  $ xargs --help | tail -n4
  You can report (and track progress on fixing) bugs in the "xargs"
  program via the GNU findutils bug-reporting page at
  https://savannah.gnu.org/bugs/?group=findutils or, if
  you have no web access, by sending email to <bug-findutils <at> gnu.org>.

I'm therefore marking this as "not a bug" + "closed" in the coreutils bug tracker.

Have a nice day,
Berny





Added tag(s) notabug. Request was from Bernhard Voelker <mail <at> bernhard-voelker.de> to control <at> debbugs.gnu.org. (Mon, 10 May 2021 12:57:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 48330 <at> debbugs.gnu.org and Kurt von Laven <kurt.von.laven <at> gmail.com> Request was from Bernhard Voelker <mail <at> bernhard-voelker.de> to control <at> debbugs.gnu.org. (Mon, 10 May 2021 12:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 08 Jun 2021 11:24:05 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sun, 13 Feb 2022 06:02:01 GMT) Full text and rfc822 format available.

Merged 48329 48330. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sun, 13 Feb 2022 06:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Mar 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 45 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.