mainAutoconf - Support: sr #108092, AC_PROG_GREP can select...


sr #108092: AC_PROG_GREP can select /usr/xpg4/bin/grep under Solaris 9 but it doesn't support long lines

Submitter:  Yann Rouillard <yann>
Submitted:  Sun 22 Jul 2012 12:14:05 AM UTC
Priority:  * 3 - Release N+1 Severity:  2 - Minor
Status:  Confirmed Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 20 Jul 2020 08:13:33 PM UTC, comment #2: 

The problem occurs on Solaris 9 but not Solaris 10. Since Oracle dropped support for Solaris 9 in 2014, the scenario of the original bug report is no longer worth worrying about. However, if 'configure' is picking the wrong 'grep' that is a bug that would be worth fixing anyway, for other old but not-yet-obsolete platforms (AIX perhaps?).

Paul Eggert <eggert>
Group administrator
Fri 10 Jul 2020 03:51:16 PM UTC, comment #1: 

We apologize for not getting back to you about this sooner.

AC_PROG_GREP does check for a grep that supports long lines (up to 10240 bytes long) but if it can't find one, it takes whatever grep it can find that supports -e.  So indeed it is not guaranteed to pick a grep that supports long lines.

It's supposed to pick whichever of 'grep' or 'ggrep' supports longer lines, but that logic might be buggy.

Since this is a long-standing issue and an ideal fix might be hairy, I am deferring it to after the upcoming 2.70 release, but we will definitely think about how we can do better - perhaps with improvements to AC_PROG_GREP itself, as well as with better documentation.

Zack Weinberg <zackw>
Group administrator
Sun 22 Jul 2012 12:14:05 AM UTC, original submission:  


According to the autoconf manual page, AC_PROG_GREP should select an grep binary that accepts the longest input lines possible, but it is not explained what "longest lines" means.

During the compilation of netsnmp under Solaris 9, I fought with a difficult bug caused by the fact that AC_PROG_GREP selected /usr/xpg4/bin/grep but this one doesn't work realiably when the length of lines exceed 2048 bytes.
(see )

(According to the man page:
"The results are unspecified if input files contain lines
longer than LINE_MAX bytes or contain binary data. LINE_MAX
is defined in /usr/include/limits.h.")

After having a look at the manual
, I understand that we can't rely on $GREP to process long lines as it was already mentioned that AIX truncates lines.

So I wonder if "longest lines" is misleading here because:
 - there seems to be no test about the length of lines supported,
 - anyway, if we want to be portable, we should only count on $GREP supporting the minimum length supported among all architectures.

Maybe some numbers about the length of lines supported could be added in the manual ?


Yann Rouillard <yann>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by yann (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-08 zackw Priority1 - Blocked 3 - Release N+1
        Severity3 - Normal 2 - Minor
    2020-07-10 zackw Priority5 - Unprioritized 1 - Blocked
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code