agrep gives incorrect output in some approximate searches

Bug #914037 reported by Eric Price
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
agrep (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

agrep sometimes finds a line under exact matching, but not under inexact matching. I couldn't come up with a small test case, but
http://web.mit.edu/ecprice/Public/broken-agrep-example.gz has a 1.3 million line test case:

$ wget http://web.mit.edu/ecprice/Public/broken-agrep-example.gz -O - | zcat > case
[...]
$ agrep ^waterfal$ case #correct
waterfal
$ agrep -S1 ^waterfal$ case #should be identical to previous, but isn't
$ agrep -1 ^waterfal$ case #incorrect in last line
waterfall
waterval
aterfal
$ agrep ^aterfal$ case #as you can see here.
$

I'm also a bit confused by the relation between the version in Ubuntu and the version (3.41) at http://www.tgries.de/agrep/ . The ubuntu version number is 4.17, but agrep -V claims to be version 3.0. It seems like version 3.41 had a substantial amount of development in 96-97. It also doesn't have this bug.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: agrep 4.17-7
ProcVersionSignature: Ubuntu 3.0.0-14.23-generic 3.0.9
Uname: Linux 3.0.0-14-generic x86_64
NonfreeKernelModules: openafs
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Mon Jan 9 18:47:11 2012
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Beta amd64 (20110413)
ProcEnviron:
 LC_COLLATE=C
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: agrep
UpgradeStatus: Upgraded to oneiric on 2011-10-14 (87 days ago)

Revision history for this message
Eric Price (ecprice) wrote :
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

Hi Eric,
  Hmm, yes this is a bit confusing,

I agree your 'agrep -S1' case is producing the wrong result, however in 4.17-9 the manpage says:
' -Sk Set the cost of a substitution to k (k is a positive integer). This option does not currently work with regular
              expressions.'

so, I think that's just a limitation on agrep 4.17

I agree the -1 case is wrong to emit 'aterfal' since I agree it's nowhere in the input (and that's why I've confirmed it).

As for versions, yes, it's a mess, the 'homepage' listed in debian/control points to http://freshmeat.net/projects/agrep whcih points to the 2.04 version ftp://ftp.cs.arizona.edu/agrep/

The package has a 4.17 source tar and from what I can see it comes from http://wftp.tu-chemnitz.de/pub/Local/urz/ding/contrib/SRPMS/agrep-4.17-1.src.rpm that was suggested in the following debian bug

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=307442

but as you say the printed version number is completely inconsistent in that source.

Changed in agrep (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
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.