GNU bug report logs - #30535
Output buffer overwritten when CR in file

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Severity: wishlist; Reported by: Wayne Gemmell <wayne@HIDDEN>; merged with #30652; dated Mon, 19 Feb 2018 17:31:02 UTC; Maintainer for grep is bug-grep@HIDDEN.
Merged 30535 30652. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed tag(s) notabug. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 30535 <at> debbugs.gnu.org:


Received: (at 30535) by debbugs.gnu.org; 20 Feb 2018 07:34:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 20 02:34:59 2018
Received: from localhost ([127.0.0.1]:52075 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eo2S2-0004z8-TU
	for submit <at> debbugs.gnu.org; Tue, 20 Feb 2018 02:34:59 -0500
Received: from mail-lf0-f46.google.com ([209.85.215.46]:38635)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wayne@HIDDEN>) id 1eo2RU-0004y2-SM
 for 30535 <at> debbugs.gnu.org; Tue, 20 Feb 2018 02:34:26 -0500
Received: by mail-lf0-f46.google.com with SMTP id g72so2797714lfg.5
 for <30535 <at> debbugs.gnu.org>; Mon, 19 Feb 2018 23:34:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gemmell.co.za; s=google;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=kOSKZFp0geYMRlRNQiGUGnbxAjHon+IxrCxPL51PMcg=;
 b=a8IlIh05KXAvA5yAidtxSAJU4AZnHIQ4fTi4w+KuqjwPwlyBtXdufkUUNc0baeWL/9
 SECbQHgUjaIhWMGQTCkRnPbZXX8f0+BeeODUtxQjOiz4J2g8kfAfBk2GIi1DMe9N8SjE
 E/Ip859pr4r/R9WVT0G8sXO2Q0OPlNyp9TvpWZKsD9na/knvToWJh056ewN5mZMrhG2q
 2KQfcm8JN7ho4KH1lq0V3UzwSds3SKjqB1whLCynXJKcLo6WY/I50/8ZUqH+2wjpRfH/
 K1GbF9Pwl+tUbjCswhJtHwxHFolTMoqBXm01l+iokctvmsMyoQHX9btfW6OqPIFZtxoz
 bf0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=kOSKZFp0geYMRlRNQiGUGnbxAjHon+IxrCxPL51PMcg=;
 b=YnuN2nULtpxLJB0BE1GC9nx3vtMjSHwN67bxHlEw7fIAgEkyv3erAEERzlTzPrBTIB
 SBQdqWdtFojFXVlwSB792+5JWCjxQH8RU4C0ZoL8bTQ9ZZduXp7Le1CNROr1iefH2QSy
 H+BiUVaQNJB5SSmr9yrIH9nM+77ZxkvXRgzH4XGGyxEVAKGAgTzsYj6pPDs2QoG6NtSc
 9kgldQXcTF0iW03MpIbxwfBNiySsFsCHQDysXR7d3A7SgmuTbxOB9ajXX6FjRYQnR0J4
 ru9WUhDtPMb51C8XeGt/I3vlm/k3SGm40PF5TnnDA7W0X5m0IfXb21iXzAVqFsIYDZH6
 2mBg==
X-Gm-Message-State: APf1xPAOWcNuUk8zGpWOsHAAayoBQ7fAiJ6pLlBxAzngkAsokgiHRY4v
 4T8wZivxso5vdgQLmLGk8SUWn1N4DwcnBhjr3oRyeQ==
X-Google-Smtp-Source: AH8x227SpioEzQqZS7BsCfJv0sXiQ6Ts3gw4ZtoPXrD0Z46qi2/EYF9XcimtXmSziklYTccy1vfQ9jIWOa3KugC0irM=
X-Received: by 10.46.7.26 with SMTP id 26mr10404522ljh.107.1519112058570; Mon,
 19 Feb 2018 23:34:18 -0800 (PST)
MIME-Version: 1.0
References: <CA+z1FeJZWmJ6vP=3UwZtsP_VwMRd_hiHrDmvcUNevSngXV+crg@HIDDEN>
 <0ccd8361-ae83-817c-f3aa-8687b8d7d82c@HIDDEN>
