zsh-workers
 help / color / mirror / code / Atom feed
* completers using zstat don't work with zmodload -F zsh/stat
@ 2011-07-26 19:09 Mikael Magnusson
  2011-07-27  8:20 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Magnusson @ 2011-07-26 19:09 UTC (permalink / raw)
  To: zsh workers

umount for example tells me
_canonical_paths_add_paths:6: no such builtin: stat

The weird part is the completer uses zstat explicitly and doesn't
mention \<stat\> anywhere except in its zmodload line. The actual line
I'm using is zmodload -aF zsh/stat -b:stat b:zstat, but it breaks the
same with just -F and no b:*. If I zmodload zsh/stat and then 'disable
stat' it also breaks.

I just got the idea to 'which' the function, and indeed all the zstat
are magically replaced with 'builtin stat', which explains the
trouble. Why does that happen though?

-- 
Mikael Magnusson


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-26 19:09 completers using zstat don't work with zmodload -F zsh/stat Mikael Magnusson
@ 2011-07-27  8:20 ` Bart Schaefer
  2011-07-27  9:04   ` Mikael Magnusson
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2011-07-27  8:20 UTC (permalink / raw)
  To: zsh workers

On Jul 26,  9:09pm, Mikael Magnusson wrote:
}
} I just got the idea to 'which' the function, and indeed all the zstat
} are magically replaced with 'builtin stat', which explains the
} trouble. Why does that happen though?

It must be that you have an alias for zstat.  This doesn't happen to
me.  Make sure you're autoloading the completion functions with
"autoload -U" ?  Although compinit should do that for you.

Perhaps you zcompile'd the completion functions and did not use
"zcompile -U" ?


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27  8:20 ` Bart Schaefer
@ 2011-07-27  9:04   ` Mikael Magnusson
  2011-07-27 16:38     ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Magnusson @ 2011-07-27  9:04 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On 27 July 2011 10:20, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 26,  9:09pm, Mikael Magnusson wrote:
> }
> } I just got the idea to 'which' the function, and indeed all the zstat
> } are magically replaced with 'builtin stat', which explains the
> } trouble. Why does that happen though?
>
> It must be that you have an alias for zstat.  This doesn't happen to
> me.  Make sure you're autoloading the completion functions with
> "autoload -U" ?  Although compinit should do that for you.
>
> Perhaps you zcompile'd the completion functions and did not use
> "zcompile -U" ?

I did have an alias, but only in root's .zshrc, didn't think to check
for that. Adding -U to the zrecompile command didn't help, I had to
remove the alias.
for a ($fpath) {[ -w $a:r -a $a/_*(N[1]) ] && zrecompile -p -U -z $a.zwc $a/_*}
is how I'm compiling my completion functions.

-- 
Mikael Magnusson


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27  9:04   ` Mikael Magnusson
@ 2011-07-27 16:38     ` Bart Schaefer
  2011-07-27 16:44       ` Mikael Magnusson
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2011-07-27 16:38 UTC (permalink / raw)
  To: zsh workers

On Jul 27, 11:04am, Mikael Magnusson wrote:
}
} I did have an alias, but only in root's .zshrc, didn't think to check
} for that. Adding -U to the zrecompile command didn't help, I had to
} remove the alias.

Adding -U to zrecompile won't do anything unless you either first
remove all the *.zwc files or at least one of the functions referenced
by the .zwc file has changed since the last time zrecompile was run.
It deliberately skips zcompile if there have been no changes to the
source files.


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27 16:38     ` Bart Schaefer
@ 2011-07-27 16:44       ` Mikael Magnusson
  2011-07-27 18:18         ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Magnusson @ 2011-07-27 16:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On 27 July 2011 18:38, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 27, 11:04am, Mikael Magnusson wrote:
> }
> } I did have an alias, but only in root's .zshrc, didn't think to check
> } for that. Adding -U to the zrecompile command didn't help, I had to
> } remove the alias.
>
> Adding -U to zrecompile won't do anything unless you either first
> remove all the *.zwc files or at least one of the functions referenced
> by the .zwc file has changed since the last time zrecompile was run.
> It deliberately skips zcompile if there have been no changes to the
> source files.

I did that.

# alias zstat='builtin stat'
# rm $fpath[3].zwc*
removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc'
removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc.old'
# for a ($fpath) {[ -w $a:r -a $a/_*(N[1]) ] && zrecompile -p -U -z
$a.zwc $a/_*}
re-compiling /usr/local/share/zsh/4.3.12-dev-1/functions.zwc: succeeded

% umount <tab>
_canonical_paths_add_paths:6: no such builtin: stat

-- 
Mikael Magnusson


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27 16:44       ` Mikael Magnusson
@ 2011-07-27 18:18         ` Bart Schaefer
  2011-07-27 18:24           ` Mikael Magnusson
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2011-07-27 18:18 UTC (permalink / raw)
  To: zsh workers

