[pacman-dev] [PATCH] add missing open quotation mark in regex

Allan McRae allan at archlinux.org
Sun Sep 5 08:32:43 EDT 2010


On 28/08/10 01:51, Dan McGee wrote:
> On Thu, Aug 26, 2010 at 10:14 AM, Juergen Hoetzel<juergen at archlinux.org>  wrote:
>> Signed-off-by: Juergen Hoetzel<juergen at 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


More information about the pacman-dev mailing list