From unknown Fri Jun 20 07:11:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#48330 <48330@debbugs.gnu.org> To: bug#48330 <48330@debbugs.gnu.org> Subject: Status: The xargs -r, --no-run-if-empty Option Is Ignored When a Delimiter Is Passed Reply-To: bug#48330 <48330@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:11:43 +0000 retitle 48330 The xargs -r, --no-run-if-empty Option Is Ignored When a Deli= miter Is Passed reassign 48330 coreutils submitter 48330 Kurt von Laven severity 48330 normal tag 48330 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Mon May 10 02:49:44 2021 Received: (at submit) by debbugs.gnu.org; 10 May 2021 06:49:44 +0000 Received: from localhost ([127.0.0.1]:57185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfzjc-0002wz-2m for submit@debbugs.gnu.org; Mon, 10 May 2021 02:49:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:39510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfz5C-0001pa-60 for submit@debbugs.gnu.org; Mon, 10 May 2021 02:07:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfz5C-0006Dl-1s for bug-coreutils@gnu.org; Mon, 10 May 2021 02:07:58 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:41551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfz5A-0001PY-E9 for bug-coreutils@gnu.org; Mon, 10 May 2021 02:07:57 -0400 Received: by mail-lj1-x22f.google.com with SMTP id a36so19316762ljq.8 for ; Sun, 09 May 2021 23:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ogMf5mkx/JAEykA3GREg9u2/9Fdy3fRExFhyW4/yiVg=; b=gv835zSaQ5cGdVyND9RaZAFuGt5iwIWgGkr1Q+B8w9uVj8T9iZBSRtpTC8xl8Y8PVt b0rmJzZJcztqCr1cn1QTJrJnV0VTyswmVVjESHfo3OH1E4vjbHed/4cOZ55PRlCKqg/M h4vq2Brv9oPTYCiZQnngbA3CY4k6S7Zm0y0hiwLyPxUamzNqr12V04tEx30JpUDkd5Ob 1cQqiV3EFscs9nXi4GfNB/Dfuw43dXLiedlIWGVcZpFfnRWDPh1pdUhiUg1l8CVgH2hT iGHucwrxHP7GwznCn0tgFnE81uDQJyxRpeIyg99Hv5YhDfaenKefNdV6R112ztOcowlq 10CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ogMf5mkx/JAEykA3GREg9u2/9Fdy3fRExFhyW4/yiVg=; b=OmairTwr1EsHsrzhGnyJT8BhBj1whC9mb1AYZSUa6hwplkCn95MPhKNFwCeRvKwemw 45nv2IYzaiwVNsU5CVGtLDFSALzngIlX/19khuHO+ayWTccoIgY3tR/s2DZCy6rjTHik YOitF0Geyb0g81g8RlS6zE3WkGhfil+4zzIBFRxqjCxRRqzIM9lVU5Oi+KVrZIoFNEPW YjrWtjSvVRmWCFPHl2KAsJ/w9kVvdJNZilwOZNUx1ZQN+hLrmFdvgvOG1+ETS/CnY5Au SJxFuyjn6Bn/uhoAVTFcBxnOfrFJ5bmlk0GrARlWpWj5HoO9n78rhR40ojVHZaIUUIbz LCBg== X-Gm-Message-State: AOAM532CTLq8IS5WiS4XvFATFQAkau3NWdJCitxI6Hd8TBIqECZN68iv WgFMf7zRpAIfdo1+t5tt4Ez+N7o+wuvM5RcoHpUg324Ipzo= X-Google-Smtp-Source: ABdhPJzulsrCN1dZup1RJMcit1JwtwTxyQAHnCjXWU5S1wPyS9leUXgyGiRPfEA21zFgMrZOWRLMmLP+2CEVySfv2IA= X-Received: by 2002:a2e:81c1:: with SMTP id s1mr18856375ljg.371.1620626874259; Sun, 09 May 2021 23:07:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Kurt von Laven Date: Sun, 9 May 2021 23:07:18 -0700 Message-ID: Subject: Re: The xargs -r, --no-run-if-empty Option Is Ignored When a Delimiter Is Passed To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="000000000000275b8305c1f3997e" Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=kurt.von.laven@gmail.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 10 May 2021 02:49:42 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000275b8305c1f3997e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable P.S. Apologies, the || in that last command should be a &&. Here is the corrected command: [[ $input =3D *[![:space:]]* ]] && xargs --null -I str echo str <<< "$input= " El dom, 9 may 2021 a las 23:04, Kurt von Laven () escribi=C3=B3: > Hello, > > When the -r, --no-run-if-empty option is combined with the -d, --delimite= r > 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 eve= n > 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=3D"\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 > , the following commands > output nothing when the input consists only of whitespace. > [[ $input =3D *[![:space:]]* ]] && xargs --delimiter=3D"\n" -I str echo s= tr > <<< "$input" > [[ $input =3D *[![:space:]]* ]] || xargs --null -I str echo str <<< "$inp= ut" > > Be well, > Kurt von Laven > --000000000000275b8305c1f3997e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
P.S. Apologies, the || in that last command should be a &a= mp;&. Here is the corrected command:

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

=
El dom, 9 = may 2021 a las 23:04, Kurt von Laven (<kurt.von.laven@gmail.com>) escribi=C3=B3:
Hello,