In-Reply-To: <0ccd8361-ae83-817c-f3aa-8687b8d7d82c@HIDDEN>
From: Wayne Gemmell <wayne@HIDDEN>
Date: Tue, 20 Feb 2018 07:34:07 +0000
Message-ID: <CA+z1FeKfut0Pq2CjB9x6UWJk=phro91N9cJUXae6LgRbJoc9GQ@HIDDEN>
Subject: Re: bug#30535: Output buffer overwritten when CR in file
To: Paul Eggert <eggert@HIDDEN>
Content-Type: multipart/alternative; boundary="f403045ebc7aa01dff05659fd602"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 30535
X-Mailman-Approved-At: Tue, 20 Feb 2018 02:34:57 -0500
Cc: 30535 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--f403045ebc7aa01dff05659fd602
Content-Type: text/plain; charset="UTF-8"

Hi Paul

That is exactly what I am getting. It is probably acting quite correctly,
the problem is that the shell executing those control characters is both
confusing and a possible security risk. I've tried this in ksh, dash, bash
and zsh and they all execute the control characters.

I think that they should be suppressed or escaped by default and a flag
should be provided to allow them to be passed out unescaped. Maybe this has
become a feature request...



On Mon, 19 Feb 2018 at 22:13 Paul Eggert <eggert@HIDDEN> wrote:

> Wayne Gemmell wrote:
> > I would expect the CR to be output verbatim
>
> It is output verbatim, just as you expect. For example:
>
> $ printf 'messag1\rlogin\rmask' >test.log
> 503-day $ grep --color=never login test.log | od -c
> 0000000   m   e   s   s   a   g   1  \r   l   o   g   i   n  \r   m   a
> 0000020   s   k  \n
> 0000023
>
-- 
Regards
Wayne

--f403045ebc7aa01dff05659fd602
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Paul<div><br></div><div>That is exactly what I am getti=
ng. It is probably acting quite correctly, the problem is that the shell ex=
ecuting those control characters is both confusing and a possible security =
risk. I&#39;ve tried this in ksh, dash, bash and zsh and they all execute t=
he control characters.=C2=A0</div><div><br></div><div>I think that they sho=
uld be suppressed or escaped by default and a flag should be provided to al=
low them to be passed out unescaped. Maybe this has become a feature reques=
t...</div><div><br><div><br></div></div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr">On Mon, 19 Feb 2018 at 22:13 Paul Eggert &lt;<a href=3D"=
mailto:eggert@HIDDEN">eggert@HIDDEN</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex">Wayne Gemmell wrote:<br>
&gt; I would expect the CR to be output verbatim<br>
<br>
It is output verbatim, just as you expect. For example:<br>
<br>
$ printf &#39;messag1\rlogin\rmask&#39; &gt;test.log<br>
503-day $ grep --color=3Dnever login test.log | od -c<br>
0000000=C2=A0 =C2=A0m=C2=A0 =C2=A0e=C2=A0 =C2=A0s=C2=A0 =C2=A0s=C2=A0 =C2=
=A0a=C2=A0 =C2=A0g=C2=A0 =C2=A01=C2=A0 \r=C2=A0 =C2=A0l=C2=A0 =C2=A0o=C2=A0=
 =C2=A0g=C2=A0 =C2=A0i=C2=A0 =C2=A0n=C2=A0 \r=C2=A0 =C2=A0m=C2=A0 =C2=A0a<b=
r>
0000020=C2=A0 =C2=A0s=C2=A0 =C2=A0k=C2=A0 \n<br>
0000023<br>
</blockquote></div>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-s=
martmail=3D"gmail_signature"><div dir=3D"ltr">Regards<div>Wayne</div></div>=
</div>

--f403045ebc7aa01dff05659fd602--




Information forwarded to bug-grep@HIDDEN:
bug#30535; Package grep. Full text available.

Message received at 30535 <at> debbugs.gnu.org:


