Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 737480

Summary: sys-apps/portage: emerge --search could try to compile regular expression automatically when characters like ^ and $ are detected
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=647940
https://bugs.gentoo.org/show_bug.cgi?id=10651
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 735622, 739718    

Description Zac Medico gentoo-dev 2020-08-16 21:30:07 UTC
Currently, emerge --search only uses regular expressions when the search string in prefixed with %. It might make sense to enable this behavior automatically if the search string contains special characters like ^ or $.
Comment 1 Zac Medico gentoo-dev 2020-08-16 21:34:58 UTC
Bug 10651 shows that regular expressions where enabled by default at some point in the past. If we enable regular expression support automatically, then we need it to behave well if the expression fails to compile.
Comment 3 Larry the Git Cow gentoo-dev 2020-09-08 00:18:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=03ae0d95797f68cf86748ae3da184f3018e8c64c

commit 03ae0d95797f68cf86748ae3da184f3018e8c64c
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-01 02:49:50 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-08 00:17:54 +0000

    emerge --search: auto-detect regular expressions (bug 737480)
    
    Automatically detect regular expressions when the search string
    contains any of these regular expression characters or character
    sequences:
    
      ^ $ * [ ] { } | ? .+
    
    This simplifies usage, so that users no longer have to remember
    to prefix regular expressions with the % character. The new
    behavior can be disabled by --regex-search-auto=n, in case the
    regular expressions interpretation causes some kind of problem.
    
    Note that fuzzy search and regular expression search are
    mutually exclusive, and fuzzy search remains the default for
    search strings that do not contain any regular expression
    characters.
    
    Bug: https://bugs.gentoo.org/737480
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/actions.py |  1 +
 lib/_emerge/main.py    |  6 ++++++
 lib/_emerge/search.py  | 12 +++++++++++-
 man/emerge.1           | 12 +++++++++++-
 4 files changed, 29 insertions(+), 2 deletions(-)
Comment 4 Larry the Git Cow gentoo-dev 2020-09-08 03:51:37 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd840baeef963f5fe746f9167976ce0eed83a3b4

commit fd840baeef963f5fe746f9167976ce0eed83a3b4
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-08 03:44:51 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-08 03:51:23 +0000

    sys-apps/portage: Bump to version 3.0.6
    
     #668302 binrepos.conf: support fetchcommand customization
     #668334 Add binrepos.conf to replace PORTAGE_BINHOST
     #704416 env-update: create systemd user-session environment
     #737470 egencache --update-pkg-desc: emulate esync --verbose
     #737480 emerge --search: auto-detect regular expressions
     #739908 @change-deps: fix erroneous repeated rebuilds
     #740588 make.conf: Treat __* variables as local
     #740898 PORTAGE_BINHOST urlopen proxy support
     #740904 rsync and gemato proxy support
    
    Bug: https://bugs.gentoo.org/739718
    Bug: https://bugs.gentoo.org/668302
    Bug: https://bugs.gentoo.org/668334
    Bug: https://bugs.gentoo.org/704416
    Bug: https://bugs.gentoo.org/737470
    Bug: https://bugs.gentoo.org/737480
    Bug: https://bugs.gentoo.org/739908
    Bug: https://bugs.gentoo.org/740588
    Bug: https://bugs.gentoo.org/740898
    Bug: https://bugs.gentoo.org/740904
    Package-Manager: Portage-3.0.6, Repoman-3.0.1
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest             |   1 +
 sys-apps/portage/portage-3.0.6.ebuild | 265 ++++++++++++++++++++++++++++++++++
 2 files changed, 266 insertions(+)