zsh-workers
 help / color / mirror / code / Atom feed
* Bu report - unix/_gpg completion broken
@ 2019-12-01  1:42 O. simplex
  2020-05-15  5:21 ` Solution: " O. simplex
  0 siblings, 1 reply; 10+ messages in thread
From: O. simplex @ 2019-12-01  1:42 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

Distro: Arch Linux
Version: zsh 5.7.1 (x86_64-pc-linux-gnu)

Action: Type "gpg " then press <tab>
Actual behavior: termial output is: "_gpg:176: \[]*} not found"
Expected behavior: suggestions for gpg command

Ordinatio Simplex

Sent with [ProtonMail](https://protonmail.com) Secure Email.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Solution: Bu report - unix/_gpg completion broken
  2019-12-01  1:42 Bu report - unix/_gpg completion broken O. simplex
@ 2020-05-15  5:21 ` O. simplex
  2020-05-15  8:53   ` Daniel Shahaf
  0 siblings, 1 reply; 10+ messages in thread
From: O. simplex @ 2020-05-15  5:21 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Problematic line:
extra=( ${${${args#\([^\)]#\)}#\*}%%[:=\[]*} )

Working line:
extra=( ${${${args#\([^\)]#\)}#\*}%%[:\[=]*} )

The problem is the sequence of characters inside the bracket expression of last parameter expansion: [:=\[]
Substitute this for: [:\[=]

Ordinatio Simplex

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, December 1, 2019 1:42 AM, O. simplex <ordinatio.simplex@protonmail.ch> wrote:

> Distro: Arch Linux
> Version: zsh 5.7.1 (x86_64-pc-linux-gnu)
>
> Action: Type "gpg " then press <tab>
> Actual behavior: termial output is: "_gpg:176: \[]*} not found"
> Expected behavior: suggestions for gpg command
>
> Ordinatio Simplex
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Solution: Bu report - unix/_gpg completion broken
  2020-05-15  5:21 ` Solution: " O. simplex
@ 2020-05-15  8:53   ` Daniel Shahaf
       [not found]     ` <Ww4N4kk6TH_2Cp6_B0A709kTrD8LonXJPl6qmAAx75k0eQ7OczWUSwo7LCJOnXJm-nyuAVtdf8HOIGGb0krLeM0Z_fRWy723j1XTVA6vgek=@protonmail.ch>
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Shahaf @ 2020-05-15  8:53 UTC (permalink / raw)
  To: O. simplex; +Cc: zsh-workers

I can't reproduce the original problem with either 5.7.1 or master
(which isn't surprising, really — this functionality is too basic to
have been broken for 15 months with nobody noticing).  Can you provide
a reproduction recipe starting with 'zsh -f'?

