From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 24 13:22:18 2016 Received: (at submit) by debbugs.gnu.org; 24 Mar 2016 17:22:18 +0000 Received: from localhost ([127.0.0.1]:36424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj8xe-0003kO-1m for submit@debbugs.gnu.org; Thu, 24 Mar 2016 13:22:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj7Bs-0005sk-1b for submit@debbugs.gnu.org; Thu, 24 Mar 2016 11:28:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj7Bm-0006IR-5M for submit@debbugs.gnu.org; Thu, 24 Mar 2016 11:28:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID,XPRIO autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7Bm-0006IN-2x for submit@debbugs.gnu.org; Thu, 24 Mar 2016 11:28:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7Bl-0005hV-Ao for bug-coreutils@gnu.org; Thu, 24 Mar 2016 11:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj7Bg-0006E6-6Q for bug-coreutils@gnu.org; Thu, 24 Mar 2016 11:28:45 -0400 Received: from f347.i.mail.ru ([217.69.140.243]:45373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7Bf-0006D7-Eh for bug-coreutils@gnu.org; Thu, 24 Mar 2016 11:28:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Type:Message-ID:Reply-To:Date:MIME-Version:Subject:To:From; bh=cJVJUYEoAxPG7rIKfI6kkqcbOVBX8puTDeeIAEArxik=; b=hQ4OBq6gmOfFO5prJi3mzwdTbeJOTcpnDctOjZYOFO0pQuXOiAAkXkqwitp7LqwOBAe8sAi89SwB1lXacSzlkbgwjr0H6VwkKLcrEePZvdqGtaNlHX3GjIku+sO6eN5kfluKsJlyhHGAWdyVd1ODA5sONsezxgmCoWo9oOoo3lo=; Received: from [85.143.114.220] (ident=mail) by f347.i.mail.ru with local (envelope-from ) id 1aj7BY-0001Ht-4e for bug-coreutils@gnu.org; Thu, 24 Mar 2016 18:28:32 +0300 Received: from [85.143.114.220] by e.mail.ru with HTTP; Thu, 24 Mar 2016 18:28:32 +0300 From: =?UTF-8?B?0JzQsNGA0LXQvdC60L7QsiDQldCy0LPQtdC90LjQuQ==?= To: bug-coreutils@gnu.org Subject: =?UTF-8?B?c2VxIGFwcGFyZW50IGJ1Zw==?= MIME-Version: 1.0 X-Mailer: Mail.Ru Mailer 1.0 X-Originating-IP: [85.143.114.220] Date: Thu, 24 Mar 2016 18:28:32 +0300 X-Priority: 3 (Normal) Message-ID: <1458833312.301435744@f347.i.mail.ru> Content-Type: multipart/alternative; boundary="--ALT--1GoR1nQTBrsplyuz0yhMobXgKtzcMbh31458833312" X-Mras: Ok X-Spam: undefined 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: -2.0 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 24 Mar 2016 13:22:17 -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: , Reply-To: =?UTF-8?B?0JzQsNGA0LXQvdC60L7QsiDQldCy0LPQtdC90LjQuQ==?= Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) ----ALT--1GoR1nQTBrsplyuz0yhMobXgKtzcMbh31458833312 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 IERlYXIgYWxsLAoKSSBoYXZlIHJlY2VudGx5IG5vdGljZWQgYW4gYXBwYXJlbnQgYnVnIGluICdz ZXEnLiBJZiBvbmUgcnVucwpzZXEgLXcgMiAxIDEwCmV2ZXJ5dGhpbmcgd29ya3MgZmluZS4KQnV0 IApzZXEgLXcgMiAwIDEwCmZhbGxzIGludG8gZW5kbGVzcyBsb29wIC4uLgoKQmVzdCByZWdhcmRz CkV2Z2VueQoKCgo= ----ALT--1GoR1nQTBrsplyuz0yhMobXgKtzcMbh31458833312 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 CjxIVE1MPjxCT0RZPkRlYXIgYWxsLDxicj48YnI+SSBoYXZlIHJlY2VudGx5IG5vdGljZWQgYW4g YXBwYXJlbnQgYnVnIGluICdzZXEnLiBJZiBvbmUgcnVuczxicj5zZXEgLXcgMiAxIDEwPGJyPmV2 ZXJ5dGhpbmcgd29ya3MgZmluZS48YnI+QnV0IDxicj5zZXEgLXcgMiAwIDEwPGJyPmZhbGxzIGlu dG8gZW5kbGVzcyBsb29wIC4uLjxicj48YnI+QmVzdCByZWdhcmRzPGJyPkV2Z2VueTxicj48YnI+ PGJyPjxicj48L0JPRFk+PC9IVE1MPgo= ----ALT--1GoR1nQTBrsplyuz0yhMobXgKtzcMbh31458833312-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 24 13:44:12 2016 Received: (at 23110) by debbugs.gnu.org; 24 Mar 2016 17:44:12 +0000 Received: from localhost ([127.0.0.1]:36434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj9Iq-0005va-55 for submit@debbugs.gnu.org; Thu, 24 Mar 2016 13:44:12 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:63001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj9Ip-0005vM-8W for 23110@debbugs.gnu.org; Thu, 24 Mar 2016 13:44:11 -0400 Received: from [192.168.101.10] ([217.86.86.16]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0M3C4d-1ZsHCM0nSx-00swxp; Thu, 24 Mar 2016 18:44:05 +0100 Subject: Re: bug#23110: seq apparent bug To: =?UTF-8?B?0JzQsNGA0LXQvdC60L7QsiDQldCy0LPQtdC90LjQuQ==?= , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> From: Bernhard Voelker Message-ID: <56F42764.5010908@bernhard-voelker.de> Date: Thu, 24 Mar 2016 18:44:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1458833312.301435744@f347.i.mail.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:+MxjyKa7lZ8OHv2sd5t94yWegithIVvGgUYxafJuKC7wVBoqFpC CWxlcey02MhVRPB/PnE0VYqGZ3hU2n71xDvsc+sYj8BR5FBZFQajtgf7DMZV9hzVzz+UD1c bDY7CW14QKMiwp+u0/Wskn1XtX5z1LiS3FAWjkDaKQoGrRknnSWH2/IqsZjR2wQHPY3XFj0 +2tNCSB5+MViksi+OGOJg== X-UI-Out-Filterresults: notjunk:1;V01:K0:ZWgsXcTMc8o=:eInmCKzNcEBueDRNi61y8O EpyasixzgdP7i3VORJ2jB704owXNYCRi6xZkrsl2iGGUzv9iAg22qnd2gsBTpjpd/gC74dBhw IT5R9iZDxxp3eAizJyzqbyN1qqDY4wtje8AiWPpbg616+z8EOm8hslJc0aVluRfKm2p+aZFef H6zuH/p5yj++oaPv+oiWYmrEdfTU1AReo7ruFYgAgzvx5xnitg5s9ht89fo0NjfGDF6Dc+jAL N0ReuEw7bq/Lu5FwWQ6BLnpusJyWNAxCahaPoby4TG7hWUEhxlabeOXnsyBHpH2zMRCJkuZlU X2w04tMP90xjB8bvH2Sy7yd9XCNi9Wxwn8V9BAzJUiloCgaa4hC1OFwNjwNdgCt/QjbfJ7BX1 LYNGKvFOhzNpEYFgJjcrSfpB4AThIxcWY+WicoRm89DmWbJw62abuUST2HzoCeWpFzyU6AtE5 +aYhWLtykXzktERytSKr/SeOEmE2bVMUxCQGkEcaAOKL/uKhnPX9+QUCZkxZ109rkUXUT10M1 nDQTvMIeXtglzNiilJsCL0YuQRvQhNGdVakbRo0yc2yq8YgF6gpviwZeuTePtx/wL9lPm/JD0 mZp6eIsBK72zw59ffYG9wBBHevzTzE6/CFVQS4/zYiy2JXhgD6+NBJS8OMYETGoQQiDqGVj1v Z9V8Z+RhYwHQqpMUoEHOMeGmHLllnuCrI38AXY/bxWYvQrME7JMfdLNeCdUw74XYHp/uuTJCm eXgYArcuhdqHeqHp X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: -0.7 (/) On 03/24/2016 04:28 PM, Маренков Евгений wrote: > I have recently noticed an apparent bug in 'seq'. If one runs > seq -w 2 1 10 > everything works fine. > But > seq -w 2 0 10 > falls into endless loop ... Thanks for the report. However, I don't think this is a bug but more a misunderstanding on your side how seq works. It's clearly documented that the second number (if 3 are given) is the increment. As you passed 0 as value, the target 10 is never reached, and therefore seq continues to produce output. Thus, it exactly does what you told it to do. What else would you expect? Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 24 15:11:50 2016 Received: (at 23110) by debbugs.gnu.org; 24 Mar 2016 19:11:50 +0000 Received: from localhost ([127.0.0.1]:36468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajAfe-0008Dt-5j for submit@debbugs.gnu.org; Thu, 24 Mar 2016 15:11:50 -0400 Received: from nm2-vm1.bullet.mail.bf1.yahoo.com ([98.139.213.158]:39055) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajAfd-0008Dh-6S for 23110@debbugs.gnu.org; Thu, 24 Mar 2016 15:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1458846702; bh=4RTdKWh6DU7RrMY5dCFKn0l1S1mhcamWoh5viA5aCLo=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=qwcmcAMvwffJQimwNcxZdeM+Z29rrvKf2ftrYc6/YpIS7dBbC04bc4SD7ILVBMJJD8RCLpwKS+GR/wMSZ02YgZxshHDlwjsl5qVXDwy/xfxlgatSO3Skr2NbjHK5GacRchtu2QV7mpdh588lUevZn1Cj1jvVAocj8f34qDs6po3eehUY/iyPk14prcbxgffZypdz1/pIgpwhtT0VYhDHwNiCh7BVT1OV7SRamt5HsgW+yMJ+nCKHEtQHKRTEedmslHHpXISE+g110QSjVnCo3/LuV7UsYXl4I1F/NRYke4BXw5AIjZedbw2+9GIrZDjVGuzrt22NXTo6qzVe2POCQA== Received: from [98.139.215.143] by nm2.bullet.mail.bf1.yahoo.com with NNFMP; 24 Mar 2016 19:11:42 -0000 Received: from [98.139.212.197] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 24 Mar 2016 19:11:42 -0000 Received: from [127.0.0.1] by omp1006.mail.bf1.yahoo.com with NNFMP; 24 Mar 2016 19:11:42 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 809393.46409.bm@omp1006.mail.bf1.yahoo.com X-YMail-OSG: 3NT6qP4VM1m2cpPWXtzhA5xCcwQNPeeo3.ItjMsbCjezBQWozxld6hziAR.7PBy ssUPbpe5J_XVhpogi7RJnCyNBMTquGPgjVz.Gysp7hlE4mHf9kJg4NR.n8Ctf9n1NqpNBaLCdjkx HkWh.5CGjFiYYRv0SeMlcVNnSNdaAtlz5sBLbRoP9Z4Y95nAJR9L3QJJE0YpNvijbqd17XRfKaSx gl8xHPGcwO5JNsrff9OJlX60H4e.xmlRixh5IBGjHOurju_J6IfLoNqvIj_OXRhgTQXIKya.1NgN s7wED543LfJHLEeqb60CAtRRlDNA4uDr7njgNkjI5V2.N5Ws5N1OVq7mM7y3Ys5RnnFWLazr8RyS RwrjD2YrgxQYlxT4aYLeU3..OsQV9yNAZHThJKxfiVq4f5XY8PhR0AfI6xMzPRZzlnF2YFMg0LUP 03VogY2i09XelHFuzp9Ul8RxKAC7YdCIW2a3p.2jj5rrJw7KGmnQq4pE_FdcHv5kp07H090QONvv zzx63oJYOuVxLVONd1ftbgIm_TzZp_RsrMZ4.hw-- Received: by 66.196.81.107; Thu, 24 Mar 2016 19:11:42 +0000 Date: Thu, 24 Mar 2016 19:11:39 +0000 (UTC) From: Leslie S Satenstein To: Bernhard Voelker , =?UTF-8?B?0JzQsNGA0LXQvdC60L7QsiDQldCy0LPQtdC90LjQuQ==?= , "23110@debbugs.gnu.org" <23110@debbugs.gnu.org> Message-ID: <554095301.4784507.1458846699363.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <56F42764.5010908@bernhard-voelker.de> References: <56F42764.5010908@bernhard-voelker.de> Subject: Re: bug#23110: seq apparent bug MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4784506_1825759400.1458846699358" Content-Length: 5938 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: , Reply-To: Leslie S Satenstein Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) ------=_Part_4784506_1825759400.1458846699358 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Should not an increment of zero be flagged as an error, and not ignored? =C2=A0Regards=20 =C2=A0Leslie Mr. Leslie Satenstein Montr=C3=A9al Qu=C3=A9bec, Canada From: Bernhard Voelker To: =D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2 =D0=95=D0=B2=D0=B3=D0= =B5=D0=BD=D0=B8=D0=B9 ; 23110@debbugs.gnu.org=20 Sent: Thursday, March 24, 2016 1:44 PM Subject: bug#23110: seq apparent bug =20 On 03/24/2016 04:28 PM, =D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2 = =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 wrote: > I have recently noticed an apparent bug in 'seq'. If one runs > seq -w 2 1 10 > everything works fine. > But=20 > seq -w 2 0 10 > falls into endless loop ... Thanks for the report. However, I don't think this is a bug but more a misunderstanding on your side how seq works.=C2=A0 It's clearly documented that the second number (if 3 are given) is the increment.=C2=A0 As you passed 0 as value, the target 10 is never reached, and therefore seq continues to produce output.=C2=A0 Thus, it exactly does what you told it to do.=C2=A0 What else would you expect? Have a nice day, Berny ------=_Part_4784506_1825759400.1458846699358 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Should not an increm= ent of zero be flagged as an error, and not ignored?
 
Regards

 Leslie
Mr. Le= slie Satenstein
Montr=C3=A9al Qu=C3=A9bec, Canad= a

=


=

From:= Bernhard Voelker <mail@bernhard-voelker.de>
To: =D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA= =D0=BE=D0=B2 =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 <hotpil@mail.ru&= gt;; 23110@debbugs.gnu.org
Sent:= Thursday, March 24, 2016 1:44 PM
Subject: bug#23110: seq apparent bug

On 03/24/2016 04:28 PM, =D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE= =D0=B2 =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 wrote:

> I have recently noticed= an apparent bug in 'seq'. If one runs
> seq -w 2 1 10=
> everything works fine.
> But <= br clear=3D"none">> seq -w 2 0 10
> falls into endl= ess loop ...


Thanks for the repo= rt.
However, I don't think this is a bug but more a misun= derstanding
on your side how seq works.  It's clearl= y documented that the
second number (if 3 are given) is t= he increment.  As you passed
0 as value, the target = 10 is never reached, and therefore seq
continues to produ= ce output.  Thus, it exactly does what you
told it t= o do.  What else would you expect?

Have a nice day,
Berny





------=_Part_4784506_1825759400.1458846699358-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 06 14:19:55 2016 Received: (at submit) by debbugs.gnu.org; 6 Apr 2016 18:19:55 +0000 Received: from localhost ([127.0.0.1]:52061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ans3X-00072U-6J for submit@debbugs.gnu.org; Wed, 06 Apr 2016 14:19:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ans3V-00072I-Qx for submit@debbugs.gnu.org; Wed, 06 Apr 2016 14:19:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ans3P-0004Kc-RV for submit@debbugs.gnu.org; Wed, 06 Apr 2016 14:19:48 -0400 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,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ans3P-0004KY-O9 for submit@debbugs.gnu.org; Wed, 06 Apr 2016 14:19:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ans3O-0007ax-FV for bug-coreutils@gnu.org; Wed, 06 Apr 2016 14:19:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ans3J-0004JC-MG for bug-coreutils@gnu.org; Wed, 06 Apr 2016 14:19:46 -0400 Received: from mout.gmx.net ([212.227.15.18]:63703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ans3J-0004J0-Ct for bug-coreutils@gnu.org; Wed, 06 Apr 2016 14:19:41 -0400 Received: from zappa.ga.local ([82.139.197.16]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LyVIk-1brPBi2DeY-015tM3; Wed, 06 Apr 2016 20:19:32 +0200 From: Ruediger Meier To: bug-coreutils@gnu.org Subject: Re: bug#23110: seq apparent bug Date: Wed, 6 Apr 2016 19:19:27 +0100 User-Agent: KMail/1.9.10 References: <1458833312.301435744@f347.i.mail.ru> <56F42764.5010908@bernhard-voelker.de> In-Reply-To: <56F42764.5010908@bernhard-voelker.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201604062019.29435.sweet_f_a@gmx.de> X-Provags-ID: V03:K0:LzVewlx11NeNyYHq5w49p4SRB3TysOBr222wFREPT186oWQ72SP +WyCu+iBu+U3fdgo1OODNXZCQ2NWLqvCRZvWL1OVFaMdVj5payfNCU+BqcfeERCp+J8zGAd krJZ/E2bZHSzAImE18Khb4NYsTN6rbn7tgwWBz62JuqU+1k0cRIOp5W/07h4LUir1LJv1+h ynBwJNHppNzETi6LiFXsQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:niUK4teS4HY=:xX2mj5ArT+r4uFfLmGX0YU whZnKghFvraAq3R1lWgKJQgREcXkHyEJ9IF7oZ4VEFxFVjkAy18KW5baYM+LmTQfVnIRx1Oxh ZrP6h2uT1U+VL8pvKpzpTnvl5WiWjqN8j35jvs4cBSJM9ukC0cAEyvMoQlcOHIofqtTNh23Ak EwlHP9ajKX1/6VOyC30zxl6tGp75KTcbLyRK3z+PG11kNBc8IrWHPE+p/jyML6j7l1HLbch2Y njkUKmov/+aTmjH5kA1v8B05aPIli5ApT3OYp1Zkzs3O/LC7O4ox3JwpJSWNW1mjU+rTD2Ogd /ErD7/qtn7KkDrviiiqwU/Sg2ncLyYVCEtThWXPfR1orgI7h708CmS6tCMoPY8Tbk5MwBJJJ1 mGrLyMcZifPPj5dOcWgsl6TkrC5/vig6Gts9upZnM+U9ogebtyCq/FHBXK2epBbYgp46d5Rej Ya5m2UeG31FVxqZLAx4DBqYwZa7UJO+9eF9RESG4k8MtUKZJIWWV4vWcD9sEFP2C8BrORSY7W dLNCVcW8Pq6cl7vQYcFXsaDRlVAQafz9jnDKxt8WAUgJI5vqbo3vbUORyZY2+OuxLki+3W0x5 3BvJEtLyrY4wh0n2936oaRkPSh3ln7YsODaQ66CDSocJTuYepqKk109Rl4O0MEAhNWFUhC+mJ 4XeyUAHVP3LP/5Q3HDnIxZFTZuehPZQ+oSmGHppsNPPVVHSTvqMCE/vIaHXlWcBRU9vd8JABp LXrhD2ZD+D3opfJlxs0gy/JUZQESdeEzUQxShGRvFB7mzn3bLQeg1tbEBns= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit Cc: Bernhard Voelker , =?utf-8?q?=D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2?= =?utf-8?q?_=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= , 23110@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: -4.1 (----) On Thursday 24 March 2016, Bernhard Voelker wrote: > On 03/24/2016 04:28 PM, =D0=9C=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2 = =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 wrote: > > I have recently noticed an apparent bug in 'seq'. If one runs > > seq -w 2 1 10 > > everything works fine. > > But > > seq -w 2 0 10 > > falls into endless loop ... > > Thanks for the report. > However, I don't think this is a bug but more a misunderstanding > on your side how seq works. It's clearly documented that the > second number (if 3 are given) is the increment. As you passed > 0 as value, the target 10 is never reached, and therefore seq > continues to produce output. Thus, it exactly does what you > told it to do. What else would you expect? This sounds all true, however then these one should also run forever: $ seq 10 0 2 Man page says: INCREMENT is usually positive if FIRST is smaller than LAST, and INCREMENT is usually negative if FIRST is greater than LAST. This implicates IMO that seq should try to count _down_ if FIRST > LAST=20 and INCREMENT=3D0 Moreover I'd say this one does not need to loop endless: $ seq 0 0 0 BTW maybe it would be an improvement to handle epsilon related endless=20 loops like this $ seq 1 0.00000000000000000000000000000001 2 cu, Rudi From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 07 05:02:13 2016 Received: (at 23110) by debbugs.gnu.org; 7 Apr 2016 09:02:13 +0000 Received: from localhost ([127.0.0.1]:52430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao5pN-0004lt-9r for submit@debbugs.gnu.org; Thu, 07 Apr 2016 05:02:13 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao5pM-0004lf-2Z for 23110@debbugs.gnu.org; Thu, 07 Apr 2016 05:02:12 -0400 Received: from [192.168.101.10] ([217.86.64.216]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0LxOBe-1btw2Q2qTq-0170Wr; Thu, 07 Apr 2016 11:02:04 +0200 Subject: Re: bug#23110: seq apparent bug To: Ruediger Meier , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <56F42764.5010908@bernhard-voelker.de> <201604062019.29435.sweet_f_a@gmx.de> From: Bernhard Voelker Message-ID: <5706220B.4040809@bernhard-voelker.de> Date: Thu, 7 Apr 2016 11:02:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <201604062019.29435.sweet_f_a@gmx.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:gP/RzBRVzW0lud4Srzwtb1EwzEfjGF4cAlXAW3fbOBVphHAacFB zLIPjMQzFk8DA2ES2s2UKQL3/95yZlaH9DuYyKgh/O2AaU6ybStEiUTc5ry+316JX08oLzT IwS44AX9fYJQDnqLiYpjKmFegj2v0O9GDOShBqoY2mkv+KhkJc63YP4QM/ii+dOb9sz3e7Q BF63XC4UgmoaUx6Q8TySQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:s6D2AzlKjNo=:ZX+xE0nnjeF5JbXT7V57vy Ev4b4Xy/MTUWIwqqEIrPNRxCq1/GBbcXupLNYJpsgstCWpWalm3iU8C8gkKmkyfqzU0g01rKO h/mWuXHxGsYnrr+PRaJapXTPId2pMNS8ahiT72j8fjffBfM+OxzpuqvfQe7lTbe1UTOh7BW/E zKe05F4U5UMXDOcY8xayw38sl1MXwYOkQTFpjM0MmUOICBk0D5FKQub+DaXqjLu+Qo88SbjTZ 1FKNwhCikIdO4OcAJpSj0bIKrayG9NVrqx6j9yVMWUnniOSqQ94X+OIG/kETnPGBXAYmT423U uzDBX7kIEfraImUT7An/VwAgZ4wFpDtlWtBbYNHiifb6S1nJAOOQq0/vBFxOdtBg2EQd+G6DQ 9m7y50yNgnSM8Ol78gi9OsgPtfL9G8PdXym8w4ujttEt2XsCyDxCb4B7ntboRZKn6J6IzOdL6 KgYIGawaMCFbCHAcfLOqUN0+NF0rJxopU+LGzHh73DSXp1UEdIUaKawzW2pagF8PIVnrxg7Pi ijSL2anqudGBnMnKiBQcCpGGUd5M+V6FWg2973Sj/Rg3s4j+Vw8Ppxk9v14tM0b/TtGqWT1wq +rezo9LDVKDEu9oKdadAaXgiDMro2KL3ay0xLljfKDP72weaJUBIi8bTw7M3SiDlYsR43sEvo Eedp/OiSY+8G2gcybelhJnNKAd+4k4cwwRHSwHFigQfGIXMjcnaMYl2NgpQOwyQTj8Hyzm9rw yFb8HW6im+8GVmY9 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 Cc: hotpil@mail.ru 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: -0.7 (/) tags 23110 notabug close 23110 thanks On 04/06/2016 08:19 PM, Ruediger Meier wrote: > This sounds all true, however then these one should also run forever: > $ seq 10 0 2 > > Man page says: > INCREMENT is usually positive if FIRST is smaller than LAST, > and INCREMENT is usually negative if FIRST is greater than LAST. > > This implicates IMO that seq should try to count _down_ if FIRST > LAST > and INCREMENT=0 Admittedly, the above documentation aims at useful constellations where seq really operates as a sequence generator - maybe the wording around "... usually ..." could be improved here. In this case, it's not a matter of how increment is treated, but more when seq ends - which is documented quite clearly both in the --help output (and therefore in the generated man page), and in the Texinfo manual: http://www.gnu.org/software/coreutils/seq The sequence of numbers ends when the sum of the current number and increment would become greater than last, [...] > Moreover I'd say this one does not need to loop endless: > $ seq 0 0 0 Why? The sum of 0+0 will never become _greater_ than 0. Likewise for the OPs case ("seq -w 2 0 10"): the sum will never become greater than 10. Thus saying, I think this issue is more a confusion regarding the expectations from the tool. I don't see why an increment of 0 should be treated special here. Therefore, I'm marking this issue as "not a bug", and closing it. As always, further discussion may continue here, and we can re-open this issue if needed ... especially if someone proposes a better wording for the above documentation snippet. ;-) Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 07 05:46:27 2016 Received: (at submit) by debbugs.gnu.org; 7 Apr 2016 09:46:27 +0000 Received: from localhost ([127.0.0.1]:52456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao6WA-0005qV-RJ for submit@debbugs.gnu.org; Thu, 07 Apr 2016 05:46:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao6W9-0005qI-3u for submit@debbugs.gnu.org; Thu, 07 Apr 2016 05:46:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ao6W2-0005zx-Mn for submit@debbugs.gnu.org; Thu, 07 Apr 2016 05:46:19 -0400 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,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ao6W2-0005zt-JT for submit@debbugs.gnu.org; Thu, 07 Apr 2016 05:46:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ao6W1-00089v-Ed for bug-coreutils@gnu.org; Thu, 07 Apr 2016 05:46:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ao6Vy-0005zP-7w for bug-coreutils@gnu.org; Thu, 07 Apr 2016 05:46:17 -0400 Received: from mout.gmx.net ([212.227.15.18]:61584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ao6Vx-0005zL-Td for bug-coreutils@gnu.org; Thu, 07 Apr 2016 05:46:14 -0400 Received: from zappa.ga.local ([82.139.197.16]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MVdfD-1bJliV17Yl-00Z2Pc for ; Thu, 07 Apr 2016 11:46:12 +0200 From: Ruediger Meier To: bug-coreutils@gnu.org Subject: Re: bug#23110: seq apparent bug Date: Thu, 7 Apr 2016 10:46:10 +0100 User-Agent: KMail/1.9.10 References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> In-Reply-To: <5706220B.4040809@bernhard-voelker.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201604071146.11270.sweet_f_a@gmx.de> X-Provags-ID: V03:K0:A/pDi0i2LWZJjObDheKpAmBwYAy0m6VXG3WyCjpDJjMjK7bJlEM L2gKd+LWt9BrydVdIDr7Oe+8tJiIUjqm1vJ9eDMeCd6CvaU6qGxQaUl7Zv3m291XS42LW56 kNNZSZwlVHyHQewU5Ynu+i6YkEGL0FxsAEsTzBVCWdeTGH1nekyEmQ5OTQ1NFlhePzJZ/FI ZyZmsTSsz+XWKlQaRjSaA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Fm2l+TAq2Ng=:digXhlQ0R2hZsRYeOpv+7t 89jj8tY1cELRptekROcuU3v34HQF3d+wjJhh/ZizTVZsBBVGlwtHIVRWRdQvMG+wacPbgPymY Iu8YlyhafaNuutc6VvBQaQMFMnqfxwLyX14YvVc7nlRVMIMyEAezOW364fFlNKxBOzUY7AQc8 9HudKeVkn/d2nzfdCRC60aaXcRnv95M2ihPG63DBpq+UsL1Al2o5HPsVRCkLlgA66tkX83HNk 8YiLVpbro+D76iOrwL+FcJcQAWQ3FGquJyADJg9Izy6YbW4tbvHHNhd2uUZ5Js8yOcQIO362m i6hjscigt/p5h+vZHUwu7tQqsYkifNNXAubUXbQTSdgRfkq2kliob41MbajRlUwpiLearfwys XfqJHF/zrUMk/PvEwZJ77C6ySSq97qQ4iazF9RTZskFBv18ml7ImbUUNQql58L5upZL+rgHkJ WKxQ5gdLQ96WI7bQh5wrwDzTogEm5GIcpxZz8BTbVnPibfirTbUmp6Ux9aN2hrpk3qMpXsuGm WbBVR7ql/ICerWj3ruAUmJ2Qq4v7+mUfOlMe4CLbgRi0TcBRnsIa7RW6QNOsabxKj7u3YDNB1 xCD7MvvWTXQY6EoN24w4Zto5Y8DrP2lsHkUaxtpT5SxkCUYhtPsrVxirjdygfOAnjqStmZ3KC 1prXVYj1V8mmb+sDEF1aHhf9wcqHp/TmEIk9ZNxiSfzp8fbVEIdrPFkmtLUmMaJl3ucjaAwUD jJl3EYntNzgDIImsna9NO8zzJm9irnw4ighq5l3UfLSwd0hn3qpsRsmH/pY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit 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: -4.1 (----) On Thursday 07 April 2016, Bernhard Voelker wrote: > tags 23110 notabug > close 23110 > thanks > > On 04/06/2016 08:19 PM, Ruediger Meier wrote: > > This sounds all true, however then these one should also run > > forever: $ seq 10 0 2 > > > > Man page says: > > INCREMENT is usually positive if FIRST is smaller than LAST, > > and INCREMENT is usually negative if FIRST is greater than > > LAST. > > > > This implicates IMO that seq should try to count _down_ if FIRST > > > LAST and INCREMENT=0 > > Admittedly, the above documentation aims at useful constellations > where seq really operates as a sequence generator - maybe the wording > around "... usually ..." could be improved here. > > In this case, it's not a matter of how increment is treated, but more > when seq ends - which is documented quite clearly both in the --help > output (and therefore in the generated man page), and in the Texinfo > manual: > > http://www.gnu.org/software/coreutils/seq > > The sequence of numbers ends when the sum of the current number > and increment would become greater than last, [...] > > > Moreover I'd say this one does not need to loop endless: > > $ seq 0 0 0 > > Why? The sum of 0+0 will never become _greater_ than 0. > Likewise for the OPs case ("seq -w 2 0 10"): the sum will never > become greater than 10. > > Thus saying, I think this issue is more a confusion regarding the > expectations from the tool. I don't see why an increment of 0 should > be treated special here. > > Therefore, I'm marking this issue as "not a bug", and closing it. > As always, further discussion may continue here, and we can re-open > this issue if needed ... especially if someone proposes a better > wording for the above documentation snippet. ;-) I understand that this issue is not a bug. But it wouldn't be also not a bug if coreutils would behave like BSD: $ seq 1 0 10 ; echo $? seq: zero increment 1 This is much more useful and safe. Scripts which invoke an endless loop by using seq have almost certainly made something wrong. Endless loop and 100% CPU usage could be avoided. People who _want_ endless trivial "sequences" are using yes(1). cu, Rudi From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 07 10:40:55 2016 Received: (at 23110) by debbugs.gnu.org; 7 Apr 2016 14:40:55 +0000 Received: from localhost ([127.0.0.1]:53004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoB79-0007lF-Eo for submit@debbugs.gnu.org; Thu, 07 Apr 2016 10:40:55 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:58486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoB77-0007l3-L9 for 23110@debbugs.gnu.org; Thu, 07 Apr 2016 10:40:54 -0400 Received: from [192.168.101.10] ([217.86.64.216]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0Le9EG-1bbm4I3cPk-00pt9a; Thu, 07 Apr 2016 16:40:46 +0200 Subject: Re: bug#23110: seq apparent bug To: Ruediger Meier , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> From: Bernhard Voelker Message-ID: <5706716E.6030105@bernhard-voelker.de> Date: Thu, 7 Apr 2016 16:40:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <201604071146.11270.sweet_f_a@gmx.de> Content-Type: multipart/mixed; boundary="------------050103080103010402000708" X-Provags-ID: V03:K0:p+2iAoOFq/KT5+AKp3XWMPTGRCrYMJGzpDnmDxuX8QhQxpudmoZ jGyqJhHOnNJE5/PzfH7sQpCF703EkiB/A7gVBlZZwSp+i24koVQoBOcErnTowfZ+7ILoWia dxz764lT8q3TRqVrH/QXiMIvk0aHs74N+5QyT6Ytfjd1pmEOKhuOyHhDIu7kTVKCXfmrDbG hXGCtcDVw0AAsUvfVqG1g== X-UI-Out-Filterresults: notjunk:1;V01:K0:s9JFY6m42Jg=:c33n0ZLKv33vP6+oEixrbn byNIX/TEE2ZerR5ifsI1BjK357gdGWLJ6YFN5HHi+wV3lfupimhTMMGSzaLV82f36Op5Ha+Xk 5TblitlPqwIOhUHpRjn6TUtUWnY7o2ok32Ff3oMhkVcarsPX80nTnioQpd5s5quBVGb+cqGId Z8CV+Jf72YyVeI0xFZHk5kpriw7w7Nbrz/tNFyVexQKeQFos9cEMeEqZvc5QL22aIjuWDFSer DcahJuz4j41BRGs6F08JqJp9hfprAcJ++OoBg9OmNyPk2vQuwYk1Edn/xrQNLYNaCp6ekGktT 1y34ZlXXVRc4R5O3Dudf7M40f5hmr22Y52C0K6SlDhTM+xHZGziLoOGaV8THc1js9Uxxb+WQq zFj08GifHs7k0e2WWVyO5rSLXc5uWkAZQRMy0ysMCMwVnQjcsoSbXaP7UBWFzW/XAlwwkP2Cv VFObuPgU57r44jBz3u+M/dk0Qpi6R2LeYbBs6JDZyckQiak1Wqc4xHIKhK967F54YyOwlUmsj DkU4d587TdrdM7n3VJAAHuQDlCQ3j8Nq92Zc4K6mEiy37PErqNB0IlODl6+2IYRSusB362BTA CG1kapVS+ChEXN0umMFyVqUX+/4wfZ67EHa7uAfxcMX1VNAbhsWznfVtUzj8jGmxjiNSCFriG IOHPstkbLHSGx8B+GtRE+66E7sUi21uIYJ+bAHKjhaYMLQpw3/aS3L5vfoWLOvrMcYCY= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: -0.7 (/) This is a multi-part message in MIME format. --------------050103080103010402000708 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit reopen 23110 thanks On 04/07/2016 11:46 AM, Ruediger Meier wrote: > I understand that this issue is not a bug. But it wouldn't be also not a > bug if coreutils would behave like BSD: > > $ seq 1 0 10 ; echo $? > seq: zero increment > 1 Ah, okay: as there's prior art in the BSDs [0], the attached proposes the same for GNU coreutils. [0] http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-7/src/usr.bin/seq/seq.c Have a nice day, Berny --------------050103080103010402000708 Content-Type: text/x-patch; name="0001-seq-do-not-allow-0-as-increment-value.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-seq-do-not-allow-0-as-increment-value.patch" >From 5a7da754f7b5dca598748f5b83046507e5c91b84 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 7 Apr 2016 15:59:45 +0200 Subject: [PATCH] seq: do not allow 0 as increment value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/seq.c (main): Exit with an error diagnostic when the given step value is Zero. (usage): Document it. * doc/coreutils.texi (seq invocation): Likewise. * tests/misc/seq.pl: Add tests. * NEWS (Changes in behavior): Mention the change. Reported by Маренков Евгений in: http://bugs.gnu.org/23110 --- NEWS | 2 ++ doc/coreutils.texi | 2 ++ src/seq.c | 6 ++++++ tests/misc/seq.pl | 8 ++++++++ 4 files changed, 18 insertions(+) diff --git a/NEWS b/NEWS index dd3ee9c..2bdc698 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ GNU coreutils NEWS -*- outline -*- ** Changes in behavior + seq no longer accepts 0 value as increment argument. + stat now outputs nanosecond information for time stamps even if they are out of localtime range. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 45706bd..6b70635 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -17422,6 +17422,8 @@ even when @var{first} is larger than @var{last}. The sequence of numbers ends when the sum of the current number and @var{increment} would become greater than @var{last}, so @code{seq 1 10 10} only produces @samp{1}. +@var{increment} must not be @samp{0}; use @command{yes} to get +repeated output of a constant number. Floating-point numbers may be specified. @xref{Floating point}. The program accepts the following options. Also see @ref{Common options}. diff --git a/src/seq.c b/src/seq.c index fbb94a0..83f95d7 100644 --- a/src/seq.c +++ b/src/seq.c @@ -92,6 +92,7 @@ INCREMENT would become greater than LAST.\n\ FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\ INCREMENT is usually positive if FIRST is smaller than LAST, and\n\ INCREMENT is usually negative if FIRST is greater than LAST.\n\ +INCREMENT must not be 0.\n\ "), stdout); fputs (_("\ FORMAT must be suitable for printing one argument of type 'double';\n\ @@ -634,6 +635,11 @@ main (int argc, char **argv) if (optind < argc) { + if (last.value == 0) + { + error (0, 0, _("invalid increment value: 0")); + usage (EXIT_FAILURE); + } step = last; last = scan_arg (argv[optind++]); } diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index 6564415..c4aa556 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -151,6 +151,14 @@ my @Tests = ['fast-1', qw(4), {OUT => [qw(1 2 3 4)]}], ['fast-2', qw(1 4), {OUT => [qw(1 2 3 4)]}], ['fast-3', qw(1 1 4), {OUT => [qw(1 2 3 4)]}], + + ['inc-zero-1', qw(1 0 10), {EXIT => 1}, + {ERR => "seq: invalid increment value: 0\n".$try_help}], + ['inc-zero-0', qw(0 0 0), {EXIT => 1}, + {ERR => "seq: invalid increment value: 0\n".$try_help}], + ['inc-sero-f', qw(1 0.0 10), {EXIT => 1}, + {ERR => "seq: invalid increment value: 0\n".$try_help}], + ); # Append a newline to each entry in the OUT array. -- 2.1.4 --------------050103080103010402000708-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 07 14:18:21 2016 Received: (at 23110) by debbugs.gnu.org; 7 Apr 2016 18:18:21 +0000 Received: from localhost ([127.0.0.1]:53177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoEVZ-00060Y-BU for submit@debbugs.gnu.org; Thu, 07 Apr 2016 14:18:21 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:45658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoEVX-00060O-D1 for 23110@debbugs.gnu.org; Thu, 07 Apr 2016 14:18:19 -0400 Received: from localhost.localdomain (unknown [109.78.238.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id A98049567; Thu, 7 Apr 2016 19:18:17 +0100 (IST) Subject: Re: bug#23110: seq apparent bug To: Bernhard Voelker , Ruediger Meier , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <5706A468.1060107@draigBrady.com> Date: Thu, 7 Apr 2016 19:18:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5706716E.6030105@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23110 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: 0.0 (/) On 07/04/16 15:40, Bernhard Voelker wrote: > reopen 23110 > thanks > > On 04/07/2016 11:46 AM, Ruediger Meier wrote: >> I understand that this issue is not a bug. But it wouldn't be also not a >> bug if coreutils would behave like BSD: >> >> $ seq 1 0 10 ; echo $? >> seq: zero increment >> 1 > > Ah, okay: as there's prior art in the BSDs [0], the attached > proposes the same for GNU coreutils. > > [0] http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-7/src/usr.bin/seq/seq.c > I see FreeBSD has seq since 9.0. I agree that we should avoid repeating output with "0" STEP. Do we want to deal with these cases spinning the cpu? seq 1 nan 1 seq 1 .0000000000000000000000000000001 1 As an aside, I see FreeBSD requires the STEP to be in the right direction when FIRST != LAST, or it will also exit with error. GNU will just output nothing in that case. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 08 08:57:42 2016 Received: (at 23110) by debbugs.gnu.org; 8 Apr 2016 12:57:42 +0000 Received: from localhost ([127.0.0.1]:53617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoVyo-0001Z3-27 for submit@debbugs.gnu.org; Fri, 08 Apr 2016 08:57:42 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:48749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoVyl-0001Yu-Rx for 23110@debbugs.gnu.org; Fri, 08 Apr 2016 08:57:40 -0400 Received: from localhost.localdomain (unknown [109.76.241.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 6BE6D233 for <23110@debbugs.gnu.org>; Fri, 8 Apr 2016 13:57:38 +0100 (IST) Subject: Re: bug#23110: seq apparent bug To: 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <5707AAC1.3000107@draigBrady.com> Date: Fri, 8 Apr 2016 13:57:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5706716E.6030105@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23110 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: 0.0 (/) On 07/04/16 15:40, Bernhard Voelker wrote: > reopen 23110 > thanks > > On 04/07/2016 11:46 AM, Ruediger Meier wrote: >> I understand that this issue is not a bug. But it wouldn't be also not a >> bug if coreutils would behave like BSD: >> >> $ seq 1 0 10 ; echo $? >> seq: zero increment >> 1 > > Ah, okay: as there's prior art in the BSDs [0], the attached > proposes the same for GNU coreutils. > > [0] http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-7/src/usr.bin/seq/seq.c I see FreeBSD has seq since 9.0. I agree that we should avoid repeating output with "0" STEP. The patch is fine as is and good to push. Do we want to deal with these cases spinning the cpu, in further patches? seq 1 nan 1 seq 1 .0000000000000000000000000000001 1 As an aside, I see FreeBSD requires the STEP to be in the right direction when FIRST != LAST, or it will also exit with error. GNU will just output nothing in that case. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 08 15:45:26 2016 Received: (at 23110) by debbugs.gnu.org; 8 Apr 2016 19:45:26 +0000 Received: from localhost ([127.0.0.1]:54955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aocLN-0006ge-Qh for submit@debbugs.gnu.org; Fri, 08 Apr 2016 15:45:25 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aocLM-0006gS-G4 for 23110@debbugs.gnu.org; Fri, 08 Apr 2016 15:45:25 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7B8E5160068; Fri, 8 Apr 2016 12:45:18 -0700 (PDT) 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 K0SdYe1dihVd; Fri, 8 Apr 2016 12:45:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C66911601ED; Fri, 8 Apr 2016 12:45:17 -0700 (PDT) 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 BxdaYtHVPIrx; Fri, 8 Apr 2016 12:45:17 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id ACECF160068; Fri, 8 Apr 2016 12:45:17 -0700 (PDT) Subject: Re: bug#23110: seq apparent bug To: =?UTF-8?Q?P=c3=a1draig_Brady?= , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5707AAC1.3000107@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <57080A4D.2060102@cs.ucla.edu> Date: Fri, 8 Apr 2016 12:45:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <5707AAC1.3000107@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 23110 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 (-) On 04/08/2016 05:57 AM, P=C3=A1draig Brady wrote: > Do we want to deal with these cases spinning the cpu, > in further patches? > > seq 1 nan 1 NaN should be an error in any of the operands. > seq 1 .0000000000000000000000000000001 1 For this I suggest the following heuristic. When inferring a format that=20 would apply to two or more lines of output, try formatting the first two=20 lines and report an error if they are the same. That would catch the=20 seeming infinite loop (and at any rate, inadequate output) in this exampl= e. > > As an aside, I see FreeBSD requires the STEP to be in the right directi= on > when FIRST !=3D LAST, or it will also exit with error. > GNU will just output nothing in that case.=20 Outputting nothing sounds better. 'seq 1 0' is like 'for (i =3D 1; i <=3D= 0;=20 i++) ...' From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 08 16:52:09 2016 Received: (at submit) by debbugs.gnu.org; 8 Apr 2016 20:52:09 +0000 Received: from localhost ([127.0.0.1]:54979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aodNx-0008Gz-5W for submit@debbugs.gnu.org; Fri, 08 Apr 2016 16:52:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aodNw-0008Gj-89 for submit@debbugs.gnu.org; Fri, 08 Apr 2016 16:52:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aodNq-0007Dk-Aj for submit@debbugs.gnu.org; Fri, 08 Apr 2016 16:52:03 -0400 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,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodNq-0007Da-8i for submit@debbugs.gnu.org; Fri, 08 Apr 2016 16:52:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodNp-0007Kn-4B for bug-coreutils@gnu.org; Fri, 08 Apr 2016 16:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aodNl-0007Cp-Tn for bug-coreutils@gnu.org; Fri, 08 Apr 2016 16:52:01 -0400 Received: from mout.gmx.net ([212.227.17.22]:58482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodNl-0007Bq-L8 for bug-coreutils@gnu.org; Fri, 08 Apr 2016 16:51:57 -0400 Received: from tenfore.site ([217.51.254.22]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MC8iq-1axT4N2Yi0-008qnz for ; Fri, 08 Apr 2016 22:51:55 +0200 From: Ruediger Meier To: bug-coreutils@gnu.org Subject: Re: bug#23110: seq apparent bug Date: Fri, 8 Apr 2016 22:51:54 +0200 User-Agent: KMail/1.9.10 References: <1458833312.301435744@f347.i.mail.ru> <5707AAC1.3000107@draigBrady.com> <57080A4D.2060102@cs.ucla.edu> In-Reply-To: <57080A4D.2060102@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201604082251.54656.sweet_f_a@gmx.de> X-Provags-ID: V03:K0:QOsfcEGSngsaJ8gejsmeYTkmi6vJPeC631EXFWY4JYw8jldJ2Dl NqOavIKCSnJN4eIJ7Z35tmWEIaO9BcosX4AJtgeMpK8pLcVHIvAi2N9Oh5Q+WFaLchBVbZi HWFZncjT/b/pMXWUJ3C6GgWbxhHvFp8pgi6JMalNEYlrdI4SyRoMtNAj+Tl7Ol4oyvA9lnp 0WBSywS7me09Vu616EToA== X-UI-Out-Filterresults: notjunk:1;V01:K0:JVaGhr6Oxaw=:i8txAFAq8WmDORSKxoRTg7 HLM6qI8geYuACyRzpsevBKxbEKFWzMv8ufoKqAJcnu12j1iixpYyM8ddyrRb8cXnq4mnc7O9f Ja2qltiLOgfnc31I2STy4EfDZ4CHZGIXW5oazSbWzO3VhIsld+eywv7VIFJmD5WYzroa5jNEL sq6wZNSPK3+BZJzJxX/UrNWqWY2jpxccQdKki5eDNd+4dirKoSLwtRvj7whMvrVmqziocM8ep Em2cZ25b2zZdDrF+ZsZZJJCTIfYpbZTFePSfp0pOwnMTLhbhovso6sBbFmV+p+CixQjmGLARw 5VMtUB8L5CTnOUHExdkGMG3l8shvXWkIXrhp8N/P8bLp/d75ZRGtZ9yWkhLaTz1nGngjcb58V uToGkNywQ0EubthIkSjKHJ/eTybeo24cDOrv08j/ph6Xkwz5Wt0S0RZQASIg0GcNdw6fPE+mY i9O9LMmh7mjq2fTjzLn9dKl47ULO3arHJQmiiw+LMD6kZu/8/hxSUXV2lafRTizCImlxyA4NT K9qfjIQM98/wkhJlcsE9+EQfGJFRkYPuczY+unXP0aUe7zz8Nl5xLn/tfEfPZhD2YU9HC9EeZ tZw+G3i4FAMA48G6aK3OwdSCh8U6bOxyhkluiZr4M1/a/D7CN/wYqsT0Egc+hhH/bqTl0VVFN 78ffib/elMZCLkVQU31nbQCap8ksa2CL3jYXqdd1PMK589/DumWSbHQRXYSlp8xPWj51JEI2A OrHRqX7N2t6Anfll70jSLm1trZ8PpKL/n/nZZ1RKR6my0O4kjMngxI5qvWg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit 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: -4.1 (----) On Friday 08 April 2016, Paul Eggert wrote: > On 04/08/2016 05:57 AM, P=C3=A1draig Brady wrote: > > Do we want to deal with these cases spinning the cpu, > > in further patches? > > > > seq 1 nan 1 > > NaN should be an error in any of the operands. > > > seq 1 .0000000000000000000000000000001 1 > > For this I suggest the following heuristic. When inferring a format > that would apply to two or more lines of output, try formatting the > first two lines and report an error if they are the same. Hm, I think printing identical lines is a valid use case: $ seq -f "%0.1f" 0 0.02 0.1 0.0 0.0 0.0 0.1 0.1 0.1 > That would=20 > catch the seeming infinite loop (and at any rate, inadequate output) > in this example. I would check it before the loop like this if ((first + inc) =3D=3D first) /* exit error */=20 Note this still wouldn't catch this one seq 0 .0000000000000000000000000000001 1 But this would run millions of years anyway even if the increment would =20 work and moreover maybe the user _wants_ an effective endless (non=20 trivial) sequence like this seq 0 1 999999999999999999999999999999 > > As an aside, I see FreeBSD requires the STEP to be in the right > > direction when FIRST !=3D LAST, or it will also exit with error. > > GNU will just output nothing in that case. > > Outputting nothing sounds better. 'seq 1 0' is like 'for (i =3D 1; i <=3D > 0; i++) ...' I also guess that some people may have used this coreutils feature=20 already in scripts: # do nothing if inc =3D -1 for i in `seq 0 $inc 100`;do something; done cu, Rudi From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 08 18:21:25 2016 Received: (at 23110) by debbugs.gnu.org; 8 Apr 2016 22:21:26 +0000 Received: from localhost ([127.0.0.1]:54998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoemL-0002A7-Oo for submit@debbugs.gnu.org; Fri, 08 Apr 2016 18:21:25 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoemK-00029u-JZ for 23110@debbugs.gnu.org; Fri, 08 Apr 2016 18:21:25 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8ECEF1601C6; Fri, 8 Apr 2016 15:21:18 -0700 (PDT) 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 JW2-mt0xhO8D; Fri, 8 Apr 2016 15:21:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D5A381605E2; Fri, 8 Apr 2016 15:21:17 -0700 (PDT) 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 h9GOFS8WS5Lb; Fri, 8 Apr 2016 15:21:17 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BE3A11601C6; Fri, 8 Apr 2016 15:21:17 -0700 (PDT) Subject: Re: bug#23110: seq apparent bug To: Ruediger Meier , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <5707AAC1.3000107@draigBrady.com> <57080A4D.2060102@cs.ucla.edu> <201604082251.54656.sweet_f_a@gmx.de> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <57082EDD.3070007@cs.ucla.edu> Date: Fri, 8 Apr 2016 15:21:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <201604082251.54656.sweet_f_a@gmx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 23110 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 (-) On 04/08/2016 01:51 PM, Ruediger Meier wrote: > On Friday 08 April 2016, Paul Eggert wrote: >> For this I suggest the following heuristic. When inferring a format >> that would apply to two or more lines of output, try formatting the >> first two lines and report an error if they are the same. > Hm, I think printing identical lines is a valid use case: > $ seq -f "%0.1f" 0 0.02 0.1 > 0.0 > 0.0 > 0.0 > 0.1 > 0.1 > 0.1 Sure, but the heuristic I suggested was for inferred formats only. It was not intended for formats explicitly specified via -f. > I would check it before the loop like this > > if ((first + inc) == first) > /* exit error */ I think I'd prefer testing what the user would see, instead of testing some internal variable. > maybe the user _wants_ an effective endless (non > trivial) sequence If we make an increment of zero an error, then there's no way for the 'seq' user to say they want an endless identical sequence. But there's always the 'yes' program for that. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 09 02:18:45 2016 Received: (at 23110) by debbugs.gnu.org; 9 Apr 2016 06:18:46 +0000 Received: from localhost ([127.0.0.1]:55084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aomEH-0001iQ-Ox for submit@debbugs.gnu.org; Sat, 09 Apr 2016 02:18:45 -0400 Received: from mout.gmx.net ([212.227.15.18]:56820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aomEF-0001iD-Fl for 23110@debbugs.gnu.org; Sat, 09 Apr 2016 02:18:43 -0400 Received: from tenfore.site ([217.51.254.22]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MH0SI-1b2Xac1ycM-00DoVh; Sat, 09 Apr 2016 08:18:24 +0200 From: Ruediger Meier To: Paul Eggert Subject: Re: bug#23110: seq apparent bug Date: Sat, 9 Apr 2016 08:18:22 +0200 User-Agent: KMail/1.9.10 References: <1458833312.301435744@f347.i.mail.ru> <201604082251.54656.sweet_f_a@gmx.de> <57082EDD.3070007@cs.ucla.edu> In-Reply-To: <57082EDD.3070007@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201604090818.22374.sweet_f_a@gmx.de> X-Provags-ID: V03:K0:FMP6PUkZQ7Xbm1GVoH+gr/V1DOgZB3qFvrkDweSc0IeYRYk6shB 5ydLOV5b33ttq5i+bIAxU+33OeOZ7clApgDimtl2uIFUoVMf42juzb0IO9hzvV9lhbPI2sg bUI/HIjIj6kXgPv6U/wCRI0ZcdepkprZdsa1sd2HsoplVT7MKmx9DC8dfVoA3CnJ6m5u8f0 2GZbUqWW4JMq1B9KSy04Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:GY8rGFIY2vg=:MChzaXiEcC+IEp7HLgIfX2 4m/eUXbSb7fHa17yreDKdl4L12g0/qC5plNYARl4mZDM/u51+LTSIrP6p8RuJgwdkh/LCpL8O /EhwkP2KFzy41sDl7ITurVUwpBty7ABC2HngUtIp+CZ7z0Dzk5W7/OLtAhq8YGby2qWhMQ79a 8HCdGOiR89Ny4W5dV1+StvDg7PZmbUM8KpMa3d1497zONxWVcSbb1kgN/lSFHMaDuoauc6ch2 fKHuDGoYc3X3rv8G+4VuiNklsDsOZsSiUPUC5ndPHI9+WSJ94/Pb7JAE7k/pOIu0/Tr3oKrZj DJRsZ2I33kvdO7HaEGHYrzX32USEkPS2UCun5jga6GIRXKK1Hw9CwZiwY5WzZuRWTjgizRMfY JQqnQWr3l+PwUpZns+R4h41NEIYgox1LsDr6jTW6KNr7oAmXte2C9BcKWi0rxknL9GW6oPMX3 pVjRfJFPN2uZHUIL7w+4iZlrU2MF1GDzMn3fG2E6b6EDrCcbFx+qeFzprJ8PbTxwcoDa0G7W1 0v9CUzlxjz6S4vwXOKFGYP0dkQJK4hijScuZL72vXDgqs+vdbJ7rRWFQOI4wtjOAEcdfGNldK YbL3KAyv0HQgUMphusLywgoRJ3CqtxwD12eZev+AQ3+WfAv2tUjAgXH01kLpv0kzcwAJ4Ebcl 1yFDA23pkdBlbsln4503JvGPGNjJKbfDezeUABP8Y2ajWCSrzlBA9hljPjnIFoViJpqICAGk3 3h7MIXsm5GE9DoURDYDSYRF/wrFLUYrsZ2wQhXl/6EE0o5B5IY93Bzii6RU= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 Cc: 23110@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: -0.7 (/) On Saturday 09 April 2016, Paul Eggert wrote: > On 04/08/2016 01:51 PM, Ruediger Meier wrote: > > On Friday 08 April 2016, Paul Eggert wrote: > >> For this I suggest the following heuristic. When inferring a > >> format that would apply to two or more lines of output, try > >> formatting the first two lines and report an error if they are the > >> same. > > > > Hm, I think printing identical lines is a valid use case: > > $ seq -f "%0.1f" 0 0.02 0.1 > > 0.0 > > 0.0 > > 0.0 > > 0.1 > > 0.1 > > 0.1 > > Sure, but the heuristic I suggested was for inferred formats only. It > was not intended for formats explicitly specified via -f. > > > I would check it before the loop like this > > > > if ((first + inc) == first) > > /* exit error */ > > I think I'd prefer testing what the user would see, instead of > testing some internal variable. > > > maybe the user _wants_ an effective endless (non > > trivial) sequence > > If we make an increment of zero an error, then there's no way for the > 'seq' user to say they want an endless identical sequence. But > there's always the 'yes' program for that. I've ment effective (feels like) endless. $ seq 0 1 1.0e+100 would run more than 10^93 seconds on my system (about 10^83 times the age of the universe). The increment sum-up would become imprecise and behave like zero much earlier. cu, Rudi From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 09 04:49:35 2016 Received: (at 23110) by debbugs.gnu.org; 9 Apr 2016 08:49:35 +0000 Received: from localhost ([127.0.0.1]:55146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aooaF-0005Ke-0g for submit@debbugs.gnu.org; Sat, 09 Apr 2016 04:49:35 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:62926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aooaD-0005KR-GX for 23110@debbugs.gnu.org; Sat, 09 Apr 2016 04:49:33 -0400 Received: from [192.168.101.10] ([217.86.64.216]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0M1kNy-1bdlKt3lsI-00tmWO; Sat, 09 Apr 2016 10:49:13 +0200 Subject: Re: bug#23110: seq apparent bug To: Paul Eggert , =?UTF-8?Q?P=c3=a1draig_Brady?= , 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5707AAC1.3000107@draigBrady.com> <57080A4D.2060102@cs.ucla.edu> From: Bernhard Voelker Message-ID: <5708C206.1090903@bernhard-voelker.de> Date: Sat, 9 Apr 2016 10:49:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <57080A4D.2060102@cs.ucla.edu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:9PnmTSz2TNKqk7L8Tr64BSQGTtRQC+8nCzkxLFrnuEPvI+I2qCT zEEFvDRl4oEIoVeR3nZ/DNABmaXvybWbU0wAjKDskz4vd98vjISS/XZzPZy4xLiVSooiHVD NV8rYNB0IvOBe9OaMFfoD7Gv0t8wEOBfGr9jBv2gdURJOmnu2y/k2sR8mNbC3eaXft9hbIf Oh/FGXdOtCAKgGfwhrAGg== X-UI-Out-Filterresults: notjunk:1;V01:K0:xMYkVLAvmaI=:znBuE3EzIY8+sQMoEQM0QL +yNHwSev9CEqFIEuFw0b8NfKKPR6HeZ0MEch7hAgSU4YlNacUjwXrTl8s83XeVdh9h2S3C9Qp ymhZERWB7M2CeVhUmMGbKqUtOyXMGV9lnOmSDhUbGbw5KTAuW8UBSt7mXuRf8T/QYgyAjCOcf gmZhOiNtDWB0Eiwb7v0AYRs9lk7nMhMW6BrBGm8AEfPXmcHPHjioNMLB0u++boY62PEtycEAC 7wiaqIOEpPenPAcyn3N0lluODsbeneshJ/9lxMz9AICb3aAFJANym/qLSEUt0SRNMLk6EHIdA JPIYTbnSwVOT8w0AChreKEpkAD+heR2eJrWAh0CSaeiz97e6ca/TaE2Fg28GfprI1JzYdZJka TLX0VOKShSGJWbkpAMgEqHPauGrETX69CyW4zVtt9goEtjRFNNo0GIICnITHLyEqVkNic7bkJ Ad2J/Lvxb9oH+3O+hFnxZlgrDk1IMI9s0nKpvuAzxq7N138LZAe5txLI5LaKW3ZFdAgs8+vey P2CPAq/gEUJ6qoqabapxepx+EDG5ta4F2yCmeUZFGxmEGbAvIFm9hmKqVTpnivD3NdYfbM/+u tp1WF+YWmUC0I2xdZxN7xPUO8txMX7Ljsym808Viq8iQTeiib2mO6aEY3I4QrGxMIK+9Jm6rc URnPiuYkN5Mia1Hcfx6ZZvMferNAiPUk+P/X3iM/bvLiDJBFlAkj1eDPtXggwa9ZPr6LyKwGX 2d40c3R4OcfrVYgx X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: -0.7 (/) On 04/08/2016 09:45 PM, Paul Eggert wrote: > On 04/08/2016 05:57 AM, Pádraig Brady wrote: >> Do we want to deal with these cases spinning the cpu, >> in further patches? >> >> seq 1 nan 1 > > NaN should be an error in any of the operands. +1 >> seq 1 .0000000000000000000000000000001 1 > > For this I suggest the following heuristic. When inferring a format that > would apply to two or more lines of output, try formatting the first two > lines and report an error if they are the same. That would catch the > seeming infinite loop (and at any rate, inadequate output) in this example. The only way to avoid this at all is to extend seq_fast() also for arbitrary numbers, i.e., re-write the code to do the math all in the string format the user wants. Today, it's hard to explain why "seq 1 1 100000000" needs only 0.6s while "seq 1 2 100000000" takes 24s although the increment is doubled. Okay, one could extend fast_seq() to work for all_digits_p(step). As it only the plus operation (or minus, well), wouldn't it be faster to manually calculate all as strings, no matter if step is 1 or 0.00000000000000000000000000123? Besides, the output could be buffered to save writes. >> As an aside, I see FreeBSD requires the STEP to be in the right direction >> when FIRST != LAST, or it will also exit with error. >> GNU will just output nothing in that case. > > Outputting nothing sounds better. 'seq 1 0' is like 'for (i = 1; i <= 0; > i++) ...' +1 Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 12:38:14 2016 Received: (at 23110) by debbugs.gnu.org; 14 Apr 2016 16:38:14 +0000 Received: from localhost ([127.0.0.1]:35532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkHV-0000iu-Lg for submit@debbugs.gnu.org; Thu, 14 Apr 2016 12:38:14 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:51321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkHU-0000ih-5L for 23110@debbugs.gnu.org; Thu, 14 Apr 2016 12:38:13 -0400 Received: from [192.168.101.10] ([217.86.64.216]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0MEmVu-1b1FjE3PnG-00FzlR; Thu, 14 Apr 2016 18:37:54 +0200 Subject: Re: bug#23110: seq apparent bug To: =?UTF-8?Q?P=c3=a1draig_Brady?= , Ruediger Meier , 23110@debbugs.gnu.org, Paul Eggert References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5706A468.1060107@draigBrady.com> From: Bernhard Voelker Message-ID: <570FC75F.4080602@bernhard-voelker.de> Date: Thu, 14 Apr 2016 18:37:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <5706A468.1060107@draigBrady.com> Content-Type: multipart/mixed; boundary="------------090608020001070805090502" X-Provags-ID: V03:K0:Pzv9rLVEhielf4J50HL/DeU/D8yi3nerYnnKXP8wzzj754FBhS5 9YmOpc78O78Yluw9fXxEZ96GU8OvgtwpgWAA+/Sdl8PTrJITGp9sLSv/anb5HGgUW/fZY97 TH2e5ajfdM5H4hpnwA1sUDU4qN7UPNQSKQhg5Yquut+9yXHj/dFa6wB5zckcomFSnJeMBNt lufIGxaLN6uG8aSMxB6pQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:NSMgBo4E/us=:SJYJu60YipIUO1ltGqBzFv GnD1YnFM5bacPwVuUDksm9i/5po6SbmcaRbYhg9Q2iiVnXtw4SMtqfyy9sNbpRu0YGqjzhAVd y8MV1617PZA4fbGfmezvPD8aTQXwkSbSrtr6NjnKTjF2pdscFZ0QrVWxyh7kMmEzdQ2H1j3dN 0pzWLxW13U2+8jK+Ru/udNWCxDjG3+F+BuTD9j8s7oPvMOwiGDcTnfmWqBNW33osXbPq0nN8+ OxCihdzzeA44SLehWwdhSTtad96P4dnUCZD5KviAM1fOWFAklr5FV5ClUIvfdHe+S1K/qibqK 61iXwV0bVXmsPrtGoVDA/uDG82/xuSZ1Phaq+vq4H3tYWYWB6ZCKn8MYm5x8+8Hy2y6i1v3EO DDwrvrgrC+KpJqw2iBJp57NZBcELEGOEpUaTFMZ9vKD9UwBf9ZyPVFUg52xFuFYrihr3H9GV7 dYt2YjRSxmdBfR1F9OPNbxiNaRwnGNlJhCzvX66aLSCDszBwR3DUXrvXpr9NcResoXaPN3Vq6 Ww6D++GVGQYWGFqkOipwG4Qt+fc5W/dys2pC9lY49cRlHHhWwhomPI5Ogg+jLBpnbAjKUqTy2 uRi88la215aBhULNuyZ7IlVb4ys6YGewBx9IEmnsvdEam09fMXGk8QD3GO14vkryWapOXE8dB +piSbdRgZ3hJggOP+xhqOq9dFhGPwD72AwQwzf5EsM//E/RtozgDR+DQtL+NgLavGxJI= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: -0.7 (/) This is a multi-part message in MIME format. --------------090608020001070805090502 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 04/07/2016 08:18 PM, Pádraig Brady wrote: > I agree that we should avoid repeating output with "0" STEP. Thanks. I improved the error diagnostic by outputting the original value from the user: [PATCH 1/2] seq: do not allow 0 as increment value > Do we want to deal with these cases spinning the cpu? > > seq 1 nan 1 This is addressed with the second patch: [PATCH 2/2] seq: do not allow NaN arguments > seq 1 .0000000000000000000000000000001 1 I consider this a bug in seq: from mathematical point of view, the above should just output "1" and then exit, because after adding that tiny number the next number would be greater than LAST. IMO we should enhance seq_fast() to do all the Math when no special output format is given. WDYT? > As an aside, I see FreeBSD requires the STEP to be in the right direction > when FIRST != LAST, or it will also exit with error. > GNU will just output nothing in that case. I think GNU seq's behavior is okay, and therefore I agree with Paul in http://lists.gnu.org/archive/html/bug-coreutils/2016-04/msg00032.html Have a nice day, Berny --------------090608020001070805090502 Content-Type: text/x-patch; name="0001-seq-do-not-allow-0-as-increment-value.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-seq-do-not-allow-0-as-increment-value.patch" >From 81e589021d9c47e4fbc4284e82881a9703246476 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 14 Apr 2016 12:38:09 +0200 Subject: [PATCH 1/2] seq: do not allow 0 as increment value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/seq.c (main): Exit with an error diagnostic when the given step value is Zero. (usage): Document it. * doc/coreutils.texi (seq invocation): Likewise. * tests/misc/seq.pl: Add tests. * NEWS (Changes in behavior): Mention the change. Reported by Маренков Евгений in: http://bugs.gnu.org/23110 --- NEWS | 2 ++ doc/coreutils.texi | 2 ++ src/seq.c | 8 ++++++++ tests/misc/seq.pl | 10 ++++++++++ 4 files changed, 22 insertions(+) diff --git a/NEWS b/NEWS index 9445977..13af702 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ GNU coreutils NEWS -*- outline -*- ** Changes in behavior + seq no longer accepts 0 value as increment argument. + stat now outputs nanosecond information for time stamps even if they are out of localtime range. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 45706bd..6b70635 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -17422,6 +17422,8 @@ even when @var{first} is larger than @var{last}. The sequence of numbers ends when the sum of the current number and @var{increment} would become greater than @var{last}, so @code{seq 1 10 10} only produces @samp{1}. +@var{increment} must not be @samp{0}; use @command{yes} to get +repeated output of a constant number. Floating-point numbers may be specified. @xref{Floating point}. The program accepts the following options. Also see @ref{Common options}. diff --git a/src/seq.c b/src/seq.c index fbb94a0..91cf625 100644 --- a/src/seq.c +++ b/src/seq.c @@ -92,6 +92,7 @@ INCREMENT would become greater than LAST.\n\ FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\ INCREMENT is usually positive if FIRST is smaller than LAST, and\n\ INCREMENT is usually negative if FIRST is greater than LAST.\n\ +INCREMENT must not be 0.\n\ "), stdout); fputs (_("\ FORMAT must be suitable for printing one argument of type 'double';\n\ @@ -635,6 +636,13 @@ main (int argc, char **argv) if (optind < argc) { step = last; + if (step.value == 0) + { + error (0, 0, _("invalid Zero increment value: %s"), + quote (argv[optind-1])); + usage (EXIT_FAILURE); + } + last = scan_arg (argv[optind++]); } } diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index 6564415..ac0664f 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -25,6 +25,7 @@ use strict; my $prog = 'seq'; my $try_help = "Try '$prog --help' for more information.\n"; +my $err_inc_zero = "seq: invalid Zero increment value: '0'\n".$try_help; my $locale = $ENV{LOCALE_FR_UTF8}; ! defined $locale || $locale eq 'none' @@ -151,6 +152,15 @@ my @Tests = ['fast-1', qw(4), {OUT => [qw(1 2 3 4)]}], ['fast-2', qw(1 4), {OUT => [qw(1 2 3 4)]}], ['fast-3', qw(1 1 4), {OUT => [qw(1 2 3 4)]}], + + # Ensure an INCREMENT of Zero is rejected. + ['inc-zero-1', qw(1 0 10), {EXIT => 1}, {ERR => $err_inc_zero}], + ['inc-zero-2', qw(0 -0 0), {EXIT => 1}, {ERR => $err_inc_zero}, + {ERR_SUBST => 's/-0/0/'}], + ['inc-zero-3', qw(1 0.0 10), {EXIT => 1},{ERR => $err_inc_zero}, + {ERR_SUBST => 's/0.0/0/'}], + ['inc-zero-4', qw(1 -0.0e-10 10), {EXIT => 1},{ERR => $err_inc_zero}, + {ERR_SUBST => 's/-0\.0e-10/0/'}], ); # Append a newline to each entry in the OUT array. -- 2.1.4 --------------090608020001070805090502 Content-Type: text/x-patch; name="0002-seq-do-not-allow-NaN-arguments.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-seq-do-not-allow-NaN-arguments.patch" >From 9a2e8ac489d7f7b2af4e1468f6174db9106eb9e4 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 14 Apr 2016 12:39:28 +0200 Subject: [PATCH 2/2] seq: do not allow NaN arguments * src/seq.c (isnan): Define macro. (scan_arg): Add check if the given argument is NaN, and exit with a proper error diagnostic in such a case. (usage): Document it. * tests/misc/seq.pl: Add tests. * doc/coreutils.texi (seq invocation): Document the change. * NEWS (Changes in behavior): Mention the change. --- NEWS | 3 ++- doc/coreutils.texi | 1 + src/seq.c | 14 ++++++++++++-- tests/misc/seq.pl | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 13af702..4cb5caf 100644 --- a/NEWS +++ b/NEWS @@ -17,7 +17,8 @@ GNU coreutils NEWS -*- outline -*- ** Changes in behavior - seq no longer accepts 0 value as increment argument. + seq no longer accepts 0 value as increment, and now also rejects NaN + values for any argument. stat now outputs nanosecond information for time stamps even if they are out of localtime range. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 6b70635..5630201 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -17424,6 +17424,7 @@ The sequence of numbers ends when the sum of the current number and so @code{seq 1 10 10} only produces @samp{1}. @var{increment} must not be @samp{0}; use @command{yes} to get repeated output of a constant number. +@var{first}, @var{increment} and @var{last} must not be @code{NaN}. Floating-point numbers may be specified. @xref{Floating point}. The program accepts the following options. Also see @ref{Common options}. diff --git a/src/seq.c b/src/seq.c index 91cf625..de92bc2 100644 --- a/src/seq.c +++ b/src/seq.c @@ -27,11 +27,14 @@ #include "quote.h" #include "xstrtod.h" -/* Roll our own isfinite rather than using , so that we don't +/* Roll our own isfinite/isnan rather than using , so that we don't have to worry about linking -lm just for isfinite. */ #ifndef isfinite # define isfinite(x) ((x) * 0 == 0) #endif +#ifndef isnan +# define isnan(x) ((x) != (x)) +#endif /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "seq" @@ -92,7 +95,7 @@ INCREMENT would become greater than LAST.\n\ FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\ INCREMENT is usually positive if FIRST is smaller than LAST, and\n\ INCREMENT is usually negative if FIRST is greater than LAST.\n\ -INCREMENT must not be 0.\n\ +INCREMENT must not be 0; none of FIRST, INCREMENT and LAST may be NaN.\n\ "), stdout); fputs (_("\ FORMAT must be suitable for printing one argument of type 'double';\n\ @@ -144,6 +147,13 @@ scan_arg (const char *arg) usage (EXIT_FAILURE); } + if (isnan (ret.value)) + { + error (0, 0, _("invalid %s argument: %s"), quote_n (0, "not-a-number"), + quote_n (1, arg)); + usage (EXIT_FAILURE); + } + /* We don't output spaces or '+' so don't include in width */ while (isspace (to_uchar (*arg)) || *arg == '+') arg++; diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index ac0664f..130bbf3 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -26,6 +26,7 @@ use strict; my $prog = 'seq'; my $try_help = "Try '$prog --help' for more information.\n"; my $err_inc_zero = "seq: invalid Zero increment value: '0'\n".$try_help; +my $err_nan_arg = "seq: invalid 'not-a-number' argument: 'nan'\n".$try_help; my $locale = $ENV{LOCALE_FR_UTF8}; ! defined $locale || $locale eq 'none' @@ -161,6 +162,22 @@ my @Tests = {ERR_SUBST => 's/0.0/0/'}], ['inc-zero-4', qw(1 -0.0e-10 10), {EXIT => 1},{ERR => $err_inc_zero}, {ERR_SUBST => 's/-0\.0e-10/0/'}], + + # Ensure NaN arguments rejected. + ['nan-first-1', qw(nan), {EXIT => 1}, {ERR => $err_nan_arg}], + ['nan-first-2', qw(NaN 2), {EXIT => 1}, {ERR => $err_nan_arg}, + {ERR_SUBST => 's/NaN/nan/'}], + ['nan-first-3', qw(nan 1 2), {EXIT => 1}, {ERR => $err_nan_arg}], + ['nan-first-4', qw(-- -nan), {EXIT => 1}, {ERR => $err_nan_arg}, + {ERR_SUBST => 's/-nan/nan/'}], + ['nan-inc-1', qw(1 nan 2), {EXIT => 1}, {ERR => $err_nan_arg}], + ['nan-inc-2', qw(1 -NaN 2), {EXIT => 1}, {ERR => $err_nan_arg}, + {ERR_SUBST => 's/-NaN/nan/'}], + ['nan-last-1', qw(1 1 nan), {EXIT => 1}, {ERR => $err_nan_arg}], + ['nan-last-2', qw(1 NaN), {EXIT => 1}, {ERR => $err_nan_arg}, + {ERR_SUBST => 's/NaN/nan/'}], + ['nan-last-3', qw(0 -1 -NaN), {EXIT => 1}, {ERR => $err_nan_arg}, + {ERR_SUBST => 's/-NaN/nan/'}], ); # Append a newline to each entry in the OUT array. -- 2.1.4 --------------090608020001070805090502-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 12:47:45 2016 Received: (at 23110) by debbugs.gnu.org; 14 Apr 2016 16:47:45 +0000 Received: from localhost ([127.0.0.1]:35540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkQj-0000xZ-0U for submit@debbugs.gnu.org; Thu, 14 Apr 2016 12:47:45 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:39343) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkQh-0000xR-A2 for 23110@debbugs.gnu.org; Thu, 14 Apr 2016 12:47:43 -0400 Received: from [192.168.1.80] (unknown [109.79.79.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 227C216A; Thu, 14 Apr 2016 17:47:40 +0100 (IST) Subject: Re: bug#23110: seq apparent bug To: Bernhard Voelker , Ruediger Meier , 23110@debbugs.gnu.org, Paul Eggert References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5706A468.1060107@draigBrady.com> <570FC75F.4080602@bernhard-voelker.de> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <570FC9AB.1070901@draigBrady.com> Date: Thu, 14 Apr 2016 17:47:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <570FC75F.4080602@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23110 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: 0.0 (/) The 2 patches look good. On 14/04/16 17:37, Bernhard Voelker wrote: >> > seq 1 .0000000000000000000000000000001 1 > I consider this a bug in seq: from mathematical point of view, the above > should just output "1" and then exit, because after adding that tiny number > the next number would be greater than LAST. right > IMO we should enhance seq_fast() to do all the Math when no special > output format is given. > WDYT? It would be good to expand seq_fast to more cases. thanks! Pádraig From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 13:19:50 2016 Received: (at 23110) by debbugs.gnu.org; 14 Apr 2016 17:19:50 +0000 Received: from localhost ([127.0.0.1]:35586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkvm-0001nM-OP for submit@debbugs.gnu.org; Thu, 14 Apr 2016 13:19:50 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:62376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqkvl-0001n9-CR for 23110@debbugs.gnu.org; Thu, 14 Apr 2016 13:19:49 -0400 Received: from [192.168.101.10] ([217.86.64.216]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0LuGZT-1boGG32fQ7-011mhC; Thu, 14 Apr 2016 19:19:32 +0200 Subject: Re: bug#23110: seq apparent bug To: =?UTF-8?Q?P=c3=a1draig_Brady?= , Ruediger Meier , 23110@debbugs.gnu.org, Paul Eggert References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5706A468.1060107@draigBrady.com> <570FC75F.4080602@bernhard-voelker.de> <570FC9AB.1070901@draigBrady.com> From: Bernhard Voelker Message-ID: <570FD122.3050902@bernhard-voelker.de> Date: Thu, 14 Apr 2016 19:19:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <570FC9AB.1070901@draigBrady.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:S4z9IsMt1wJNKHwk+jdGxUes0JXmZm19bMx/O7L+PKgj+9RY6Oi jnqNRiV6dvz9q0/9IExlRR5jq+O1+g0MnzK0gtlCjoc89ASYUiIMBJQfTnE4XPGFKMWcvfc Vxe97N2de9g/eG9ph3fao0+r8q+HFWwTlgMFOCAwWdaBENd0B96AaSZC1wGmVFe70UFcPTx kGTBkp6HaYUwI/N5GVazg== X-UI-Out-Filterresults: notjunk:1;V01:K0:WutiZdRumiE=:IYiRf+s9sRXWk/6cKp7q/w 4/fKr1p2CGfgPvOCYXrzwtGq2vyqsNZkAo6FcJF/W/S2Hzzz3IDYMm4qWGGurMCakdnvwAy7F 1XAI0xOLtSsfSHK+V6IwDz/7eNiTQvjG5H01tOdCVA4hBkvklNo+EdHlvE9p+Y6b5PSyZwmXw y1c39Py5EzKjgFN1b9O54WOIEQHj/ChEyV1Lsh5ssg1BwaUMh7FnDC5VRYbylUYkSo5cwE3h5 UeSJ59LUP3O2K8meYCH6oWzWBV9ejWSh1ewBzKeYH/7HsCtMtyBY/EyrotpNqgRo3HnMNGDeZ LW+hVcVNArIw4ymv01wv66TUGe8XPTbGUfk1/9zK0HrPnIQebklhIirmbOTRhANPnfwatB90R K612wYhmFaWOQquW+kPY2bv2ZR6nOKTJANmUa9HRlMgTggsv9BUYYnpavdzxjOJf/MGIwvluj +Bs4lf6CqV6p5xE8Z1RfTyGK15CtELDWmeWUYW5JCDhITmENI3F7bmNc9Gij9fnQPQx3/4wk/ O/ZmPW33c8VTcYw3VI0UP1Y2u0z1LvxCyJ3+qwJXDA/8MkHHQanIu5ScEzMvblCn1awNiSzn3 fZC9Etf+SoUZx72cejiW0FOcjRegWWeWQYr9OVyEcj1FSo4imXDQzapOMg8oDbOIOFBW/IB48 FkN31359YSXKuuObzQpzoqKwW+KBwY2CCBzL3eg2NkIXPrcuX4V88wtNp0QxVCxU/PVE8QlOB Aa9t/CSBL4y9wlmk X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23110 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: -0.7 (/) On 04/14/2016 06:47 PM, Pádraig Brady wrote: > The 2 patches look good. thanks for the review, pushed. > On 14/04/16 17:37, Bernhard Voelker wrote: >>>> seq 1 .0000000000000000000000000000001 1 >> I consider this a bug in seq: from mathematical point of view, the above >> should just output "1" and then exit, because after adding that tiny number >> the next number would be greater than LAST. > > right > >> IMO we should enhance seq_fast() to do all the Math when no special >> output format is given. >> WDYT? > > It would be good to expand seq_fast to more cases. I'll try to come up with something (which may take some time). Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 27 18:06:21 2018 Received: (at 23110) by debbugs.gnu.org; 27 Oct 2018 22:06:21 +0000 Received: from localhost ([127.0.0.1]:45913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGWip-0006lu-5o for submit@debbugs.gnu.org; Sat, 27 Oct 2018 18:06:21 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:45771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGWil-0006lW-AG; Sat, 27 Oct 2018 18:06:16 -0400 Received: by mail-pl1-f177.google.com with SMTP id o19-v6so2031690pll.12; Sat, 27 Oct 2018 15:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=gyqInpSv5Lbf/2keTP//Iw3BZajdAETfp7Ub8Bh81yM=; b=mLtkzI4qD57A6+W6z1Wr1WkIyVaZdbpVeC+nAcAqy0QwyJ3zromdcvHZIaY4+5Q4XM 3GXnJbsA08UAYMpbnqW4QWtRVL4msqWH46OS6Y4aYCbr/0gTmL8ipSR9EaqQmUDiYZYA VjgxL+qnZlLiPAxL66OlpCjOIpYnKxt2mjglTTbxXYPw9/XxWVYO3DpKqC31EIMwkShV Em1rYRjGjtp0ho4GTihpaomeDm0IRnrwordtD5gv8HgVtZXQ+5AYX7AxHdahsN3uz1KB E+gzLPLHFjzh/gf4Tg7LGRfwcnPN04gaCwwuO8RzwxEnT69dH06m9HbjmrO1I+/+aj3/ KSyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gyqInpSv5Lbf/2keTP//Iw3BZajdAETfp7Ub8Bh81yM=; b=qxO6i5n6d0G2058yuGZ2nQ1nwzM5x/ZKsqy2JxUhoTA9/WqMGU4QDQW886YDfHp1k8 UaWEdhs4zg6o4YyymbYtB4BxLsjW/G4uQdjD2nY3LMPSbNoNE2c6bM+8TtjUEO0jkwys MNohBBoRSQnHCxPZJrZPqifCWtwz/nQB9yIFGg63ETS5CvkyLbcnS5y2ktVWYv1pRACw RCPeY5WXuYLQKBbzYiSALTCEWPrzaiSYDP+QLQxZCoN1/Ox3Cj3MXmBbK5EqVBfstGlx quby40RJCk5+HrSh/CD+P0BcMLMWCDrA0iRYLw0vqQK6wTpZioyCFhDsGnj4Er9u5cAS rGHg== X-Gm-Message-State: AGRZ1gJwoFEi8N2e6r/bMu0SvOzEWS7IF217UOJAT74RIpSShq7/DAXL AfbBrNjVJ2dhKI0zL7N3TLO3qHhl X-Google-Smtp-Source: AJdET5fKY40j7UGxJ2TaFH64vjBMhTL8/wHYjyivCykMeWw495tHeZuFkLfqK43pPZ5rDS5NCGhojg== X-Received: by 2002:a17:902:6907:: with SMTP id j7-v6mr8579372plk.232.1540677969099; Sat, 27 Oct 2018 15:06:09 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id h14-v6sm18906156pfn.80.2018.10.27.15.06.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 15:06:07 -0700 (PDT) Subject: Re: bug#23110: seq apparent bug To: 23110@debbugs.gnu.org References: <1458833312.301435744@f347.i.mail.ru> <201604062019.29435.sweet_f_a@gmx.de> <5706220B.4040809@bernhard-voelker.de> <201604071146.11270.sweet_f_a@gmx.de> <5706716E.6030105@bernhard-voelker.de> <5706A468.1060107@draigBrady.com> <570FC75F.4080602@bernhard-voelker.de> <570FC9AB.1070901@draigBrady.com> <570FD122.3050902@bernhard-voelker.de> From: Assaf Gordon Message-ID: Date: Sat, 27 Oct 2018 16:06:06 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <570FD122.3050902@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23110 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 23110 fixed close 23110 stop (triaging old bugs) On 2016-04-14 11:19 a.m., Bernhard Voelker wrote: > On 04/14/2016 06:47 PM, Pádraig Brady wrote: >> The 2 patches look good. > > thanks for the review, pushed. > closing as "fixed". -assaf From unknown Sun Jun 22 07:52: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: Sun, 25 Nov 2018 12: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