From 2cae7234f648cc81a82cf5bf5e04196e48183e57 Mon Sep 17 00:00:00 2001 From: Roland Rosenfeld Date: Sat, 17 Sep 2022 11:28:29 +0200 Subject: [PATCH] Fix quoting of grep Regex in m_muttalias. 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. --- CHANGELOG.md | 1 + m_muttalias.sh.in | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 096c7a7..f20a689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/m_muttalias.sh.in b/m_muttalias.sh.in index 5513468..2842b22 100644 --- a/m_muttalias.sh.in +++ b/m_muttalias.sh.in @@ -3,7 +3,7 @@ # -*-sh-*- # # Copyright (C) 2000 Brian Salter-Duke -# 2000-2018 Roland Rosenfeld +# 2000-2022 Roland Rosenfeld # # 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 @@ -37,7 +37,7 @@ m_muttalias_query() # 2. alias nick foo@example.com (Foo Bar) # 3. alias nick (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/' \