Less For CentOS6 With POSIX Regex?

Home » CentOS » Less For CentOS6 With POSIX Regex?
CentOS 4 Comments

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?

Cheers Tony

4 thoughts on - Less For CentOS6 With POSIX Regex?

  • In article , Tony Mountifield wrote:

    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?

    Cheers Tony

  • 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.

  • you might need to have it provide “less” though, to avoid unmet deps eg for man or gzip.

  • In article <55761C28.507@imag.fr>, Nicolas Thierry-Mieg wrote:

    Excellent points – thanks! I’ll have a play and see what I can do.

    Would still like to know how/where best to contribute them.

    Cheers Tony