Received: (at 30535) by debbugs.gnu.org; 19 Feb 2018 20:13:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 19 15:13:28 2018
Received: from localhost ([127.0.0.1]:51675 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1enroV-000102-Qg
	for submit <at> debbugs.gnu.org; Mon, 19 Feb 2018 15:13:27 -0500
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1enroS-0000zk-1H
 for 30535 <at> debbugs.gnu.org; Mon, 19 Feb 2018 15:13:24 -0500
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id BE1BC16161B;
 Mon, 19 Feb 2018 12:13:18 -0800 (PST)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Q7HJIsFHnuUE; Mon, 19 Feb 2018 12:13:18 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 15B0D16161C;
 Mon, 19 Feb 2018 12:13:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id cWEl62kGQXOu; Mon, 19 Feb 2018 12:13:18 -0800 (PST)
Received: from [192.168.1.9] (unknown [47.154.30.119])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E9EF916161B;
 Mon, 19 Feb 2018 12:13:17 -0800 (PST)
Subject: Re: bug#30535: Output buffer overwritten when CR in file
To: Wayne Gemmell <wayne@HIDDEN>, 30535 <at> debbugs.gnu.org
References: <CA+z1FeJZWmJ6vP=3UwZtsP_VwMRd_hiHrDmvcUNevSngXV+crg@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <0ccd8361-ae83-817c-f3aa-8687b8d7d82c@HIDDEN>
Date: Mon, 19 Feb 2018 12:13:17 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <CA+z1FeJZWmJ6vP=3UwZtsP_VwMRd_hiHrDmvcUNevSngXV+crg@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 30535
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Wayne Gemmell wrote:
> I would expect the CR to be output verbatim

It is output verbatim, just as you expect. For example:

$ printf 'messag1\rlogin\rmask' >test.log
503-day $ grep --color=never login test.log | od -c
0000000   m   e   s   s   a   g   1  \r   l   o   g   i   n  \r   m   a
0000020   s   k  \n
0000023




Information forwarded to bug-grep@HIDDEN:
bug#30535; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Feb 2018 17:30:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 19 12:30:51 2018
Received: from localhost ([127.0.0.1]:51552 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1enpH8-00056V-26
	for submit <at> debbugs.gnu.org; Mon, 19 Feb 2018 12:30:51 -0500
Received: from eggs.gnu.org ([208.118.235.92]:45222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wayne@HIDDEN>) id 1enmYz-0000gU-4i
 for submit <at> debbugs.gnu.org; Mon, 19 Feb 2018 09:37:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <wayne@HIDDEN>) id 1enmYt-0002Jk-77
 for submit <at> debbugs.gnu.org; Mon, 19 Feb 2018 09:37:00 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37424)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <wayne@HIDDEN>) id 1enmYt-0002Je-2l
 for submit <at> debbugs.gnu.org; Mon, 19 Feb 2018 09:36:59 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36192)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <wayne@HIDDEN>) id 1enmYs-0007Q9-1g
 for bug-grep@HIDDEN; Mon, 19 Feb 2018 09:36:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <wayne@HIDDEN>) id 1enmYr-0002IX-0l
 for bug-grep@HIDDEN; Mon, 19 Feb 2018 09:36:58 -0500
Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:45550)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <wayne@HIDDEN>) id 1enmYq-0002HT-H0
 for bug-grep@HIDDEN; Mon, 19 Feb 2018 09:36:56 -0500
Received: by mail-lf0-x22b.google.com with SMTP id x196so13353498lfd.12
 for <bug-grep@HIDDEN>; Mon, 19 Feb 2018 06:36:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gemmell.co.za; s=google;
 h=mime-version:from:date:message-id:subject:to;
 bh=/i2VmHNtbBlfRkj5OhBZm2hkvpcs/H3fNA0ALfUPIos=;
 b=MgjHX2w8lG5KNr0sgaVR7zRoCPpmt7JI8M0+z7Dow772+UViLx+6Wh92fxlKz1Zg0S
 NbHEMEKmAm+In0Jtq3vX1wFp3M7BjMqoFdXlIxnv+SzrB3VTftKXf3EYoQPthJmcHeIZ
 rJlWT14jxHI8x12IKAshs+Mtjx+64mLvMTWfJVO/ZbeH2jrvnatXyzLxw+F3giXCy6P/
 2igU19fh2vLpquw0HfUgiU8wXDki5eNA38xhO6XKG3DUwLIKV9hgjxVK64oLTpNsPFbu
 4oL97a5CbbUZTgiZZh22EV1qrOKzqvYNlB0mW9+XWRvxBK0qRyOJK4Sc0T5m8EUmy9vm
 ABTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=/i2VmHNtbBlfRkj5OhBZm2hkvpcs/H3fNA0ALfUPIos=;
 b=GuIAOupdyY1y6pmVNmfzjMJzidPBkQ/z8Ch0Bp2oT6Hg8uSV5PHLa2m6uZ/luZ156T
 8q2PFwBIIrQAoFwZY+B0lsIV/qyZSlo8RmQvrjL1Kxvcxse9cyjaarRQ6oPAj5YuxgCJ
 6y5uLEDwYytqS9GAyqSoEPuFLHq5mvn2fbNZGppDI+Z37ifXoNaRWvtAA5jjZ5BurSMK
 wC2o7naHBeBkw0kF/XKQPiOAlpYIoThw9xXEr/M/pSPMdbawe1l89xFdK6Fhns6ZSfqV
 RnbvMx0s8vSmfIkJg7HNVjcJTrMPfgpnPMxMI/fZJMzR4zcvokwSb9CFpK5I0grPIjY6
 QlZg==
