zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays
@ 2021-07-05  5:11 Eric Cook
  2021-07-08 22:05 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Cook @ 2021-07-05  5:11 UTC (permalink / raw)
  To: zsh-workers

% typeset -A foo=(bar baz); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}; typeset -A foo=(bar bar -R qux); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}
- 1
qux - 1

---
 Completion/Linux/Command/_modutils | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index c62c6e7b6..1205f2506 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -132,7 +132,7 @@ _modutils() {
 	_store_cache modules-$kver modules modaliases
       fi

-      if (( ${+opt_args[(k)(-R|--resolve-alias)]} )); then
+      if [[ -v opt_args[(i)(-R|--resolve-alias)] ]]; then
 	_tags module-aliases
       else
 	_tags files modules module-aliases
--
2.31.1



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

* Re: [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays
  2021-07-05  5:11 [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays Eric Cook
@ 2021-07-08 22:05 ` Oliver Kiddle
  2021-07-18 22:46   ` Lawrence Velázquez
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2021-07-08 22:05 UTC (permalink / raw)
  To: Eric Cook; +Cc: zsh-workers

On 5 Jul, Eric Cook wrote:
> % typeset -A foo=(bar baz); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}; typeset -A foo=(bar bar -R qux); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}

That change makes sense. Searching the wider code shows many cases where
we've done similar tests with opt_args[(i)...|...|...  but none with
(k). Subscript flags can be easy to make mistakes with.

Oliver


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

* Re: [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays
  2021-07-08 22:05 ` Oliver Kiddle
@ 2021-07-18 22:46   ` Lawrence Velázquez
  2021-07-19  6:18     ` Eric Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Lawrence Velázquez @ 2021-07-18 22:46 UTC (permalink / raw)
  To: zsh-workers

On Thu, Jul 8, 2021, at 6:05 PM, Oliver Kiddle wrote:
> On 5 Jul, Eric Cook wrote:
> > % typeset -A foo=(bar baz); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}; typeset -A foo=(bar bar -R qux); print -- ${foo[(k)-R]} - ${+foo[(k)-R]}
> 
> That change makes sense. Searching the wider code shows many cases where
> we've done similar tests with opt_args[(i)...|...|...  but none with
> (k). Subscript flags can be easy to make mistakes with.
> 
> Oliver

ping for further feedback and/or committing

-- 
vq


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

* Re: [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays
  2021-07-18 22:46   ` Lawrence Velázquez
@ 2021-07-19  6:18     ` Eric Cook
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Cook @ 2021-07-19  6:18 UTC (permalink / raw)
  To: zsh-workers

On 7/18/21 6:46 PM, Lawrence Velázquez wrote:
>
> ping for further feedback and/or committing
>
I just committed it.


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

end of thread, other threads:[~2021-07-19  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  5:11 [PATCH] _modutils: fix the testing of -R/--resolve-alias options as it is now, it is always true due to how $+var works with the k subscript flag on associative arrays Eric Cook
2021-07-08 22:05 ` Oliver Kiddle
2021-07-18 22:46   ` Lawrence Velázquez
2021-07-19  6:18     ` Eric Cook

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).