grep fails to match an empty line using perl regexp if it's the last line in a file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grep (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
grep:
Installed: 2.25-1~16.04.1
Candidate: 2.25-1~16.04.1
Version table:
*** 2.25-1~16.04.1 500
500 http://
100 /var/lib/
2.24-1 500
500 http://
3) What you expected to happen
(echo 123; echo; ) | grep -P '^$'
$ # output contains one empty line
$ (echo 123; echo;) | grep -P '^$'
$
4) What happened instead
$ # output contains no line
$ (echo 123; echo;) | grep -P '^$'
$
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: grep 2.25-1~16.04.1
ProcVersionSign
Uname: Linux 4.13.0-38-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.16
Architecture: amd64
CurrentDesktop: Unity
Date: Tue May 8 18:49:45 2018
InstallationDate: Installed on 2018-02-13 (83 days ago)
InstallationMedia: Ubuntu 16.04.3 LTS "Xenial Xerus" - Release amd64 (20170801)
SourcePackage: grep
UpgradeStatus: No upgrade log present (probably fresh install)
I can't identify when it was fixed, but can confirm this is not happening any more in grep 3.1-2build1 in Ubuntu 18.04.