From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 25 20:19:07 2011 Received: (at submit) by debbugs.gnu.org; 26 Jan 2011 01:19:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Phu2M-0003bs-I8 for submit@debbugs.gnu.org; Tue, 25 Jan 2011 20:19:07 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Phttv-0003Pm-8w for submit@debbugs.gnu.org; Tue, 25 Jan 2011 20:10:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Phu1k-0000CJ-B4 for submit@debbugs.gnu.org; Tue, 25 Jan 2011 20:18:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:44788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Phu1j-0000C5-RP for submit@debbugs.gnu.org; Tue, 25 Jan 2011 20:18:28 -0500 Received: from [140.186.70.92] (port=44303 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Phu1i-0004Ks-0c for bug-coreutils@gnu.org; Tue, 25 Jan 2011 20:18:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Phu1g-0000Bb-Kb for bug-coreutils@gnu.org; Tue, 25 Jan 2011 20:18:25 -0500 Received: from nfitmail.nfit.au.dk ([130.225.31.129]:39134 helo=smtp.nfit.au.dk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Phu1g-0000BL-Ed for bug-coreutils@gnu.org; Tue, 25 Jan 2011 20:18:24 -0500 Received: from smtp.nfit.au.dk (localhost [127.0.0.1]) by smtp.nfit.au.dk (Postfix) with ESMTP id 97AC8572BA for ; Wed, 26 Jan 2011 02:18:20 +0100 (CET) Received: from [10.0.0.2] (1407ds3-arsy.0.fullrate.dk [95.166.154.201]) by smtp.nfit.au.dk (Postfix) with ESMTPSA id 6F1A5571CC for ; Wed, 26 Jan 2011 02:18:20 +0100 (CET) Message-ID: <4D3F765B.3010006@molgaard.org> Date: Wed, 26 Jan 2011 02:18:19 +0100 From: =?ISO-8859-1?Q?Sune_M=F8lgaard?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b10pre) Gecko/20110119 Firefox/4.0b10pre SeaMonkey/2.1b2pre MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: Possible off-by-1 in wc Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-NFIT-ADSL: 0 X-NFIT-RelayAddr: 95.166.154.201 X-NFIT-Auth: True X-Scanned-By: MIMEDefang 2.71 on 10.19.8.10 X-Sim: d921d2a9ee52568fe11269d5d2dcf617c4ff197187ec10d25e0f42f16af0e06d 449 X-NFIT-Solido-Score: 8. X-Scanned-By: MIMEDefang 2.71 on 10.19.8.10 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 25 Jan 2011 20:19:05 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.6 (------) sune@jekaterina:~$ echo =C5|wc -m 2 sune@jekaterina:~$ echo =C5|wc -c 3 sune@jekaterina:~$ Expected: 1 and 2 respectively. wc is the one in Ubuntu Linux 10.10 Best regards, Sune M=F8lgaard --=20 It is wonderful how much time good people spend fighting the devil. If=20 they would only expend the same amount of energy loving their fellow=20 men, the devil would die in his own tracks of ennui. - Helen Keller From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 25 20:51:46 2011 Received: (at 7915) by debbugs.gnu.org; 26 Jan 2011 01:51:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PhuXy-0004K7-9c for submit@debbugs.gnu.org; Tue, 25 Jan 2011 20:51:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PhuXu-0004Ju-Gl for 7915@debbugs.gnu.org; Tue, 25 Jan 2011 20:51:43 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0Q1xlR8003623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Jan 2011 20:59:48 -0500 Received: from [10.3.113.146] (ovpn-113-146.phx2.redhat.com [10.3.113.146]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0Q1xlUG025290; Tue, 25 Jan 2011 20:59:47 -0500 Message-ID: <4D3F8012.6080209@redhat.com> Date: Tue, 25 Jan 2011 18:59:46 -0700 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Sune_M=F8lgaard?= Subject: Re: bug#7915: Possible off-by-1 in wc References: <4D3F765B.3010006@molgaard.org> In-Reply-To: <4D3F765B.3010006@molgaard.org> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig31E20FF0670AA5C776935261" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 7915 Cc: 7915@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig31E20FF0670AA5C776935261 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 01/25/2011 06:18 PM, Sune M=F8lgaard wrote: > sune@jekaterina:~$ echo =C5|wc -m > 2 > sune@jekaterina:~$ echo =C5|wc -c > 3 > sune@jekaterina:~$ >=20 > Expected: 1 and 2 respectively. Thanks for the report. However, this is not a bug - echo is outputting a newline (which is a second character, and third byte given the encoding of your chosen character). To see the difference, try: $ echo =C5 | od -tx1z 0000000 c3 85 0a >...< 0000003 $ printf =C5 | od -tx1z 0000000 c3 85 >..< 0000002 --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig31E20FF0670AA5C776935261 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNP4ASAAoJEKeha0olJ0Nq49gH/2od+8WjWRlCJaqhWJbyfjuU hlfZaLTxeW0d59NkOLBnhQ43+By2n2GVubVSyVj6qabs0BHuxCt3UgqC0OxKD+EY eZ7w8SJO7e1fHOhJVa/mSdmLooeMaEmpU/rjRa9EvBkCk0TOx0EzPlRhQK56K4zH MiqLiP4XW5d2FA9OAF5Zi+/bKVU24EO/vNVNioXlc+oNIxp8O9rF0GmDT08ul4GA zzzzBkBJU3YRSRutvGxi/JfPWu9Oe/bQehqlqyd85YAGn/+yfhBD8m/WWo6nF69q 2K2B0ntXY0zZraYd9aSWUS//upmet4wzLagCjpGyPYxemuTzAgPif6i1wdEMEMc= =kRgb -----END PGP SIGNATURE----- --------------enig31E20FF0670AA5C776935261-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 25 21:00:13 2011 Received: (at 7915) by debbugs.gnu.org; 26 Jan 2011 02:00:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Phug9-0004Vg-LS for submit@debbugs.gnu.org; Tue, 25 Jan 2011 21:00:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Phug7-0004VU-4J for 7915@debbugs.gnu.org; Tue, 25 Jan 2011 21:00:11 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0Q28GT3007497 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Jan 2011 21:08:16 -0500 Received: from [10.3.113.146] (ovpn-113-146.phx2.redhat.com [10.3.113.146]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0Q28FRd027809; Tue, 25 Jan 2011 21:08:15 -0500 Message-ID: <4D3F820F.80505@redhat.com> Date: Tue, 25 Jan 2011 19:08:15 -0700 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Sune_M=F8lgaard?= , 7915@debbugs.gnu.org Subject: Re: bug#7915: Possible off-by-1 in wc References: <4D3F765B.3010006@molgaard.org> <4D3F8012.6080209@redhat.com> <4D3F813D.60205@molgaard.org> In-Reply-To: <4D3F813D.60205@molgaard.org> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigADF20B0D73F5A035BA3B1930" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 7915 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigADF20B0D73F5A035BA3B1930 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable [Let's keep the list in the loop] On 01/25/2011 07:04 PM, Sune M=F8lgaard wrote: >> Thanks for the report. However, this is not a bug - echo is outputtin= g >> a newline (which is a second character, and third byte given the >> encoding of your chosen character). >> >> To see the difference, try: >> >> $ echo =C5 | od -tx1z >> $ printf =C5 | od -tx1z >=20 > Thanks for the swift reply - I figured it might be something like that,= > but would it be possible to make an option to strip things like that, o= r > is that a silly question? An option to which program, echo or wc? For wc, it's not possible. How is wc supposed to know whether the input has an extra trailing newline that should be ignored? Fix the input side of the equation, rather than adding complexity to wc. For echo, the option is already (non-portably) there, in the form of 'echo -n' (won't work everywhere), or portably by using printf instead of echo (as was the case in my example). --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigADF20B0D73F5A035BA3B1930 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNP4IPAAoJEKeha0olJ0NqTA0IAJ8BE++Ftjnoux/1vOP8yc+n Xkzu9CWoXX+cB4hftu5IQ47uzLX6DxrS/TE6AnpO0a2t5a5eCFxMIIXEpgoaa0UT 9aitEkbW5Xk+WlxnqFQ8/8WeZ9/A+3DkibYMnWWRzQB5EHAE7t1pyrHnQb1Qe3le L8C1pjj0ngqouZp/Jh6bRM69v/m/DKi94aJ/YzygZqT9A/NZK+WcqghZHkNYofuI 7g8InWTFqZDI69Z+HQlpvrQDGSIpS5n0RMZAupsrqI/KU4CD7Oi2RWMPcvBq9uKm IGGlAQvDFPsGndNPyeyOMueQDWu5poEMb17FzKM8fMKz2z2riNC14mxDcTFOgk8= =nixX -----END PGP SIGNATURE----- --------------enigADF20B0D73F5A035BA3B1930-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 07 13:08:12 2011 Received: (at control) by debbugs.gnu.org; 7 Aug 2011 17:08:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq6pg-0004YP-71 for submit@debbugs.gnu.org; Sun, 07 Aug 2011 13:08:12 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq6pe-0004YJ-K3 for control@debbugs.gnu.org; Sun, 07 Aug 2011 13:08:10 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 466E7600AC for ; Sun, 7 Aug 2011 19:07:12 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: Re: Possible off-by-1 in wc Date: Sun, 07 Aug 2011 19:07:12 +0200 Message-ID: <878vr5gngf.fsf@rho.meyering.net> Lines: 3 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.1 (------) tags 7915 + notabug close 7915 thanks From unknown Sat Jun 21 10:43:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 05 Sep 2011 11: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