Skip to content

Commit

Permalink
Fix quoting of grep Regex in m_muttalias.
Browse files Browse the repository at this point in the history
Required with grep >= 3.8, which complains about
 stray \ before "

In the NEWS file for grep 3.8:

  Regular expressions with stray backslashes now cause warnings, as
  their unspecified behavior can lead to unexpected results.
  • Loading branch information
RolandRosenfeld committed Sep 17, 2022
1 parent 5db49a2 commit 2cae723
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Ignore case and non alphanumeric chars in SORT_OUTPUT=name.
- Update dotlock code from mutt 2.2.1 (uses snprintf now).
- Update rfc822 code from mutt 2.2.1.
- Fix quoting of grep Regex in m_muttalias.

## [0.50] - 2022-02-25

Expand Down
4 changes: 2 additions & 2 deletions m_muttalias.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -*-sh-*-
#
# Copyright (C) 2000 Brian Salter-Duke <[email protected]>
# 2000-2018 Roland Rosenfeld <[email protected]>
# 2000-2022 Roland Rosenfeld <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -37,7 +37,7 @@ m_muttalias_query()
# 2. alias nick [email protected] (Foo Bar)
# 3. alias nick <[email protected]> (Foo Bar)
grep -ia "$@" "$file" \
| grep -a '^alias[ ][ ]*[^,][^,]*[ ][ ]*\([^,]\|\\\".*\\\"\)*$' \
| grep -a '^alias[ ][ ]*[^,][^,]*[ ][ ]*\([^,]\|".*"\)*$' \
| sed -E -e 's/^alias[[:blank:]]+([^[:blank:]]+)[[:blank:]]+("[^"]+"|[^<>()]+)[[:blank:]]+<([^<>()]+)>.*$/\3 \2 alias \1/' \
-e 's/^alias[[:blank:]]+([^[:blank:]]+)[[:blank:]]+([^<>()]+)[[:blank:]]+\(([^()<>]+)\).*$/\2 \3 alias \1/' \
-e 's/^alias[[:blank:]]+([^[:blank:]]+)[[:blank:]]+<([^<>()]+)>[[:blank:]]+\(([^()<>]+)\).*$/\2 \3 alias \1/' \
Expand Down

0 comments on commit 2cae723

Please sign in to comment.