GNU bug report logs - #36820
grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but not 3.3

Previous Next

Package: grep;

Reported by: Jeff Chua <jeff.chua.linux <at> gmail.com>

Date: Sat, 27 Jul 2019 00:15:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36820 in the body.
You can then email your comments to 36820 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#36820; Package grep. (Sat, 27 Jul 2019 00:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jeff Chua <jeff.chua.linux <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sat, 27 Jul 2019 00:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jeff Chua <jeff.chua.linux <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but not 3.3
Date: Sat, 27 Jul 2019 07:52:37 +0800
[Message part 1 (text/plain, inline)]
# using grep 2.20 ...
# grep "[[:cntrl:]]" /proc/1/cmdline
Binary file /proc/1/cmdline matches

# using grep 3.3 or above 2.20 ...
# grep "[[:cntrl:]]" /proc/1/cmdline
... nothing returned



My best.,
Jeff
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 27 Jul 2019 17:17:03 GMT) Full text and rfc822 format available.

Notification sent to Jeff Chua <jeff.chua.linux <at> gmail.com>:
bug acknowledged by developer. (Sat, 27 Jul 2019 17:17:04 GMT) Full text and rfc822 format available.

Message #10 received at 36820-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jeff Chua <jeff.chua.linux <at> gmail.com>, 36820-done <at> debbugs.gnu.org
Subject: Re: bug#36820: grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but
 not 3.3
Date: Sat, 27 Jul 2019 10:16:00 -0700
This is documented behavior; the grep manual says that when grep is reading a 
binary file it "may treat non-text bytes as line terminators".

You can use grep's -a (--text) option to if you want to match null bytes.




Information forwarded to bug-grep <at> gnu.org:
bug#36820; Package grep. (Sun, 28 Jul 2019 15:43:02 GMT) Full text and rfc822 format available.

Message #13 received at 36820-done <at> debbugs.gnu.org (full text, mbox):

From: Jeff Chua <jeff.chua.linux <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 36820-done <at> debbugs.gnu.org
Subject: Re: bug#36820: grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but
 not 3.3
Date: Sun, 28 Jul 2019 16:04:48 +0800
[Message part 1 (text/plain, inline)]
> This is documented behavior; the grep manual says that when grep is
reading a
binary file it "may treat non-text bytes as line terminators".
> You can use grep's -a (--text) option to if you want to match null bytes.

Paul,

Thanks for pointing this out. Didn't know that as it works on 2.20.

Then if it's binary file, grep should default to "-a" to make it compatible
with the old behavior?

My best.,
Jeff


On Sun, Jul 28, 2019 at 1:16 AM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> This is documented behavior; the grep manual says that when grep is
> reading a
> binary file it "may treat non-text bytes as line terminators".
>
> You can use grep's -a (--text) option to if you want to match null bytes.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#36820; Package grep. (Sun, 28 Jul 2019 23:01:01 GMT) Full text and rfc822 format available.

Message #16 received at 36820 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jeff Chua <jeff.chua.linux <at> gmail.com>
Cc: 36820 <at> debbugs.gnu.org
Subject: Re: bug#36820: grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but
 not 3.3
Date: Sun, 28 Jul 2019 17:59:51 -0500
On 7/28/19 3:04 AM, Jeff Chua wrote:
> Then if it's binary file, grep should default to "-a" 

No, as that would mean the default output of grep would not be text, and 
this could mess up terminals etc. This is partly why -a has never been 
the default. If you want -a behavior you can use -a.





Information forwarded to bug-grep <at> gnu.org:
bug#36820; Package grep. (Mon, 29 Jul 2019 14:39:02 GMT) Full text and rfc822 format available.

Message #19 received at 36820 <at> debbugs.gnu.org (full text, mbox):

From: Jeff Chua <jeff.chua.linux <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 36820 <at> debbugs.gnu.org
Subject: Re: bug#36820: grep "[[:cntrl:]]" /proc/1/cmdline works on 2.20 but
 not 3.3
Date: Mon, 29 Jul 2019 19:30:36 +0800
[Message part 1 (text/plain, inline)]
> No, as that would mean the default output of grep would not be text, and
this could mess up terminals etc. This is partly why -a has never been
the default. If you want -a behavior you can use -a.

Ok, thanks for the clarification.

My best.,
Jeff


On Mon, Jul 29, 2019 at 6:59 AM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 7/28/19 3:04 AM, Jeff Chua wrote:
> > Then if it's binary file, grep should default to "-a"
>
> No, as that would mean the default output of grep would not be text, and
> this could mess up terminals etc. This is partly why -a has never been
> the default. If you want -a behavior you can use -a.
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#36820; Package grep. (Fri, 16 Aug 2019 22:29:02 GMT) Full text and rfc822 format available.

Message #22 received at 36820-done <at> debbugs.gnu.org (full text, mbox):

From: Ángel <angel <at> re.16bits.net>
To: 36820-done <at> debbugs.gnu.org
Cc: Daniele Grassini <danielegrassini <at> libero.it>
Subject: Re: bug#36960: mistake with v param
Date: Sat, 17 Aug 2019 00:28:13 +0200
On 2019-08-07 at 17:45 +0200, Daniele Grassini wrote:
> so why the '-o' option check the regular exp, but the '-v' don't do his 
> job??
> 

Hello Daniele


As the manual states:

> -v, --invert-match
>               Invert the sense of matching, to select non-matching lines.

With -v you are matching the *lines* that don't contain "[a-z]{1}[0-9]+\.ko$", not the *portion of the line* which doesn't match.

For removing lines which end that way I would recommend you to simply replace your grep with sed, ie.
   sed -E 's/[a-z]{1}[0-9]+\.ko$//'

(add -n and p flag to ignore lines not ending that way)

Best regards





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 14 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 273 days ago.

Previous Next


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