When the -r, --no-run-if-empty option is combined with th= e -d, --delimiter or -0, --null options, the -r, --no-run-if-empty option d= oes not take=C2=A0effect. 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.=C2=A0 Normally, the command is run = once even if there is no input.=C2=A0 This option is a GNU extension."=

The following command correctly outputs nothing.
<= div>xargs --no-run-if-empty -I str echo str <<< ""

The following command incorrectly outputs 1 empty l= ine.
xargs --no-run-if-empty --delimiter=3D"\n" -I str = echo str <<< ""

The following c= ommand incorrectly outputs 2 empty lines.
xargs --no-run-if-empty= --null -I str echo str <<< ""

= As a workaround according to=C2=A0this Stack Overflow answer, the follo= wing commands output nothing when the input consists only of whitespace.
[[ $input =3D *[![:space:]]* ]] && xargs --delimiter=3D&quo= t;\n" -I str echo str <<< "$input"
[[ $input = =3D *[![:space:]]* ]] || xargs --null -I str echo str <<< "$i= nput"

Be well,
Kurt von Laven
--000000000000275b8305c1f3997e-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 10 08:56:02 2021 Received: (at 48330) by debbugs.gnu.org; 10 May 2021 12:56:03 +0000 Received: from localhost ([127.0.0.1]:57691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg5S6-0002lQ-J9 for submit@debbugs.gnu.org; Mon, 10 May 2021 08:56:02 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:49259) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg5S4-0002kz-I9; Mon, 10 May 2021 08:56:01 -0400 Received: from [192.168.101.10] ([91.1.218.240]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MMY9X-1lz7rv2aaF-00JbgE; Mon, 10 May 2021 14:55:48 +0200 Subject: Re: bug#48330: The xargs -r, --no-run-if-empty Option Is Ignored When a Delimiter Is Passed To: Kurt von Laven , 48330@debbugs.gnu.org References: From: Bernhard Voelker Message-ID: Date: Mon, 10 May 2021 14:55:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:bfeslh2xfKOc02Fmeu/IyhczIQcizw+c2KQd/3/i9xSR5vW2QDa OOVWkSERTrWXP6nIBZEbFl/qlvBxiJICn5q4dz/7xm21Ws+EjA7Vi+4XNSOQ8/zAcazVcuQ L4ngIft+HAjNnOODb0aOhmefDpSIqq7yjjiMpukZArAttoWVGEHmCVp2kKo3+ey9RI5Tawy XHaKDK61KWztJ/YJsaE+A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9I2+a3oMbCw=:6jCiHYyOhCILHAUOKn1UwU jK+tP6kcPJY+pBA2gnhGv6nLRFkBvzp6PRXHqUJtW9R8CDk40KZqJ7psJZkRXqARSkEoYd/A3 Oz5FlGkz6kEyFn9Gn6TSJVRYx9Nkjhw2DxopR6Ypsj0e2d5LXGKwmN0TAZov6FS+QZf02YVNZ TMxzEZjDjeUshaNCxjvV4Abg31V+ia8CRat5htoiE7aZItU1wWvwFBzidPRIv9RmaWp8lCGWK qlHovo47swDJebe3AYm5Ei9FG5HHIhMokr//QLsNbq65NlKqaY8EeTpRRoqSi9ceRsYprandi 470A1EQ++Z7wMBxS4EPXVCmFAdsUhn4oDCVRDyU0frK4PPyI2VwPpKB40BhhPcpVXxYzIvBye y1o+4/KLzUZu0ETcQ4al/fXuV5hS6VIvn4IIXtysd/ycryRV4AjevKq1mQ1B1bUp7RR9iA0rs x2R9ZJyh7igt66VFUkVZohTWBap+aXIC2E68ewg1f7TagSVnXExJb3pQivRpoaQYIKe15wpPC +c1cCGIaaSYUc/ndDx3jrc= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 48330 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 . I'm therefore marking this as "not a bug" + "closed" in the coreutils bug tracker. Have a nice day, Berny From unknown Fri Jun 20 07:11:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 08 Jun 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 13 01:01:23 2022 Received: (at control) by debbugs.gnu.org; 13 Feb 2022 06:01:23 +0000 Received: from localhost ([127.0.0.1]:36142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJ7wp-0005Fc-KD for submit@debbugs.gnu.org; Sun, 13 Feb 2022 01:01:23 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJ7wn-0005FN-Af for control@debbugs.gnu.org; Sun, 13 Feb 2022 01:01:22 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DCD9F160068 for ; Sat, 12 Feb 2022 22:01:14 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xF6bKPoGFK5j for ; Sat, 12 Feb 2022 22:01:14 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4560D16007E for ; Sat, 12 Feb 2022 22:01:14 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iMJecILkD4sj for ; Sat, 12 Feb 2022 22:01:14 -0800 (PST) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1FA8B160068 for ; Sat, 12 Feb 2022 22:01:14 -0800 (PST) Message-ID: Date: Sat, 12 Feb 2022 22:01:13 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: control@debbugs.gnu.org From: Paul Eggert Subject: merge 48330 and 48329 Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) unarchive 48330 tags 48329 notabug close 48329 merge 48329 48330 From unknown Fri Jun 20 07:11:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 13 Mar 2022 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator