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]:57183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfzjb-0002wx-PU for submit@debbugs.gnu.org; Mon, 10 May 2021 02:49:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:36340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfz2o-0001lb-M7 for submit@debbugs.gnu.org; Mon, 10 May 2021 02:05:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfz2o-00044x-Gr for bug-coreutils@gnu.org; Mon, 10 May 2021 02:05:30 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:40461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfz2m-0008HN-Q6 for bug-coreutils@gnu.org; Mon, 10 May 2021 02:05:30 -0400 Received: by mail-lf1-x133.google.com with SMTP id c3so21610155lfs.7 for ; Sun, 09 May 2021 23:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=1BrMyc+Z0qV14gFBpLTHo1tIinUIto/Wm8ppSvN/BRE=; b=O8sUgEvb7JZsYmtsTIhR6likYvNKnC7FgdOhdUGPvp0ujDxrD4yIipqMXtDtBcRxwo vStSdTHgSr0vWab5/gMThQ7+b35CQ2aX+O3d8QNFl5L0I18JN78h1fMQio8FM8knsYwG e9r8lRWJsuuJN7NWY3IZq3nBELriKUhoMhQJ90QhX/PUNjqLG4DlWiY1f+9XBIpnLuWd k75AUV/lXaxESDOkSMmjIlyBrD4vWvNAyMQw6izwRJB6hGRWE6P0Ot/ZvpU3a9gDZMc2 KCwEzI1H1Q9UHyBIx2GsDRVC/2XfVBXljW06FxkmVHtlG0m1aiec/dl99LWfBX0H4EfA KvEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1BrMyc+Z0qV14gFBpLTHo1tIinUIto/Wm8ppSvN/BRE=; b=S5secN34l+WFULrZJLUL8kxMqg7cV7fFWOLl+gkXkCAdsKryWfwDTC2D7YlOen/cAE r2v6wIdPypkjO0Et+0bn+Fb6nXobIBS1LS/gZJ/wtkl17Z0QjirQtydU5HtLmhlAZA7E krTGaw6yDAkgW8iMQxNUKZoszMIAWaTH523BL7tJ3ybUCDdeDjoncruR2ebRm6oWhixH jUwF1MJTm4il4mNSJZKTH2qmOVF44E/oaH12O/SNduNkfIlf1ikmqC8UUftuhFnwrJHq SWIWa9e52/f43qJFpuajOMefhjl5i5XtairvTof006coNzcPi133EqQMaTQjSE03e6HH Ld5A== X-Gm-Message-State: AOAM533zdpZDM5OsWo4vnxY4dII+7Eqhq2/XT+ycsVczRuug2ih5j0lk Mzp0XcaSeAfagaJzc0uzjpHVVhkuWqcx15lg4wCCjuYPrWg= X-Google-Smtp-Source: ABdhPJzGOdW8KuB9eQfYzMTl2g8zHdo61+EpToAXk66uIvg8+aFm0FGFOVLTszr4AyWP0XK3Jcy2ANhe5QrsHXMWdPw= X-Received: by 2002:ac2:428e:: with SMTP id m14mr15513563lfh.478.1620626726144; Sun, 09 May 2021 23:05:26 -0700 (PDT) MIME-Version: 1.0 From: Kurt von Laven Date: Sun, 9 May 2021 23:04:50 -0700 Message-ID: Subject: 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="000000000000534f5205c1f3902a" Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=kurt.von.laven@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_40=-0.001, 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 (--) --000000000000534f5205c1f3902a Content-Type: text/plain; charset="UTF-8" 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 , 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 --000000000000534f5205c1f3902a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

When the -r, --no-run-if-e= mpty option is combined with the -d, --delimiter or -0, --null options, the= -r, --no-run-if-empty option does not take=C2=A0effect. The manual describ= es 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.
xargs --no-run-if-empty -I str echo st= r <<< ""

The following comm= and incorrectly outputs 1 empty line.
xargs --no-run-if-empty --d= elimiter=3D"\n" -I str echo str <<< ""

The following command incorrectly outputs 2 empty lines.<= /div>
xargs --no-run-if-empty --null -I str echo str <<< "= ;"

As a workaround according to=C2=A0this Stack Overflow answe= r, the following commands output nothing when the input consists only o= f whitespace.
[[ $input =3D *[![:space:]]* ]] && xargs --= delimiter=3D"\n" -I str echo str <<< "$input"<= /div>[[ $input =3D *[![:space:]]* ]] || xargs --null -I str echo str <&l= t;< "$input"

Be well,
Kurt von Laven
--000000000000534f5205c1f3902a-- 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 Sat Jun 21 10:44:18 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