[CentOS] less for CentOS6 with POSIX regex?

Mon Jun 8 22:48:13 UTC 2015
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>

On 06/09/2015 12:33 AM, tony at softins.co.uk (Tony Mountifield) wrote:
> 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?

it may be better to change the package name to less-posix rather than 
change the release number, and have the new package conflict with less.
That way once you've installed it, it won't get squashed by a yum update.