[pacman-dev] [PATCH] add missing open quotation mark in regex
Signed-off-by: Juergen Hoetzel <juergen@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 17fd5de..66e1225 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -372,7 +372,7 @@ download_file() { run_pacman() { local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" - if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$" ]]; then + if (( ! ASROOT )) && [[ ! $1 =~ "^-(T|Qq)$" ]]; then if [ "$(type -p sudo)" ]; then cmd="sudo $cmd" else -- 1.7.2.2
On Thu, Aug 26, 2010 at 10:14 AM, Juergen Hoetzel <juergen@archlinux.org> wrote:
Signed-off-by: Juergen Hoetzel <juergen@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 17fd5de..66e1225 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -372,7 +372,7 @@ download_file() { run_pacman() { local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" - if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$" ]]; then + if (( ! ASROOT )) && [[ ! $1 =~ "^-(T|Qq)$" ]]; then if [ "$(type -p sudo)" ]; then cmd="sudo $cmd" else --
The fix loops obviously correct, but now the logic is all busted. The regex is not working and it is always prompting me for a password when using the -T operation to check deps. See the following: $ foobar='-T'; [[ "$foobar" =~ '^-(T|Qq)$' ]] && echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-(T|Qq)' ]] && echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '^-T$' ]] && echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-T' ]] && echo 'matches' matches It turns out hte regex should *not* be quoted at all, from #bash: < geirha> toofishes: The regex must not be quoted I've made an alternate patch to do this instead and it will be on master. -Dan
On 28/08/10 01:51, Dan McGee wrote:
On Thu, Aug 26, 2010 at 10:14 AM, Juergen Hoetzel<juergen@archlinux.org> wrote:
Signed-off-by: Juergen Hoetzel<juergen@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 17fd5de..66e1225 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -372,7 +372,7 @@ download_file() { run_pacman() { local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" - if (( ! ASROOT ))&& [[ ! $1 =~ ^-(T|Qq)$" ]]; then + if (( ! ASROOT ))&& [[ ! $1 =~ "^-(T|Qq)$" ]]; then if [ "$(type -p sudo)" ]; then cmd="sudo $cmd" else --
The fix loops obviously correct, but now the logic is all busted. The regex is not working and it is always prompting me for a password when using the -T operation to check deps. See the following:
$ foobar='-T'; [[ "$foobar" =~ '^-(T|Qq)$' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-(T|Qq)' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '^-T$' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-T' ]]&& echo 'matches' matches
It turns out hte regex should *not* be quoted at all, from #bash: < geirha> toofishes: The regex must not be quoted
I've made an alternate patch to do this instead and it will be on master.
grep =~ scripts/makepkg .... if [[ $short_options =~ "${1:i:1}:" ]]; then
So I guess that needs fixed too? Allan
On Sunday, September 5, 2010, Allan McRae <allan@archlinux.org> wrote:
On 28/08/10 01:51, Dan McGee wrote:
On Thu, Aug 26, 2010 at 10:14 AM, Juergen Hoetzel<juergen@archlinux.org> wrote:
Signed-off-by: Juergen Hoetzel<juergen@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 17fd5de..66e1225 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -372,7 +372,7 @@ download_file() { run_pacman() { local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" - if (( ! ASROOT ))&& [[ ! $1 =~ ^-(T|Qq)$" ]]; then + if (( ! ASROOT ))&& [[ ! $1 =~ "^-(T|Qq)$" ]]; then if [ "$(type -p sudo)" ]; then cmd="sudo $cmd" else --
The fix loops obviously correct, but now the logic is all busted. The regex is not working and it is always prompting me for a password when using the -T operation to check deps. See the following:
$ foobar='-T'; [[ "$foobar" =~ '^-(T|Qq)$' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-(T|Qq)' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '^-T$' ]]&& echo 'matches' $ foobar='-T'; [[ "$foobar" =~ '-T' ]]&& echo 'matches' matches
It turns out hte regex should *not* be quoted at all, from #bash: < geirha> toofishes: The regex must not be quoted
I've made an alternate patch to do this instead and it will be on master.
grep =~ scripts/makepkg .... if [[ $short_options =~ "${1:i:1}:" ]]; then
So I guess that needs fixed too?
Looks like it does, yeah. Not sure why I didn't look for other regexes.
participants (3)
-
Allan McRae
-
Dan McGee
-
Juergen Hoetzel