O. simplex wrote on Fri, 15 May 2020 05:21 +0000:
> Problematic line:
> extra=( ${${${args#\([^\)]#\)}#\*}%%[:=\[]*} )
> 
> Working line:
> extra=( ${${${args#\([^\)]#\)}#\*}%%[:\[=]*} )
> 
> The problem is the sequence of characters inside the bracket expression of last parameter expansion: [:=\[]
> Substitute this for: [:\[=]
> 
> Ordinatio Simplex
> 
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Sunday, December 1, 2019 1:42 AM, O. simplex <ordinatio.simplex@protonmail.ch> wrote:
> 
> > Distro: Arch Linux
> > Version: zsh 5.7.1 (x86_64-pc-linux-gnu)
> >
> > Action: Type "gpg " then press <tab>
> > Actual behavior: termial output is: "_gpg:176: \[]*} not found"
> > Expected behavior: suggestions for gpg command
> >
> > Ordinatio Simplex
> >
> > Sent with [ProtonMail](https://protonmail.com) Secure Email  


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Solution: Bu report - unix/_gpg completion broken
       [not found]     ` <Ww4N4kk6TH_2Cp6_B0A709kTrD8LonXJPl6qmAAx75k0eQ7OczWUSwo7LCJOnXJm-nyuAVtdf8HOIGGb0krLeM0Z_fRWy723j1XTVA6vgek=@protonmail.ch>
@ 2020-06-06  6:38       ` O. simplex
  2020-06-06  8:19         ` Daniel Shahaf
  0 siblings, 1 reply; 10+ messages in thread
From: O. simplex @ 2020-06-06  6:38 UTC (permalink / raw)
  To: zsh-workers

Sorry, there is some time since my report.

The error is caused because i set shfileexpansion.

Steps after run % zsh -f:
% autoload -U compinit
% compinit
% # if I try gpg aucompletion now, will work as expected
% # so you was right
% # now the detail in my personal config
% setopt shfileexpansion
% # if I try now, the error ( _gpg:176: \[]*} not found ) will appear

Since I removed the option shfileexpansion from my zshrc, and gpg completion worked as expected.

Ordinatio Simplex

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, May 15, 2020 8:53 AM, Daniel Shahaf d.s@daniel.shahaf.name wrote:

> I can't reproduce the original problem with either 5.7.1 or master
> (which isn't surprising, really — this functionality is too basic to
> have been broken for 15 months with nobody noticing). Can you provide
> a reproduction recipe starting with 'zsh -f'?
>
> O. simplex wrote on Fri, 15 May 2020 05:21 +0000:
>
> > Problematic line:
> > extra=( ${${${args#\([^\)]#\)}#\}%%[:=\[]} )
> > Working line:
> > extra=( ${${${args#\([^\)]#\)}#\}%%[:\[=]} )
> > The problem is the sequence of characters inside the bracket expression of last parameter expansion: [:=\[]
> > Substitute this for: [:\[=]
> > Ordinatio Simplex
> > Sent with ProtonMail Secure Email.
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Sunday, December 1, 2019 1:42 AM, O. simplex ordinatio.simplex@protonmail.ch wrote:
> >
> > > Distro: Arch Linux
> > > Version: zsh 5.7.1 (x86_64-pc-linux-gnu)
> > > Action: Type "gpg " then press <tab>
> > > Actual behavior: termial output is: "_gpg:176: \[]*} not found"
> > > Expected behavior: suggestions for gpg command
> > > Ordinatio Simplex
> > > Sent with ProtonMail Secure Email

</tab>/d.s@daniel.shahaf.name

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Solution: Bu report - unix/_gpg completion broken
  2020-06-06  6:38       ` O. simplex
@ 2020-06-06  8:19         ` Daniel Shahaf
  2020-06-09 23:07           ` Oliver Kiddle
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Shahaf @ 2020-06-06  8:19 UTC (permalink / raw)
  To: O. simplex; +Cc: zsh-workers

O. simplex wrote on Sat, 06 Jun 2020 06:38 +0000:
> Sorry, there is some time since my report.
> 
> The error is caused because i set shfileexpansion.
> 
> Steps after run % zsh -f:
> % autoload -U compinit
> % compinit
> % # if I try gpg aucompletion now, will work as expected
> % # so you was right
> % # now the detail in my personal config
> % setopt shfileexpansion
> % # if I try now, the error ( _gpg:176: \[]*} not found ) will appear
> 
> Since I removed the option shfileexpansion from my zshrc, and gpg completion worked as expected.

Thanks.  This should fix it:

diff --git a/Completion/compinit b/Completion/compinit
index f0f8421df..f4ff270f7 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -159,6 +159,7 @@ _comp_options=(
     NO_shglob
     NO_warnnestedvar
     NO_warncreateglobal
+    NO_shfileexpansion
 )
 
 # And this one should be `eval'ed at the beginning of every entry point

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Solution: Bu report - unix/_gpg completion broken
  2020-06-06  8:19         ` Daniel Shahaf
@ 2020-06-09 23:07           ` Oliver Kiddle
  2020-06-10 13:44             ` Daniel Shahaf
  0 siblings, 1 reply; 10+ messages in thread
From: Oliver Kiddle @ 2020-06-09 23:07 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: O. simplex, zsh-workers

On 6 Jun, Daniel Shahaf wrote:
> --- a/Completion/compinit
> @@ -159,6 +159,7 @@ _comp_options=(
> +    NO_shfileexpansion

Stuffing extra options into _comp_options is usually a bad idea because
it prevents the completion system from honouring the user's preferences.
In this case _expand will no longer handle the correct precedence of ~
and brace expansion.

It looks to me like the shfileexpansion option has got broken more
fundamentally at some point. Swap the = and : in the character
class in the pattern on the line that produces an error and the error
goes away. _complete_debug also appears to be broken with
shfileexpansion:

  setopt shfileexpansion; : =(echo hi)

I've not bisected fully but I did check a very old zsh and it worked
fine with that.

Oliver


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Solution: Bu report - unix/_gpg completion broken
  2020-06-09 23:07           ` Oliver Kiddle
@ 2020-06-10 13:44             ` Daniel Shahaf
  2020-06-23 21:23               ` SH_FILE_EXPANSION broken with process substitution Oliver Kiddle
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Shahaf @ 2020-06-10 13:44 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: O. simplex, zsh-workers

Oliver Kiddle wrote on Wed, 10 Jun 2020 01:07 +0200:
> On 6 Jun, Daniel Shahaf wrote:
> > --- a/Completion/compinit
> > @@ -159,6 +159,7 @@ _comp_options=(
> > +    NO_shfileexpansion  
> 
> Stuffing extra options into _comp_options is usually a bad idea because
> it prevents the completion system from honouring the user's preferences.
> In this case _expand will no longer handle the correct precedence of ~
> and brace expansion.

Oh, sorry.  I looked for such side effects before I made the change,
but didn't find any.  Should I revert that patch pending a better one?

In any case, I think the long term fix here isn't to expect completion
functions to be able to run under arbitrary syntax-modifying options —
especially given that some completion functions are maintained outside
our own tree by people not as familiar with the spectrum of syntax
variations as folks on this list — but to run completion functions
under a known set of options and make the user's options available to
them separately.  That's exactly what we would necessarily do if
completion functions didn't happen to be executed by the same
interpreter that will later executed $PREBUFFER$BUFFER.

z-sy-h has code for this.  It synthesizes an associative array akin to
$options, but it doesn't require zsh/parameter.

Cheers,

Daniel

P.S.  OT: Does anyone use a zsh build where the zsh/parameter module is
not available [i.e., where «zmodload zsh/parameter» would fail]?

> It looks to me like the shfileexpansion option has got broken more
> fundamentally at some point. Swap the = and : in the character
> class in the pattern on the line that produces an error and the error
> goes away. _complete_debug also appears to be broken with
> shfileexpansion:
> 
>   setopt shfileexpansion; : =(echo hi)
> 
> I've not bisected fully but I did check a very old zsh and it worked
> fine with that.
> 
> Oliver
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* SH_FILE_EXPANSION broken with process substitution
  2020-06-10 13:44             ` Daniel Shahaf
@ 2020-06-23 21:23               ` Oliver Kiddle
  2020-06-24 10:28                 ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Oliver Kiddle @ 2020-06-23 21:23 UTC (permalink / raw)
  To: Zsh workers; +Cc: Peter Stephenson, Bart Schaefer, O. simplex, Daniel Shahaf

Following on from the gpg completion breakage, it seems this option has
been broken when used in combination with EQUALS.

This got broken in 35a8612 (workers/26042), released in 4.3.10:
  zsh -df --shfileexpansion -c ': =(echo hi)'

The _gpg issue is minimally demonstrated with the following. It is
reproducible even with 3.0.8 so may be by design.

  zsh -df --shfileexpansion -c 'a=( ${x%[:=\[]*} )'

The documentation only talks about tilde expansion not equals expansion
so it isn't obvious why this should fail. Or why swapping : and = fixes
it. This perhaps goes to show that the option isn't widely used other
than as part of emulate sh (which also disables equals).

Oliver

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: SH_FILE_EXPANSION broken with process substitution
  2020-06-23 21:23               ` SH_FILE_EXPANSION broken with process substitution Oliver Kiddle
@ 2020-06-24 10:28                 ` Peter Stephenson
  2020-06-24 10:46                   ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2020-06-24 10:28 UTC (permalink / raw)
  To: Zsh workers


> On 23 June 2020 at 22:23 Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> Following on from the gpg completion breakage, it seems this option has
> been broken when used in combination with EQUALS.
> 
> This got broken in 35a8612 (workers/26042), released in 4.3.10:
>   zsh -df --shfileexpansion -c ': =(echo hi)'

diff --git a/Src/subst.c b/Src/subst.c
index 90b5fc121..ed3f4a82b 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -796,7 +796,7 @@ filesubstr(char **namptr, int assign)
 	    *namptr = dyncat(hom, ptr);
 	    return 1;
 	}
-    } else if (*str == Equals && isset(EQUALS) && str[1]) {   /* =foo */
+    } else if (*str == Equals && isset(EQUALS) && str[1] && str[1] != Inpar) {   /* =foo */
 	char *expn = equalsubstr(str+1, assign, isset(NOMATCH));
 	if (expn) {
 	    *namptr = expn;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: SH_FILE_EXPANSION broken with process substitution
  2020-06-24 10:28                 ` Peter Stephenson
@ 2020-06-24 10:46                   ` Peter Stephenson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2020-06-24 10:46 UTC (permalink / raw)
  To: Zsh workers


> On 24 June 2020 at 11:28 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > On 23 June 2020 at 22:23 Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> > Following on from the gpg completion breakage, it seems this option has
> > been broken when used in combination with EQUALS.
> > 
> > This got broken in 35a8612 (workers/26042), released in 4.3.10:
> >   zsh -df --shfileexpansion -c ': =(echo hi)'

Same but with test...  D03 already tests that process substitution is
implemented, so it to be safe to test the result is fully functional.

pws

diff --git a/Src/subst.c b/Src/subst.c
index 90b5fc121..ed3f4a82b 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -796,7 +796,7 @@ filesubstr(char **namptr, int assign)
 	    *namptr = dyncat(hom, ptr);
 	    return 1;
 	}
-    } else if (*str == Equals && isset(EQUALS) && str[1]) {   /* =foo */
+    } else if (*str == Equals && isset(EQUALS) && str[1] && str[1] != Inpar) {   /* =foo */
 	char *expn = equalsubstr(str+1, assign, isset(NOMATCH));
 	if (expn) {
 	    *namptr = expn;
diff --git a/Test/D03procsubst.ztst b/Test/D03procsubst.ztst
index 8cf4e2a7f..68a68ef6e 100644
--- a/Test/D03procsubst.ztst
+++ b/Test/D03procsubst.ztst
@@ -156,3 +156,7 @@
   procfunc <(echo argument)
 0:With /proc/self file descriptors must not be tidied up too early
 >argument
+
+  $ZTST_testdir/../Src/zsh -df -o shfileexpansion -c 'cat =(echo hi)'
+0:EQUALS expansion followed by =(...) (sh ordering) should work
+>hi

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-24 10:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01  1:42 Bu report - unix/_gpg completion broken O. simplex
2020-05-15  5:21 ` Solution: " O. simplex
2020-05-15  8:53   ` Daniel Shahaf
     [not found]     ` <Ww4N4kk6TH_2Cp6_B0A709kTrD8LonXJPl6qmAAx75k0eQ7OczWUSwo7LCJOnXJm-nyuAVtdf8HOIGGb0krLeM0Z_fRWy723j1XTVA6vgek=@protonmail.ch>
2020-06-06  6:38       ` O. simplex
2020-06-06  8:19         ` Daniel Shahaf
2020-06-09 23:07           ` Oliver Kiddle
2020-06-10 13:44             ` Daniel Shahaf
2020-06-23 21:23               ` SH_FILE_EXPANSION broken with process substitution Oliver Kiddle
2020-06-24 10:28                 ` Peter Stephenson
2020-06-24 10:46                   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).