From unknown Sat Aug 16 13:03:54 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13525 <13525@debbugs.gnu.org> To: bug#13525 <13525@debbugs.gnu.org> Subject: Status: 8.20 - [seq 1 3 1] treated as [seq 1 3] Reply-To: bug#13525 <13525@debbugs.gnu.org> Date: Sat, 16 Aug 2025 20:03:54 +0000 retitle 13525 8.20 - [seq 1 3 1] treated as [seq 1 3] reassign 13525 coreutils submitter 13525 "Marcel B=C3=B6hme" severity 13525 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 05:44:34 2013 Received: (at submit) by debbugs.gnu.org; 22 Jan 2013 10:44:34 +0000 Received: from localhost ([127.0.0.1]:44178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxbLF-0002uI-IV for submit@debbugs.gnu.org; Tue, 22 Jan 2013 05:44:34 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35115) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxbLD-0002uB-Kv for submit@debbugs.gnu.org; Tue, 22 Jan 2013 05:44:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxbK3-0001ng-H4 for submit@debbugs.gnu.org; Tue, 22 Jan 2013 05:43:23 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:39038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxbK3-0001nV-E4 for submit@debbugs.gnu.org; Tue, 22 Jan 2013 05:43:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxbK2-0007jd-EP for bug-coreutils@gnu.org; Tue, 22 Jan 2013 05:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxbK1-0001mo-3r for bug-coreutils@gnu.org; Tue, 22 Jan 2013 05:43:18 -0500 Received: from mout.web.de ([212.227.17.11]:62343) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxbK0-0001mO-RD for bug-coreutils@gnu.org; Tue, 22 Jan 2013 05:43:17 -0500 Received: from 3capp-webde-bs42.server.lan ([172.19.170.42]) by mriweb.server.lan (mriweb001) with ESMTPA (Nemesis) id 0MV0q3-1TPg6x0eir-00YZko for ; Tue, 22 Jan 2013 11:43:14 +0100 Received: from [137.132.192.186] by 3capp-webde-bs42.server.lan with HTTP; Tue Jan 22 11:43:14 CET 2013 MIME-Version: 1.0 Message-ID: From: =?UTF-8?Q?=22Marcel_B=C3=B6hme=22?= To: bug-coreutils@gnu.org Subject: 8.20 - [seq 1 3 1] treated as [seq 1 3] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Jan 2013 11:43:14 +0100 (CET) Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K0:u5PxTsWvJ+iRi7BAY0wSnKWj3ES7a8ZnNqMcHtT2xFq 5Htcs9F/rxDZWlYtL3SxqjHNtMn//O90Kk23/FFwFbY33a2Vou bnQhLdniBIa26qB76z5fZB5aXKOKgVbfAzR63zA805wdgf15lT Q9Fh9wXdF6ku38n2H7qjdz8I/4/qZVqxmjQD2gLuQFBGKrntgn udxCAFFckx0vF+oK4tpnKFCscJdW/9uIzPo8WAOYH762H/VTmi uneuQuWVFtBZBPe0zZMjXSHikeD1iid79AurY5viMkdGe9UJQH yQ04j/aSFU6mzoVTus63Zn14aUi X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Dear all, There is another bug that sneaked into the speed patch of seq o= n 13.09.12: 560=C2=A0=C2=A0 if (all_digits_p (argv[optind]) 561=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 && (n_args =3D=3D 1 || all_digits_p (argv[optin= d + 1])) 562=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && (n_args < 3 || STREQ ("= 1", argv[optind + 2])) 563=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && !equal_wi= dth && !format_str && strlen (separator) =3D=3D 1) That should probably be= : 560 if (all_digits_p (argv[optind]) 561 && (n_args =3D=3D 1 || al= l_digits_p (argv[optind + 1])) 562 && (n_args < 3 || STREQ ("1", argv= [optind + 1])) 563 && !equal_width && !format_str && strlen (separato= r) =3D=3D 1) Best regards, Marcel From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 06:24:37 2013 Received: (at 13525-done) by debbugs.gnu.org; 22 Jan 2013 11:24:37 +0000 Received: from localhost ([127.0.0.1]:44217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txby0-0003rV-3i for submit@debbugs.gnu.org; Tue, 22 Jan 2013 06:24:37 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:45776) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txbxx-0003rJ-QJ for 13525-done@debbugs.gnu.org; Tue, 22 Jan 2013 06:24:35 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUBAGd1/lBtTa7u/2dsb2JhbAANN4N1glCFXLIngxEBAQEEI1YQCw0EAwECAQkhAgIPAj4IBgoDAQUCAQEWiAapA3CCQI8okCOBEwOPCIgghHGFLYgE Received: from unknown (HELO [192.168.1.79]) ([109.77.174.238]) by mail2.vodafone.ie with ESMTP; 22 Jan 2013 11:23:23 +0000 Message-ID: <50FE76AA.707@draigBrady.com> Date: Tue, 22 Jan 2013 11:23:22 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: =?UTF-8?B?TWFyY2VsIELDtmhtZQ==?= Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------050909010408050507020002" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13525-done Cc: 13525-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This is a multi-part message in MIME format. --------------050909010408050507020002 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 01/22/2013 10:43 AM, Marcel Böhme wrote: > > Dear all, > > There is another bug that sneaked into the speed patch of seq on 13.09.12: > > 560 if (all_digits_p (argv[optind]) > 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) > 562 && (n_args < 3 || STREQ ("1", argv[optind + 2])) > 563 && !equal_width && !format_str && strlen (separator) == 1) > > That should probably be: > 560 if (all_digits_p (argv[optind]) > 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) > 562 && (n_args < 3 || STREQ ("1", argv[optind + 1])) > 563 && !equal_width && !format_str && strlen (separator) == 1) Sigh we really messed up seq in that release :( The attached should fix it: I also notice another regression, which I'll fix in a moment. $ seq 0 1 0 0 1 thanks, Pádraig. --------------050909010408050507020002 Content-Type: text/x-patch; name="seq-ignored-step.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="seq-ignored-step.diff" >From 8855d835bdfc69c111790d7aea91a78097640023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 22 Jan 2013 11:13:16 +0000 Subject: [PATCH] seq: fix to always honor the step value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/seq.c (main): With 3 positive integer args we were checking the end value was == "1", rather than the step value. * tests/misc/seq.pl: Add a test foro this case. Reported by Marcel Böhme in http://bugs.gnu.org/13525 --- NEWS | 3 ++- src/seq.c | 2 +- tests/misc/seq.pl | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 46d1aba..5b1a5f1 100644 --- a/NEWS +++ b/NEWS @@ -49,7 +49,8 @@ GNU coreutils NEWS -*- outline -*- seq -s no longer prints an erroneous newline after the first number, and outputs a newline after the last number rather than a trailing separator. - [bug introduced in coreutils-8.20] + Also seq no longer ignores a specified step value. + [bugs introduced in coreutils-8.20] ** Changes in behavior diff --git a/src/seq.c b/src/seq.c index e1b467c..7ac94b9 100644 --- a/src/seq.c +++ b/src/seq.c @@ -559,7 +559,7 @@ main (int argc, char **argv) then use the much more efficient integer-only code. */ if (all_digits_p (argv[optind]) && (n_args == 1 || all_digits_p (argv[optind + 1])) - && (n_args < 3 || STREQ ("1", argv[optind + 2])) + && (n_args < 3 || STREQ ("1", argv[optind + 1])) && !equal_width && !format_str && strlen (separator) == 1) { char const *s1 = n_args == 1 ? "1" : argv[optind]; diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index 40a7571..93a71bd 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -133,6 +133,10 @@ my @Tests = ['sep-1', qw(-s, 1 3), {OUT => [qw(1,2,3)]}], ['sep-2', qw(-s, 1 1), {OUT => [qw(1)]}], ['sep-3', qw(-s,, 1 3), {OUT => [qw(1,,2,,3)]}], + + # Exercise a step value != 1, with positive integer start and end, + # which was broken in 8.20 + ['step-1', qw(1 3 1), {OUT => [qw(1)]}], ); # Append a newline to each entry in the OUT array. -- 1.7.6.4 --------------050909010408050507020002-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 07:18:01 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 12:18:02 +0000 Received: from localhost ([127.0.0.1]:44275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txcnh-0005EE-FJ for submit@debbugs.gnu.org; Tue, 22 Jan 2013 07:18:01 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:60552) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txcnf-0005E6-8S for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 07:18:00 -0500 Received: by mail-la0-f52.google.com with SMTP id fs12so324714lab.25 for <13525@debbugs.gnu.org>; Tue, 22 Jan 2013 04:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=EyfNLnoCYhfDK7tkSAXm1IgZa7OGnspG6zoNRBaYxag=; b=HAYAiV8EIJfmWNUgPwAts+TJAX0/TzAcDSir3e75Qtc3v+3nt8ZxsAGQFuQCfIOdyh Upo05DArC6DIglW/IWWud3wMaV6LjxixhPz5YCZjcB4DcrUKmi4KDg9XhOsq/ayqBkeu 0zMX6NCTGf+FbZ25/gh1DJimcX7UTDH+FFJvFyq/bY02JcpLjyqHR0xyVYijWqzwP9Ny g5Lnjp7Xk7nkXfJ0Fwwmj9lqNqqL2+Wp+FtMKomPE5tpxPdd/ooBuCGaGVlltgyB66hI aSYb8otI3z/Gu7mBk1AgmeqCefQcomzU/Hl1OVIAkjWW4xeUxQWT6FK9gXfVXxE5MS/e S0xA== X-Received: by 10.152.114.42 with SMTP id jd10mr21029140lab.31.1358857009230; Tue, 22 Jan 2013 04:16:49 -0800 (PST) Received: from [192.168.178.21] (host137-94-dynamic.4-87-r.retail.telecomitalia.it. [87.4.94.137]) by mx.google.com with ESMTPS id hc20sm6858510lab.11.2013.01.22.04.16.47 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jan 2013 04:16:48 -0800 (PST) Message-ID: <50FE832D.7080102@gmail.com> Date: Tue, 22 Jan 2013 13:16:45 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: 13525@debbugs.gnu.org, P@draigBrady.com, hawkie@web.de Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> In-Reply-To: <50FE76AA.707@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13525 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 01/22/2013 12:23 PM, Pádraig Brady wrote: > On 01/22/2013 10:43 AM, Marcel Böhme wrote: >> >> Dear all, >> >> There is another bug that sneaked into the speed patch of seq on 13.09.12: >> >> 560 if (all_digits_p (argv[optind]) >> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >> 562 && (n_args < 3 || STREQ ("1", argv[optind + 2])) >> 563 && !equal_width && !format_str && strlen (separator) == 1) >> >> That should probably be: >> 560 if (all_digits_p (argv[optind]) >> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >> 562 && (n_args < 3 || STREQ ("1", argv[optind + 1])) >> 563 && !equal_width && !format_str && strlen (separator) == 1) > > Sigh we really messed up seq in that release :( > The attached should fix it: > One minor typo in commit message: > [SNIP] > > * tests/misc/seq.pl: Add a test foro this case. > s/foro/for/ Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 07:18:54 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 12:18:54 +0000 Received: from localhost ([127.0.0.1]:44278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxcoX-0005FZ-VT for submit@debbugs.gnu.org; Tue, 22 Jan 2013 07:18:54 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:56872) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxcoU-0005FP-6F for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 07:18:52 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoBAO+C/lBtTa7u/2dsb2JhbAANN4N1glCFXLIjgxEBAQEEI2YLDQQDAQIBCRYLAgIJAwIBAgE9CAcJAwYCAQEWiAapH3CCQI8ukCOBEwOPCIgghHGFLYgE Received: from unknown (HELO [192.168.1.79]) ([109.77.174.238]) by mail2.vodafone.ie with ESMTP; 22 Jan 2013 12:17:34 +0000 Message-ID: <50FE835D.9040205@draigBrady.com> Date: Tue, 22 Jan 2013 12:17:33 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: 13525@debbugs.gnu.org, hawkie@web.de Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> In-Reply-To: <50FE76AA.707@draigBrady.com> Content-Type: multipart/mixed; boundary="------------020106070600050508090200" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13525 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This is a multi-part message in MIME format. --------------020106070600050508090200 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 01/22/2013 11:23 AM, Pádraig Brady wrote: > On 01/22/2013 10:43 AM, Marcel Böhme wrote: >> >> Dear all, >> >> There is another bug that sneaked into the speed patch of seq on 13.09.12: >> >> 560 if (all_digits_p (argv[optind]) >> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >> 562 && (n_args < 3 || STREQ ("1", argv[optind + 2])) >> 563 && !equal_width && !format_str && strlen (separator) == 1) >> >> That should probably be: >> 560 if (all_digits_p (argv[optind]) >> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >> 562 && (n_args < 3 || STREQ ("1", argv[optind + 1])) >> 563 && !equal_width && !format_str && strlen (separator) == 1) > > Sigh we really messed up seq in that release :( > The attached should fix it: Updated patch attached. thanks, Pádraig. --------------020106070600050508090200 Content-Type: text/x-patch; name="seq-ignored-step.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="seq-ignored-step.diff" >From 0baac8a14451af722af100348923975cd274501c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 22 Jan 2013 11:13:16 +0000 Subject: [PATCH] seq: fix to always honor the step value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/seq.c (main): With 3 positive integer args we were checking the end value was == "1", rather than the step value. * tests/misc/seq.pl: Add tests for this case. Reported by Marcel Böhme in http://bugs.gnu.org/13525 --- NEWS | 3 ++- src/seq.c | 3 ++- tests/misc/seq.pl | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 46d1aba..73b49c3 100644 --- a/NEWS +++ b/NEWS @@ -49,7 +49,8 @@ GNU coreutils NEWS -*- outline -*- seq -s no longer prints an erroneous newline after the first number, and outputs a newline after the last number rather than a trailing separator. - [bug introduced in coreutils-8.20] + Also seq no longer ignores a specified step value when the end value is 1. + [bugs introduced in coreutils-8.20] ** Changes in behavior diff --git a/src/seq.c b/src/seq.c index e1b467c..1cd82a2 100644 --- a/src/seq.c +++ b/src/seq.c @@ -559,7 +559,8 @@ main (int argc, char **argv) then use the much more efficient integer-only code. */ if (all_digits_p (argv[optind]) && (n_args == 1 || all_digits_p (argv[optind + 1])) - && (n_args < 3 || STREQ ("1", argv[optind + 2])) + && (n_args < 3 || (STREQ ("1", argv[optind + 1]) + && all_digits_p (argv[optind + 2]))) && !equal_width && !format_str && strlen (separator) == 1) { char const *s1 = n_args == 1 ? "1" : argv[optind]; diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index 40a7571..d732546 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -133,6 +133,11 @@ my @Tests = ['sep-1', qw(-s, 1 3), {OUT => [qw(1,2,3)]}], ['sep-2', qw(-s, 1 1), {OUT => [qw(1)]}], ['sep-3', qw(-s,, 1 3), {OUT => [qw(1,,2,,3)]}], + + # Exercise fast path avoidance logic. + # In 8.20 a step value != 1, with positive integer start and end was broken + ['not-fast-1', qw(1 3 1), {OUT => [qw(1)]}], + ['not-fast-2', qw(1 1 4.2), {OUT => [qw(1 2 3 4)]}], ); # Append a newline to each entry in the OUT array. -- 1.7.6.4 --------------020106070600050508090200-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 07:29:37 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 12:29:37 +0000 Received: from localhost ([127.0.0.1]:44307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txcyq-0005We-Dh for submit@debbugs.gnu.org; Tue, 22 Jan 2013 07:29:37 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:51902) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txcyk-0005WR-DX for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 07:29:31 -0500 Received: from [192.168.1.11] (p5083F782.dip.t-dialin.net [80.131.247.130]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MZbAH-1Td4jb3DsT-00LGRS; Tue, 22 Jan 2013 13:28:14 +0100 Message-ID: <50FE85DD.80900@bernhard-voelker.de> Date: Tue, 22 Jan 2013 13:28:13 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> <50FE835D.9040205@draigBrady.com> In-Reply-To: <50FE835D.9040205@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:Zsr0z84upKcEhJrpXhh+3CaURb9q9kbWnAULjz77kOS uaAAsJACYQCE6FgqDnkXfgmTM6Ota3QM1uZakhm0mlWuyAtMG5 FWySxbaA6stMNH1QBLvaJDbl9EFvUnhV1aZaB4v5Oc7Gft75EU VCl1dA0PdsMX9cL3DdQJyR5D6GpJ6x9kkBgTC1Ali6ASFvQPLK beb4ldurPutu9Vp7MCGwOgS7jCG40+649dOoELqAiqKBQqgfYc Z9BBDSQki4J35y3cKdVEhiV3wvOuMy1MHJMBrs4IFMsH1cpeP7 zcVQMaYGWMaphG4sB2XIL8U8I/i9etjKgSrMv160wO/aSrflRj Rc5B4NqXsACfqmLY4yNq1J9RSdbbcw3DhOucQbbxI X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13525 Cc: 13525@debbugs.gnu.org, hawkie@web.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) On 01/22/2013 01:17 PM, Pádraig Brady wrote: > Updated patch attached. That one is looking good ... but while we're at it: Anyone tried this, i.e. a Zero as INCREMENT? $ seq 1 0 2 This is equal to `yes 0`. Well, this is probably a (not documented) feature, but in the following examples, the "1" should be printed only once, shouldn't it? $ seq 1 0 1 $ seq 1 0.0 1 (BTW: "seq 2 0 1" works, i.e. doesn't print anything.) Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 08:00:33 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 13:00:33 +0000 Received: from localhost ([127.0.0.1]:44352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdSq-00079B-MT for submit@debbugs.gnu.org; Tue, 22 Jan 2013 08:00:33 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:9508) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdSo-000793-9o for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 08:00:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoBAEGL/lBtTa7u/2dsb2JhbAANN4N1glCFXLIjgxEBAQEEI2YLDQQDAQIBCRYLAgIJAwIBAgE9CAcJAwYCAQEWiAapG3CCQI8mkCOBEwOPCIgghHGFLYgE Received: from unknown (HELO [192.168.1.79]) ([109.77.174.238]) by mail2.vodafone.ie with ESMTP; 22 Jan 2013 12:59:19 +0000 Message-ID: <50FE8D27.7040501@draigBrady.com> Date: Tue, 22 Jan 2013 12:59:19 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: 13525@debbugs.gnu.org, hawkie@web.de Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> <50FE835D.9040205@draigBrady.com> In-Reply-To: <50FE835D.9040205@draigBrady.com> Content-Type: multipart/mixed; boundary="------------090703090400030309020203" X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 13525 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This is a multi-part message in MIME format. --------------090703090400030309020203 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 01/22/2013 12:17 PM, Pádraig Brady wrote: > On 01/22/2013 11:23 AM, Pádraig Brady wrote: >> On 01/22/2013 10:43 AM, Marcel Böhme wrote: >>> >>> Dear all, >>> >>> There is another bug that sneaked into the speed patch of seq on 13.09.12: >>> >>> 560 if (all_digits_p (argv[optind]) >>> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >>> 562 && (n_args < 3 || STREQ ("1", argv[optind + 2])) >>> 563 && !equal_width && !format_str && strlen (separator) == 1) >>> >>> That should probably be: >>> 560 if (all_digits_p (argv[optind]) >>> 561 && (n_args == 1 || all_digits_p (argv[optind + 1])) >>> 562 && (n_args < 3 || STREQ ("1", argv[optind + 1])) >>> 563 && !equal_width && !format_str && strlen (separator) == 1) >> >> Sigh we really messed up seq in that release :( >> The attached should fix it: The seq 0 1 0 "regression" was only because I didn't adjust for the parameters passed into seq_fast. So hopefully this update caters for all cases. thanks, Pádraig. --------------090703090400030309020203 Content-Type: text/x-patch; name="seq-ignored-step.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="seq-ignored-step.diff" >From 98a1ebe873e318dcc94ebb984ef496329d349f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 22 Jan 2013 11:13:16 +0000 Subject: [PATCH] seq: fix to always honor the step value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/seq.c (main): With 3 positive integer args we were checking the end value was == "1", rather than the step value. * tests/misc/seq.pl: Add tests for this case. Reported by Marcel Böhme in http://bugs.gnu.org/13525 --- NEWS | 3 ++- src/seq.c | 5 +++-- tests/misc/seq.pl | 11 +++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 46d1aba..73b49c3 100644 --- a/NEWS +++ b/NEWS @@ -49,7 +49,8 @@ GNU coreutils NEWS -*- outline -*- seq -s no longer prints an erroneous newline after the first number, and outputs a newline after the last number rather than a trailing separator. - [bug introduced in coreutils-8.20] + Also seq no longer ignores a specified step value when the end value is 1. + [bugs introduced in coreutils-8.20] ** Changes in behavior diff --git a/src/seq.c b/src/seq.c index e1b467c..22126a2 100644 --- a/src/seq.c +++ b/src/seq.c @@ -559,11 +559,12 @@ main (int argc, char **argv) then use the much more efficient integer-only code. */ if (all_digits_p (argv[optind]) && (n_args == 1 || all_digits_p (argv[optind + 1])) - && (n_args < 3 || STREQ ("1", argv[optind + 2])) + && (n_args < 3 || (STREQ ("1", argv[optind + 1]) + && all_digits_p (argv[optind + 2]))) && !equal_width && !format_str && strlen (separator) == 1) { char const *s1 = n_args == 1 ? "1" : argv[optind]; - char const *s2 = n_args == 1 ? argv[optind] : argv[optind + 1]; + char const *s2 = argv[optind + (n_args - 1)]; if (seq_fast (s1, s2)) exit (EXIT_SUCCESS); diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl index 40a7571..205c4d2 100755 --- a/tests/misc/seq.pl +++ b/tests/misc/seq.pl @@ -133,6 +133,17 @@ my @Tests = ['sep-1', qw(-s, 1 3), {OUT => [qw(1,2,3)]}], ['sep-2', qw(-s, 1 1), {OUT => [qw(1)]}], ['sep-3', qw(-s,, 1 3), {OUT => [qw(1,,2,,3)]}], + + # Exercise fast path avoidance logic. + # In 8.20 a step value != 1, with positive integer start and end was broken + ['not-fast-1', qw(1 3 1), {OUT => [qw(1)]}], + ['not-fast-2', qw(1 1 4.2), {OUT => [qw(1 2 3 4)]}], + ['not-fast-3', qw(1 1 0)], + + # Ensure the correct parameters are passed to the fast path + ['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)]}], ); # Append a newline to each entry in the OUT array. -- 1.7.6.4 --------------090703090400030309020203-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 08:25:46 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 13:25:46 +0000 Received: from localhost ([127.0.0.1]:44371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdrE-0007ik-J7 for submit@debbugs.gnu.org; Tue, 22 Jan 2013 08:25:46 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:52029) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdrA-0007ib-Oi for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 08:25:42 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBANaR/lBtTa7u/2dsb2JhbAANN4ZFtA6DcoMRAQEBBCMPAQVBEAsNAQoCAgUWCwICCQMCAQIBRQYNAQcBAbFCcIJAjyyBI48AgRMDnBmNMQ Received: from unknown (HELO [192.168.1.79]) ([109.77.174.238]) by mail2.vodafone.ie with ESMTP; 22 Jan 2013 13:24:30 +0000 Message-ID: <50FE930E.4060900@draigBrady.com> Date: Tue, 22 Jan 2013 13:24:30 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Bernhard Voelker Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> <50FE835D.9040205@draigBrady.com> <50FE85DD.80900@bernhard-voelker.de> In-Reply-To: <50FE85DD.80900@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13525 Cc: 13525@debbugs.gnu.org, hawkie@web.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) On 01/22/2013 12:28 PM, Bernhard Voelker wrote: > On 01/22/2013 01:17 PM, Pádraig Brady wrote: >> Updated patch attached. > > That one is looking good ... but while we're at it: > > Anyone tried this, i.e. a Zero as INCREMENT? > > $ seq 1 0 2 > > This is equal to `yes 0`. Well, this is probably a (not > documented) feature, but in the following examples, the "1" > should be printed only once, shouldn't it? > > $ seq 1 0 1 > $ seq 1 0.0 1 > > (BTW: "seq 2 0 1" works, i.e. doesn't print anything.) Yes I was wondering that myself. Though I suppose that `seq 0 0 1` prints endlessly, means that it's consistent that as long as start <= end and step == 0, then start is printed endlessly. Maybe we should special case to only print the start value once if step = 0. Maybe one could use a step of 0 to hack a min/max function or something? min() { minv=$(seq "$1" 0 "$2"); : ${minv:="$2"}; echo $minv; } max() { minv=$(seq "$1" 0 "$2"); : ${maxv:="$1"}; echo $maxv; } Though I'm stretching here as that could be done (albeit with 3 processes) like: min() { printf '%s\n' "$@" | sort -rg | tail -n1; } max() { printf '%s\n' "$@" | sort -g | tail -n1; } cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 08:48:15 2013 Received: (at 13525) by debbugs.gnu.org; 22 Jan 2013 13:48:15 +0000 Received: from localhost ([127.0.0.1]:44413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxeD1-0008J6-75 for submit@debbugs.gnu.org; Tue, 22 Jan 2013 08:48:15 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:56017) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxeCz-0008Iz-4J for 13525@debbugs.gnu.org; Tue, 22 Jan 2013 08:48:14 -0500 Received: from [192.168.1.11] (p5083F782.dip.t-dialin.net [80.131.247.130]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MIezY-1TvRGf4904-002DVN; Tue, 22 Jan 2013 14:47:02 +0100 Message-ID: <50FE9855.6080705@bernhard-voelker.de> Date: Tue, 22 Jan 2013 14:47:01 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= Subject: Re: bug#13525: 8.20 - [seq 1 3 1] treated as [seq 1 3] References: <50FE76AA.707@draigBrady.com> <50FE835D.9040205@draigBrady.com> <50FE85DD.80900@bernhard-voelker.de> <50FE930E.4060900@draigBrady.com> In-Reply-To: <50FE930E.4060900@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:jiM8d/wkkIvIHxpIN3XlkIH/b+ARS5bT683oaY9mZXv iYJoWdc0+4o+7CYJRml/tL9aDzf9xGrBNe6YAD0D2bLTIxgH2I Kzgmvh80lOwXx+VHdI6nfQgwtYT/dikKdeH4ivJnfy3rrOsJPe SJ3lA86Zun7SoVFLBWQGzVBiVFcFw6VxY9r8CTgB0D5fuEOyaX 0sT/F+X3uy3R0HnJf3B95Pi5iGuod1jUPp16RC+FEtztUSJWcf P76GhubFAeBs+fekH8qzOuqcGqjWGkgDUq6eB2QQjtJojtSjnA Hws4m4XuOghNRszZMdoXkET47B4VaZAglUNC6wv77CLMUl9UCt cMP3KPA+5iP448MwiU/z0nvqm7FzssT/OpndKF5Y9 X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13525 Cc: 13525@debbugs.gnu.org, hawkie@web.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) On 01/22/2013 02:24 PM, Pádraig Brady wrote: > Yes I was wondering that myself. > > Though I suppose that `seq 0 0 1` prints endlessly, > means that it's consistent that as long as start <= end > and step == 0, then start is printed endlessly. Yes, from a mathematical point of view, seq is right. Therefore, maybe documenting seq's behavior would suffice. OTOH ... > Maybe we should special case to only print > the start value once if step = 0. ... users may not be amused about an endless loop in a tool which is otherwise meant for counting, e.g. $ seq $start $step $last | \ while read x ; do work_on $s ; done Stopping after the start valie is maybe not mathematically correct, but more "natural". > Maybe one could use a step of 0 to hack a > min/max function or something? > > min() { minv=$(seq "$1" 0 "$2"); : ${minv:="$2"}; echo $minv; } > max() { minv=$(seq "$1" 0 "$2"); : ${maxv:="$1"}; echo $maxv; } TBH this doesn't look like as if a normal user would be able to invent this. ;-) Have a nice day, Berny From unknown Sat Aug 16 13:03:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Feb 2013 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