From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 25 04:46:40 2016 Received: (at submit) by debbugs.gnu.org; 25 Feb 2016 09:46:40 +0000 Received: from localhost ([127.0.0.1]:44791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYsVL-00024t-IB for submit@debbugs.gnu.org; Thu, 25 Feb 2016 04:46:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53098) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYqC8-0005NL-0m for submit@debbugs.gnu.org; Thu, 25 Feb 2016 02:18:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYqC1-0007SM-Jd for submit@debbugs.gnu.org; Thu, 25 Feb 2016 02:18:34 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYqC1-0007SH-G9 for submit@debbugs.gnu.org; Thu, 25 Feb 2016 02:18:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYqC0-000728-CX for bug-coreutils@gnu.org; Thu, 25 Feb 2016 02:18:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYqBx-0007Rz-6j for bug-coreutils@gnu.org; Thu, 25 Feb 2016 02:18:32 -0500 Received: from tnsrv138.dataport.de ([141.91.240.138]:45677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYqBw-0007Rs-T9 for bug-coreutils@gnu.org; Thu, 25 Feb 2016 02:18:29 -0500 Received: from mta002.stadt.hamburg.de (unknown [141.91.240.140]) by tnsrv138.dataport.de (Postfix) with ESMTP id 75C13102809E for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from mta001.stadt.hamburg.de (mta001.stadt.hamburg.de [10.72.21.76]) by mta002.stadt.hamburg.de (Postfix) with ESMTP id B13CF222F1A for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from D-SRV-XVS0041.fhhnet.stadt.hamburg.de (d-srv-xvs0041.fhhnet.stadt.hamburg.de [10.72.61.87]) by mta001.stadt.hamburg.de (Postfix) with ESMTP id 41566BC059 for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from D-SRV-XVS0041.fhhnet.stadt.hamburg.de (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73AA1205B3 for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from WEXCPPA001.fhhnet.stadt.hamburg.de (unknown [10.62.128.166]) by D-SRV-XVS0041.fhhnet.stadt.hamburg.de (Postfix) with ESMTP id 610F620592 for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from ccms-out-hh.lclmspa020.dpaorvv.de (10.62.124.10) by hubrz2.stadt.hamburg.de (10.62.128.166) with Microsoft SMTP Server id 14.3.224.2; Thu, 25 Feb 2016 08:18:25 +0100 Received: from ccms-out-sbr.lclmspa020.dpaorvv.de (lclmspa020.dpaorvv.de [10.62.124.10]) by ccms-out-hh.lclmspa020.dpaorvv.de (Postfix) with ESMTP id 41D947C035 for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from WCLMSPA008.dpaorvv.de (wclmspa008.dpaorvv.de [10.62.30.11]) by ccms-out-sbr.lclmspa020.dpaorvv.de (Postfix) with ESMTPS id 404066602A for ; Thu, 25 Feb 2016 08:18:25 +0100 (CET) Received: from WCLMSPA008.dpaorvv.de (10.62.30.11) by WCLMSPA008.dpaorvv.de (10.62.30.11) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Thu, 25 Feb 2016 08:18:25 +0100 Received: from WCLMSPA008.dpaorvv.de ([fe80::808c:7782:5cd3:b169]) by WCLMSPA008.dpaorvv.de ([fe80::808c:7782:5cd3:b169%24]) with mapi id 15.00.1130.005; Thu, 25 Feb 2016 08:18:24 +0100 From: "Billerbeck, Dirk" To: "bug-coreutils@gnu.org" Subject: bash printf and negative precision Thread-Topic: bash printf and negative precision Thread-Index: AdFvm5mJZwHrgHueSsaPTMFqE04EiQ== Date: Thu, 25 Feb 2016 07:18:24 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.62.143.162] Content-Type: multipart/alternative; boundary="_000_d7ced26b900a4442a4b41a0293b9c194WCLMSPA008dpaorvvde_" MIME-Version: 1.0 X-TM-AS-MML: disable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 25 Feb 2016 04:46:38 -0500 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: -5.0 (-----) --_000_d7ced26b900a4442a4b41a0293b9c194WCLMSPA008dpaorvvde_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, I don't know if it's really a bug, if I'm just mistaken or this is the righ= t address but I just want to give it a try. I'm using the following bash-builtin printf command: FUELLLAENGE=3D8 ; report=3D"REPIBZVAG" ; REPORTFUELLZEICHEN=3D"0" ; printf = '%.8s%*.*d\n' $report 0 $((FUELLLAENGE - ${#report} )) "$REPORTFUELLZEICHEN= " The maximum length of $report is 8 characters but I tested some possible e= rror situations so in this example it is 9 characters log. I would expect p= rintf to cut the $report from REPIBVZAG to REPIBZVA and to NOT print any ad= ditional trailing zeros because of the precision value of -1. But a trailin= g zero is printed (set -x output): + FUELLLAENGE=3D8 + report=3DREPIBZVAG + REPORTFUELLZEICHEN=3D0 + printf '%.8s%*.*d\n' REPIBZVAG 0 -1 0 REPIBZVA0 Is this really correct? Or shouldn't the negative precision be taken as zer= o and no character should be printed? The bash version is "GNU bash, version 3.2.51(1)-release (x86_64-suse-linux= -gnu)". I know it's an older version but I can't change it as there are cor= porate restrictions. The coreutil package is "coreutils-8.12-6.25.32.33.1". Best regards Dirk Billerbeck --_000_d7ced26b900a4442a4b41a0293b9c194WCLMSPA008dpaorvvde_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello,

 

I don’t know if it’= s really a bug, if I’m just mistaken or this is the right address but= I just want to give it a try.

 

I’m using the following b= ash-builtin printf command:

 

FUELLLAENGE=3D8 ; report=3D"REPIBZVAG&= quot; ; REPORTFUELLZEICHEN=3D"0" ; printf '%.8s%*.*d\n' $report 0= $((FUELLLAENGE - ${#report} )) "$REPORTFUELLZEICHEN"<= /span>

 

The maximum length of $report &= nbsp;is 8 characters but I tested some possible error situations so in this= example it is 9 characters log. I would expect printf to cut the $report f= rom REPIBVZAG to REPIBZVA and to NOT print any additional trailing zeros because of the precision value of -1. But a = trailing zero is printed (set –x output):

 

+ FUELLLAENGE=3D8

+ report=3DREPIBZVAG<= /p>

+ REPORTFUELLZEICHEN=3D0

+ printf '%.8s%*.*d\n' REPIBZVAG 0 -1 0=

REPIBZVA0

 

Is this really correct? Or shou= ldn’t the negative precision be taken as zero and no character should= be printed?

 

The bash version is “GNU = bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)”. I know it&#= 8217;s an older version but I can’t change it as there are corporate = restrictions. The coreutil package is “coreutils-8.12-6.25.32.33.1= 221;.

 

Best regards<= /p>

Dirk Billerbeck

--_000_d7ced26b900a4442a4b41a0293b9c194WCLMSPA008dpaorvvde_-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 25 11:55:49 2018 Received: (at 22803) by debbugs.gnu.org; 25 Oct 2018 15:55:49 +0000 Received: from localhost ([127.0.0.1]:42682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFhzB-0004IT-7i for submit@debbugs.gnu.org; Thu, 25 Oct 2018 11:55:49 -0400 Received: from mail-io1-f53.google.com ([209.85.166.53]:33417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFhz8-0004IA-Qv; Thu, 25 Oct 2018 11:55:47 -0400 Received: by mail-io1-f53.google.com with SMTP id l25-v6so5802094ioj.0; Thu, 25 Oct 2018 08:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WIPA5NJ93k/5C1Ty/5H06zXr855Ysoyh0Oqb3e3EBbM=; b=uSGRzxyEak0cJfLov9pwqreoJ+vQq7/rloDYTcekcXKj6f6UMVRiyxQT6Ko5+aMl17 9BIiSKG/9RK+LJNWzjL5B7dhQap2nyYH4pvTiqmQ/Yu1hBr6KzgK/vOCjziq0ObY9ZDT pgrmDnlhLYeftt6WJNQBDbDrlEqFkAdyt2YxaUkBOPDA35HfdTVTj7Wq3qk96OnYKDtV /JbtpF6TVa78In2Mv9mj3WXHH+SYY6jXy+Ftp59oCqJts87JB0LC8+GryHiqURBDhLDr 47MghmX6gCfstuoSm8V/FnXrTruYD/Pocvw/ypYn2FHe1FXdVrelT8Wc/wdYv4DsXS4m 0CPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WIPA5NJ93k/5C1Ty/5H06zXr855Ysoyh0Oqb3e3EBbM=; b=nV6hFK62R1IfJc+BYrE1mTOhovzeGabT3zwTEr9uZQyRMhmeSC1WRQAF470mZYSWas cKb1I0O900NfUj3Kd7B9tgO4jCN/pd73qRiL5g6G27uWwe5zXnPfUoIQrsvSyiwPGy5+ WrQo0Rjns8bLbaoinMcnzciE5R3rn0EGH7CgwGiyuFblM2ujjD8x5xsIQfDcs8O+kzZe wsF52M3HcIyT962bRGxpPkdmDgEb7MqrGbadAbqP/zr336rvDlLBKOfMd3L3BrNByJqt t3sMyXhKsen+KX3D4oe6UIyCoUSmnVA7ZEdERbcJV0aPU//OZSTS5lfUbS+6xVfbqee/ IwYA== X-Gm-Message-State: AGRZ1gJVzAzzKEPLKiARWCF0cVPOaWsyi/UaOtdFFlbuEAXKmQPNkZRB mxyYG8Mt+CcFlMXnP8cN6lU= X-Google-Smtp-Source: AJdET5dzsTB0TCUPKO+ZJQInBZOW5K+BTYyvRuNjmeSjqSgdofJ2BXv1j5RkMJZO/rnubGKAgyM/CA== X-Received: by 2002:a6b:6d05:: with SMTP id a5-v6mr1182325iod.27.1540482940951; Thu, 25 Oct 2018 08:55:40 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.gmail.com with ESMTPSA id c12-v6sm2881535ioq.81.2018.10.25.08.55.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 08:55:39 -0700 (PDT) Date: Thu, 25 Oct 2018 09:55:37 -0600 From: Assaf Gordon To: "Billerbeck, Dirk" Subject: Re: bug#22803: bash printf and negative precision Message-ID: <20181025155537.zqlld2erxs56alpg@tomato.housegordon.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 22803 Cc: 22803@debbugs.gnu.org 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 (-) tags 22803 notabug close 22803 stop (triaging old bugs) On Thu, Feb 25, 2016 at 07:18:24AM +0000, Billerbeck, Dirk wrote: > Hello, > > I don't know if it's really a bug, if I'm just mistaken or this is the right address but I just want to give it a try. > > I'm using the following bash-builtin printf command: > > [...] > > The bash version is "GNU bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)". I know it's an older version but I can't change it as there are corporate restrictions. The coreutil package is "coreutils-8.12-6.25.32.33.1". > It seems your message was lost and not replied to in 2 years. Sorry about that. Your question is about bash's "printf", so it should be sent to help-bash@gnu.org (or bug-bash@gnu.org if you suspect a bug). This mailing list is for GNU coreutils (which also provides a 'printf' program, but not bash's built-in one). As such, I'm closing this bug. -assaf From unknown Sun Sep 07 16:50:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 23 Nov 2018 12:24:03 +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