Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15650 closed bug (fixed)

TextSearch: search string is not properly escaped when passing in grep

Reported by: X512 Owned by: phoudoin
Priority: normal Milestone: R1/beta2
Component: Applications/TextSearch Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #14336
Platform: All

Description

This is hrev53732.

Steps to reproduce:

  1. Open TextSearch in some directory
  2. Enter ->Go( as search string and press search.
  3. Following contents will be displayed multiple times in search results:
    grep: invalid option -- '>'
    Usage: grep [OPTION]... PATTERN [FILE]...
    Try 'grep --help' for more information.
    

Change History (6)

comment:1 by phoudoin, 5 years ago

Damn. Please someone can add these lines in Grepper.cpp:Grepper::_RunnerThread(), line 274:

  • Version

     
    266266    // grep command driven by xargs dispatcher
    267267    argv[argc++] = "grep";
    268268    argv[argc++] = "-n"; // need matching line(s) number(s)
    269269    argv[argc++] = "-H"; // need filename prefix
    270270    if (! fCaseSensitive)
    271271        argv[argc++] = "-i";
    272272    if (! fRegularExpression)
    273273        argv[argc++] = "-F";     // no a regexp: force fixed string,
     274    // Add double dash argument to tell grep
     275    // it's the end of commands options
     276    argv[argc++] = "--";
    274277    argv[argc++] = fPattern;
    275278    argv[argc] = NULL;

? Thanks

Version 0, edited 5 years ago by phoudoin (next)

comment:2 by X512, 5 years ago

Fix confirmed.

I uploaded proposed fix to Gerrit: https://review.haiku-os.org/c/haiku/+/2149.

comment:3 by phoudoin, 5 years ago

Resolution: fixed
Status: newclosed

Thanks.

comment:4 by phoudoin, 5 years ago

Possible duplicate: #14336

comment:5 by phoudoin, 5 years ago

Blocking: 14336 added

comment:6 by nielx, 5 years ago

Milestone: UnscheduledR1/beta2

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

Note: See TracTickets for help on using tickets.