On Jul 27,  6:44pm, Mikael Magnusson wrote:
} Subject: Re: completers using zstat don't work with zmodload -F zsh/stat
}
} # alias zstat='builtin stat'
} # rm $fpath[3].zwc*
} removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc'
} removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc.old'
} # for a ($fpath) {[ -w $a:r -a $a/_*(N[1]) ] && zrecompile -p -U -z
} $a.zwc $a/_*}
} re-compiling /usr/local/share/zsh/4.3.12-dev-1/functions.zwc: succeeded
} 
} % umount <tab>
} _canonical_paths_add_paths:6: no such builtin: stat

This must be happening because _canonical_paths_add_paths isn't actually
defined until _canonical_paths is executed, so the -U option to zcompile
doesn't have a chance to come into effect.

This is going to be a problem with any completion source file that has
multiple embedded function definitions.

It MIGHT help to both use "zcompile -a" and also change _canonical_paths
from using

    _canonical_paths_add_paths () {
      ...
    }

to using the load-once paradigm

    (( $+functions[__canonical_paths_add_paths] )) ||
    _canonical_paths_add_paths () {
      ...
    }

but I'm not confident of that.


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27 18:18         ` Bart Schaefer
@ 2011-07-27 18:24           ` Mikael Magnusson
  2011-07-27 19:32             ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Magnusson @ 2011-07-27 18:24 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On 27 July 2011 20:18, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 27,  6:44pm, Mikael Magnusson wrote:
> } Subject: Re: completers using zstat don't work with zmodload -F zsh/stat
> }
> } # alias zstat='builtin stat'
> } # rm $fpath[3].zwc*
> } removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc'
> } removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc.old'
> } # for a ($fpath) {[ -w $a:r -a $a/_*(N[1]) ] && zrecompile -p -U -z
> } $a.zwc $a/_*}
> } re-compiling /usr/local/share/zsh/4.3.12-dev-1/functions.zwc: succeeded
> }
> } % umount <tab>
> } _canonical_paths_add_paths:6: no such builtin: stat
>
> This must be happening because _canonical_paths_add_paths isn't actually
> defined until _canonical_paths is executed, so the -U option to zcompile
> doesn't have a chance to come into effect.
>
> This is going to be a problem with any completion source file that has
> multiple embedded function definitions.
>
> It MIGHT help to both use "zcompile -a" and also change _canonical_paths
> from using
>
>    _canonical_paths_add_paths () {
>      ...
>    }
>
> to using the load-once paradigm
>
>    (( $+functions[__canonical_paths_add_paths] )) ||
>    _canonical_paths_add_paths () {
>      ...
>    }
>
> but I'm not confident of that.

Hm, but if it's only loaded at "runtime", why does the alias get
expanded then? My user doesn't have the zstat alias. Are aliases still
expanded during compilation inside function definitions but -U is
somehow not active? (This sounds odd).

-- 
Mikael Magnusson


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

* Re: completers using zstat don't work with zmodload -F zsh/stat
  2011-07-27 18:24           ` Mikael Magnusson
@ 2011-07-27 19:32             ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2011-07-27 19:32 UTC (permalink / raw)
  To: zsh workers

On Jul 27,  8:24pm, Mikael Magnusson wrote:
}
} Hm, but if it's only loaded at "runtime", why does the alias get
} expanded then? My user doesn't have the zstat alias. Are aliases still
} expanded during compilation inside function definitions but -U is
} somehow not active? (This sounds odd).

That does sound odd.  I suppose you can try running zrecompile with
set -x and/or set -v and catch the zcompile calls to be sure that
the -U option is in fact being passed through.  I suppose it's not
impossible that some other recent change has mucked up the use of
the "noaliases" C-code global to control this.


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

end of thread, other threads:[~2011-07-27 19:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 19:09 completers using zstat don't work with zmodload -F zsh/stat Mikael Magnusson
2011-07-27  8:20 ` Bart Schaefer
2011-07-27  9:04   ` Mikael Magnusson
2011-07-27 16:38     ` Bart Schaefer
2011-07-27 16:44       ` Mikael Magnusson
2011-07-27 18:18         ` Bart Schaefer
2011-07-27 18:24           ` Mikael Magnusson
2011-07-27 19:32             ` Bart Schaefer

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