[pcre-dev] [Bug 2177] New: fails in recursive mode for filen…

Góra strony
Delete this message
Autor: admin
Data:  
Dla: pcre-dev
Temat: [pcre-dev] [Bug 2177] New: fails in recursive mode for filenames >= 129 chars
https://bugs.exim.org/show_bug.cgi?id=2177

            Bug ID: 2177
           Summary: fails in recursive mode for filenames >= 129 chars
           Product: PCRE
           Version: 10.30 (PCRE2)
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: glyphimor@???
                CC: pcre-dev@???


Hello,

The affected software is pcregrep (8.41) and pcre2grep (10.30) on Linux
(Gentoo).

Ran into this issue grepping through text files in a directory hierarchy. Had
been using GNU grep, but it couldn't handle some patterns, so discovered
pcregrep and started using that. But in recursive mode, pcregrep fails for
files w/ long-ish names -- filenames 129 chars long or longer.

Run these commands to reproduce:

--
mkdir test
cd test

echo "filename is 128 chars long" > "128 -
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.txt"

echo "filename is 129 chars long" > "129 -
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678.txt"

pcre2grep chars *
pcre2grep -r chars .
--

The 2nd-to-last command, with no recursion, works fine and prints:

128 -
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.txt:filename
is 128 chars long
129 -
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678.txt:filename
is 129 chars long

However, the last command, with recursion, prints:

pcre2grep: Failed to open ./129 -
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678.tx:
No such file or directory
./128 -
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.txt:filename
is 128 chars long

It chokes on the 129-char filename. Note the error message:

"Failed to open ./129 - 0...8.tx: No such file or directory

It only prints the 1st 128 chars of the filename (ends with ".tx" instead of
".txt"), suggesting it's a buffer issue.

Presumably pcregrep should be able to handle filenames at least up to the
ext2/3/4 length limit of 255 bytes.

Thanks.

--
You are receiving this mail because:
You are on the CC list for the bug.