* zrecompile -p -R/-M has no effect
@ 2015-09-23 21:36 Mikael Magnusson
2015-09-24 3:03 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2015-09-23 21:36 UTC (permalink / raw)
To: zsh workers
I noticed a while ago that my .zshrc.zwc stayed mapped forever, so I
tried to give -R to the zrecompile invocation that handles my init
files, but
% zcompile() { >&2 echo -E - zcompile "$@"; builtin zcompile "$@" }
% touch .zshrc; zrecompile -p -R .zshrc
zcompile -t .zshrc.zwc
re-compiling .zshrc.zwc: zcompile .zshrc.zwc .zshrc
succeeded
It ate my -R. If you try to reproduce this locally, note that read is
the default for small files, so try also with -M to see if you can
change it to (mapped) instead of vice versa as here.
% builtin zcompile -t .zshrc.zwc
zwc file (mapped) for zsh-5.1.1-dev-0-mika
.zshrc
% builtin zcompile -R .zshrc
% builtin zcompile -t .zshrc.zwc
zwc file (read) for zsh-5.1.1-dev-0-mika
.zshrc
The example in the manpage even uses this as an example;
If the -p option is given, the args are interpreted as one or more
sets of arguments for zcompile, separated by `--'. For example:
zrecompile -p \
-R ~/.zshrc -- \
-M ~/.zcompdump -- \
~/zsh/comp.zwc ~/zsh/Completion/*/_*
It looks like there is a getopt thing trying to check for these, but
presumably it doesn't work,
while getopts :MR opt $files; do
case $opt in
[MR]) map=( -$opt ) ;;
*) tmp=( $tmp $files[OPTIND] );;
esac
done
...
zcompile $map $tmp $zwc $files
I have no idea how getopt works, so if anyone thinks "ah, what an
obvious and easy fix" when seeing this, that would be nice.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: zrecompile -p -R/-M has no effect
2015-09-23 21:36 zrecompile -p -R/-M has no effect Mikael Magnusson
@ 2015-09-24 3:03 ` Bart Schaefer
2015-09-24 3:32 ` Mikael Magnusson
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-09-24 3:03 UTC (permalink / raw)
To: Mikael Magnusson, zsh workers
On Sep 23, 11:36pm, Mikael Magnusson wrote:
} Subject: zrecompile -p -R/-M has no effect
}
} % zcompile() { >&2 echo -E - zcompile "$@"; builtin zcompile "$@" }
} % touch .zshrc; zrecompile -p -R .zshrc
} zcompile -t .zshrc.zwc
} re-compiling .zshrc.zwc: zcompile .zshrc.zwc .zshrc
} succeeded
}
} It ate my -R.
It looks (set -x) as though the first "getops :tqp opt" loop is
consuming the -R and passing it through the the (*) branch which
stashes it in $tmp, which is then used to shift it off $argv at
the end of the loop.
The shift expression (line 55) is
shift OPTIND-${#tmp:-1}
I suspect it needs to be
shift OPTIND-${#tmp}-1
Anyone care to confirm?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: zrecompile -p -R/-M has no effect
2015-09-24 3:03 ` Bart Schaefer
@ 2015-09-24 3:32 ` Mikael Magnusson
0 siblings, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2015-09-24 3:32 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh workers
On Thu, Sep 24, 2015 at 5:03 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Sep 23, 11:36pm, Mikael Magnusson wrote:
> } Subject: zrecompile -p -R/-M has no effect
> }
> } % zcompile() { >&2 echo -E - zcompile "$@"; builtin zcompile "$@" }
> } % touch .zshrc; zrecompile -p -R .zshrc
> } zcompile -t .zshrc.zwc
> } re-compiling .zshrc.zwc: zcompile .zshrc.zwc .zshrc
> } succeeded
> }
> } It ate my -R.
>
> It looks (set -x) as though the first "getops :tqp opt" loop is
> consuming the -R and passing it through the the (*) branch which
> stashes it in $tmp, which is then used to shift it off $argv at
> the end of the loop.
>
> The shift expression (line 55) is
>
> shift OPTIND-${#tmp:-1}
>
> I suspect it needs to be
>
> shift OPTIND-${#tmp}-1
>
> Anyone care to confirm?
This fixes it for me, and doesn't appear to break anything else in the
process. Thanks!
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-24 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 21:36 zrecompile -p -R/-M has no effect Mikael Magnusson
2015-09-24 3:03 ` Bart Schaefer
2015-09-24 3:32 ` Mikael Magnusson
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).