grep fails to match an empty line using perl regexp if it's the last line in a file

Bug #1769941 reported by Evgeniy Shchetinin
6
This bug affects 1 person
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://ru.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.24-1 500
        500 http://ru.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

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
ProcVersionSignature: Ubuntu 4.13.0-38.43~16.04.1-generic 4.13.16
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)

Revision history for this message
Evgeniy Shchetinin (eshch) wrote :
Revision history for this message
Andrew McCarthy (andrewmccarthy) wrote :

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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.