[CentOS] less for CentOS6 with POSIX regex?

Mon Jun 8 22:33:05 UTC 2015
Tony Mountifield <tony at softins.co.uk>

In article <ml1jnh$afr$1 at softins.softins.co.uk>,
Tony Mountifield <tony at softins.co.uk> wrote:
> When I started using CentOS 6 instead of CentOS 5, I discovered that
> "less" no longer understood \< and \>, which I had been used to using
> since almost forever.
> Eventually research revealed that in the Fedora version on which
> RHEL 6 was based, "less" had been built with the PCRE regex library
> instead of a POSIX one. So instead of \< and \>, I had to use \b.
> I found a bugzilla entry about this, which showed that the change had
> been reverted in a later Fedora release. So I tested CentOS 7, and found
> "less" has been reverted to using POSIX regex, which I'm glad about.
> What I want to know is: do any repos have a replacement version of
> "less" for CentOS 6 that has been built with POSIX regex, so that
> I don't have to keep switching between the two styles when working
> on different CentOS versions?

Well, after the deafening silence in response, I assumed the answer was "no",
so I downloaded the SRPMs of less for both C6 and C7, and did a comparison.
I found that it was easy to fix the C6 less to use the correct POSIX regex
engine as follows:

1. Copy less-394-search.patch from the C7 SRPM, and add it back into
   less.spec as Patch2.

2. Remove the line "BuildRequires: pcre-devel".

3. Remove "--with-regex=pcre" from the %configure line in less.spec.

4. Change the release number. I changed 13 to 13posix, so that the resultant
   RPMS have names like less-436-13posix.el6 instead of less-436-13.el6

5. Rebuild RPMs and SRPM using "rpmbuild -ba less.spec".

6. Install using "yum localinstall".

The resulting build of less works wonderfully on my C6 boxes, consistently
with the versions on C4, C5 and C7.

I'm sure there must be other people who would find the corrected RPMs useful,
so my questions now are:

a) Is there a contributors repo to which it would be appropriate to submit them?

b) Is there a better way to number the release for this version?


Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org