X-Gm-Message-State: APf1xPD29Xl4Jk7UX5pR2NmPEK5NtfuzCBEwBinNeZDpQgqnYJ+phl5h
 X7FK07wkkCGlP5qRa/IoVV/XgU9SxWtNgYoMY7XB2Id+
X-Google-Smtp-Source: AH8x225NFfFG749ZFvNUnkyreHcUr71GXRxrjbPo563RXaqyQ9wZ+RNOLHbM26DQWbeuqbUuo/6K4MNpf1aEBq/4c1s=
X-Received: by 10.25.123.18 with SMTP id w18mr6833889lfc.104.1519051014486;
 Mon, 19 Feb 2018 06:36:54 -0800 (PST)
MIME-Version: 1.0
From: Wayne Gemmell <wayne@HIDDEN>
Date: Mon, 19 Feb 2018 14:36:43 +0000
Message-ID: <CA+z1FeJZWmJ6vP=3UwZtsP_VwMRd_hiHrDmvcUNevSngXV+crg@HIDDEN>
Subject: Output buffer overwritten when CR in file
To: bug-grep@HIDDEN
Content-Type: multipart/alternative; boundary="089e082ef7481d5b77056591a0da"
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: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 19 Feb 2018 12:30:49 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

--089e082ef7481d5b77056591a0da
Content-Type: text/plain; charset="UTF-8"

Hi

I have an issue with files that contain carriage returns. I have log files
that contain user input which sometime has carriage returns. The EOL
characters are fine so I can't throw mac2unix at the problem.

The issue is that when grep outputs the CR it follows the CR to the
beginning of the output buffer and overwrites the contents of the output
buffer.

E.g. the file, test.log with the following contents.

messag1^Mlogin^Mmask

The following command
$>/grep --color=never login test.log
Outputs as follows
$>maskng1

This seems like a security concern as you may be able to mask activity in
logs just by inserting CR in place. It would be superficial but it would
fool basic grep based logfile processing.

I would expect the CR to be output verbatim so as not to confuse the reader
of the output.


-- 
Regards
Wayne

--089e082ef7481d5b77056591a0da
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi<div><br></div><div>I have an issue with files that cont=
ain carriage returns. I have log files that contain user input which someti=
me has carriage returns. The EOL characters are fine so I can&#39;t throw m=
ac2unix at the problem.=C2=A0</div><div><br></div><div>The issue is that wh=
en grep outputs the CR it follows the CR to the beginning of the output buf=
fer and overwrites the contents of the output buffer.=C2=A0</div><div><br><=
/div><div>E.g. the file, test.log with the following contents.=C2=A0</div><=
div><br></div><div><div>messag1^Mlogin^Mmask</div></div><div><br></div><div=
>The following command</div><div>$&gt;/grep --color=3Dnever login test.log<=
/div><div>Outputs as follows<br></div><div>$&gt;maskng1<br></div><div><br><=
/div><div>This seems like a security concern as you may be able to mask act=
ivity in logs just by inserting CR in place. It would be superficial but it=
 would fool basic grep based logfile processing.=C2=A0</div><div><br></div>=
<div>I would expect the CR to be output verbatim so as not to confuse the r=
eader of the output.=C2=A0</div><div><br></div><div><br></div></div>-- <br>=
<div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signatur=
e"><div dir=3D"ltr">Regards<div>Wayne</div></div></div>

--089e082ef7481d5b77056591a0da--




Acknowledgement sent to Wayne Gemmell <wayne@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#30535; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 1 Jan 2020 07:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.