diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2012-02-21 21:52:09 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2012-02-21 21:52:55 +0100 |
commit | b561eedd8b1d70a2b3339d167348771f1a8fc5c7 (patch) | |
tree | a7d7d32a90f391767a921a5fcdb59551cdffa04e | |
parent | 340a3b41e51e3f39249a9e28f0615b063f073a3c (diff) | |
parent | 5f25bb8223d090d13af5869893fa35e5b8c44182 (diff) | |
download | zsh-b561eedd8b1d70a2b3339d167348771f1a8fc5c7.tar.gz zsh-b561eedd8b1d70a2b3339d167348771f1a8fc5c7.zip |
New upstream release
Merge branch 'upstream' into debian
83 files changed, 903 insertions, 215 deletions
@@ -1,3 +1,227 @@ +2012-02-19 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: Etc/Config.yo, Completion/X/Type/.distfiles, + Test/.distfiles: 4.3.16. + +2012-02-15 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30231 plus Mikael's change in 30232: NEWS, README, Etc/FAQ.yo: + updates for 4.3.16. + +2012-02-14 Oliver Kiddle <opk@zsh.org> + + * 30198: Completion/Unix/Command/_sudo, Doc/Zsh/compsys.yo: + fix environ style lookup to be done in conventional manner + + * Mikael: Completion/Debian/Command/_dpkg: fix dpkg-deb + completion broken by 30199 + +2012-02-14 Peter Stephenson <pws@csr.com> + + * users/16760: Functions/Zle/url-quote-magic: make reply + local for the benefit of styles. + +2012-02-13 Frank Terbeck <ft@bewatermyfriend.org> + + * 30214: Functions/Prompts/prompt_redhat_setup: Fix quoting in + `redhat' prompt. + +2012-02-12 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30203 (plus rename PF_ flags to PREFORK_): Src/exec.c, + Src/glob.c, Src/subst.c, Src/zsh.h, Test/D04parameter.ztst: + Pass sh-wordsplitting instructions to nested parameter + substitution by flags, avoiding side effects of explicitly + changing the option. + +2012-02-11 Mikael Magnusson <mikachu@gmail.com> + + * 30206: Completion/Unix/Command/_ldd: Fix ldd completion broken by + previous commit. + +2012-02-10 Oliver Kiddle <opk@zsh.org> + + * 30199: Completion/Debian/Command/_pbuilder, + Completion/Darwin/Command/_defaults, Completion/Darwin/Command/_fink, + Completion/Darwin/Command/_hdiutil, Completion/Debian/Command/_dak, + Completion/Debian/Command/_debdiff, Completion/Debian/Command/_dpkg, + Completion/Debian/Command/_linda, Completion/Debian/Command/_lintian, + Completion/Debian/Command/_piuparts, + Completion/Linux/Command/_modutils, + Completion/Mandriva/Command/_urpmi, + Completion/Unix/Command/_bittorrent, + Completion/Unix/Command/_bogofilter, Completion/Unix/Command/_cdrdao, + Completion/Unix/Command/_cplay, Completion/Unix/Command/_git, + Completion/Unix/Command/_hg, Completion/Unix/Command/_ldd, + Completion/Unix/Command/_metaflac, Completion/Unix/Command/_pax, + Completion/Unix/Command/_rubber, Completion/Unix/Command/_sisu, + Completion/Unix/Command/_texinfo, Completion/Unix/Command/_vim, + Completion/Unix/Command/_vorbiscomment, + Completion/Unix/Command/_xmms2: + add (-.) to many completion _files globs + + * 30197: Completion/Unix/Command/_subversion: complete changelists + + * 30177: Completion/X/Command/_xterm, + Completion/X/Type/_xft_fonts: completion for fontconfig fonts + +2012-02-09 Barton E. Schaefer <schaefer@zsh.org> + + * 30193: ChangeLog Src/Zle/compcore.c: remnulargs() after poking + into string in case length changes. + +2012-02-08 Peter Stephenson <pws@csr.com> + + * Timothy Redaelli: 30187: Src/hist.c: file name manipulations + in history can return NULL if HAVE_CANONICALIZE_FILE_NAME. + +2012-02-07 Peter Stephenson <pws@csr.com> + + * Holger Macht via Ismail: 30185: Src/Zle/complete.mdd: add + missing openSUSE file locations. + +2012-02-05 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30127: Src/builtin.c: forbid executing history lines via fc in + the wrong order. + +2012-02-03 Peter Stephenson <pws@csr.com> + + * Mariusz Glebocki: 30179: Completion/Unix/Type/_services: + suppress stderr for service list. + +2012-02-01 Frank Terbeck <ft@bewatermyfriend.org> + + * A.Costa: unposted: Doc/Zsh/grammar.yo, Etc/ChangeLog-3.1: Fix + typo to "definition". + +2012-01-31 Peter Stephenson <pws@csr.com> + + * seiler via Ismail: 30174: Completion/Unix/Command/_osc, + Completion/openSUSE/Command/_osc: update. + + * Felipe: 30158: Test/.distfiles, Test/compgentest, + Test/Y04compgen.ztst: compgen test is not useful with current + bashcopmpinit. + +2012-01-29 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Richard Hartmann: 30140: Completion/X/Command/_mplayer: + whitespace fix. + + * Felipe Contreras: 30131, 30132, 30133, 30134, 30135, + 30136, 30137: Completion/bashcompinit: various improvements to + bash-like behaviour. + +2012-01-23 Peter Stephenson <pws@csr.com> + + * Ben: 30118: Completion/Unix/Command/_sqlite, + Completion/Unix/Command/.distfiles: new sqlite completion. + +2012-01-22 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Ben: 30117 (moved directory): Completion/X/Command/_xclip, + Completion/X/Command/.distfiles: new completion. + +2012-01-19 Frank Terbeck <ft@bewatermyfriend.org> + + * 30114: Functions/VCS_Info/VCS_INFO_check_com: Remove a + superfluous stat(). + +2012-01-16 Frank Terbeck <ft@bewatermyfriend.org> + + * 30111: Src/exec.c: Fix segfaults with exec options. + +2012-01-15 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Richard Hartmann: 30110: Completion/Unix/Command/_vcsh, + Completion/Unix/Command/.distfiles: new completion. + +2012-01-09 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Stepan Koltsov: 30105: Completion/Unix/Command/_stgit: fix + delete completion. + +2012-01-08 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * users/16711: Completion/Unix/Type/_path_commands: try to take + account of PATH_DIRS option in command completion. + + * 30101: Doc/Zsh/options.yo, Src/hashtable.c, Src/options.c, + Src/zsh.h: add HASH_EXECUTABLES_ONLY option, off by default to + avoid problems with huge paths and remote directories. + +2012-01-07 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30098: Jun T.: Src/params.c: more minimal alternative to + 30079, don't set LANG if LC_ALL set. + +2012-01-06 Peter Stephenson <pws@csr.com> + + * Src/Modules/pcre.c (cond_pcre_match): unposted: fix (harmless) + warning with uninitialised variable. + +2012-01-05 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * Christian Höltje: 30087: Functions/Prompts/promptinit: remove + any hooks for a prompt theme when removing it. + + * 30084: Doc/Zsh/zle.yo, Src/init.c, Src/Zle/zle_main.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_thingy.c: `zle -T tc func' + defines function to be used insted of termcap output for + testing. + + * 30081: Completion/Base/Core/_main_complete: remove necessity + to have IGNORE_CLOSE_BRACES unset when loaded. + +2012-01-04 Frank Terbeck <ft@bewatermyfriend.org> + + * 30079: Src/params.c: Restore `LC_ALL' when setting `LANG'. + +2012-01-04 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30084: Src/init.c: zsfree(argzero) before we set it again + following ztrdup() in parseargs(). + +2012-01-02 Barton E. Schaefer <schaefer@zsh.org> + + * 30073 (plus comment): Src/Zle/zle_main.c: use queue_signals() + around critical first call to zrefresh() after zleactive = 1, to + prevent adjustwinsize() loop reported on FreeBSD. + +2011-12-30 Frank Terbeck <ft@bewatermyfriend.org> + + * 30048: Test/C02cond.ztst: Avoid [[ -N ... ]] on file-systems + mounted `noatime', if possible. + + * 30046: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: Fix + support for subversion version 1.7. + +2011-12-27 Barton E. Schaefer <schaefer@zsh.org> + + * 30069: Doc/Zsh/options.yo: replace empty parens with + LPAR()RPAR(). + +2011-12-21 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30041: Src/subst.c: the offset hack to make + ${foo:offset:length} bash compatible with positional parameters + doesn't apply when we're indexing into characters of one + positional parameter. + + * T.C. Hollingsworth: 30036: Completion/Unix/Command/_systemctl: + new arguments. + +2011-12-20 Barton E. Schaefer <schaefer@zsh.org> + + * 30033: Src/Zle/zle_keymap.c: silence valgrind warnings about + uninitialized values. + +2011-12-19 Peter Stephenson <pws@csr.com> + + * unposted: Config/version.mk: update version to 4.3.15-dev-0 to + avoid dev version clashing with installation. + 2011-12-17 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: release 4.3.15. @@ -15771,5 +15995,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5544 $ +* $Revision: 1.5590 $ ***************************************************** diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index 9bc5611de..d6831b81b 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -3,6 +3,10 @@ # The main loop of the completion code. This is what is called when # completion is attempted from the command line. +# Note that this function is parsed before $_comp_setup is evaluated, +# so that it should make conservative assumptions about the setting +# of the various options that affect parsing. + # In case non-standard separators are in use. local IFS=$' \t\n\0' @@ -52,9 +56,12 @@ if [[ ( "$tmp" = *pending(|[[:blank:]]*) && PENDING -gt 0 ) || fi if [[ "$compstate[insert]" = tab* ]]; then - { [[ "$tmp" = (|*[[:blank:]])(yes|true|on|1)(|[[:blank:]]*) ]] && - { [[ "$curcontext" != :* || -z "$compstate[vared]" ]] || - zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0 + if [[ "$tmp" = (|*[[:blank:]])(yes|true|on|1)(|[[:blank:]]*) ]]; then + if [[ "$curcontext" != :* || -z "$compstate[vared]" ]] || + zstyle -t ":completion:vared${curcontext}:" insert-tab; then + return 0 + fi + fi compstate[insert]="${compstate[insert]//tab /}" fi diff --git a/Completion/Darwin/Command/_defaults b/Completion/Darwin/Command/_defaults index e1b8fd923..7818e0379 100644 --- a/Completion/Darwin/Command/_defaults +++ b/Completion/Darwin/Command/_defaults @@ -9,7 +9,7 @@ _defaults_domains(){ _wanted domains expl 'defaults database domain' \ compadd -M 'r:|.=* r:|=*' -a list else - _files -g '*.plist(e:"reply=\${REPLY%.plist}":)' + _files -g '*.plist(-.:r)' fi } diff --git a/Completion/Darwin/Command/_fink b/Completion/Darwin/Command/_fink index 27ca3740c..55c9e8da5 100644 --- a/Completion/Darwin/Command/_fink +++ b/Completion/Darwin/Command/_fink @@ -157,7 +157,7 @@ _fink(){ #configure) #selfupdate) validate|check) - _wanted files expl 'finkinfo file' _files -g \*.info ;; + _wanted files expl 'finkinfo file' _files -g "*.info(-.)" ;; #scanpackages) #checksums) #cleanup) diff --git a/Completion/Darwin/Command/_hdiutil b/Completion/Darwin/Command/_hdiutil index c940f4739..13133b1f9 100644 --- a/Completion/Darwin/Command/_hdiutil +++ b/Completion/Darwin/Command/_hdiutil @@ -79,7 +79,7 @@ _hdiutil(){ local -A _common_usage_options _common_usage_options=( - -shadow "-shadow:shadow file:_files -g \*.shadow" + -shadow "-shadow:shadow file:_files -g '*.shadow(-.)'" -encryption "-encryption:encryption method:(CEncryptedEncoding)" -stdinpass "-stdinpass[specify password from standard input]" -certificate "-certificate[secondary access certificate]:certificate file:_files" @@ -89,7 +89,7 @@ _hdiutil(){ -tgtimagekey "*-tgtimagekey[target image key]: :->keyvalue" -insecurehttp "-insecurehttp[ignore SSL host validation failure]" -plist "-plist[display output in plist format]" - -recover "-recover[keychain to unlock]:keychain file:_files -g \*.keychain" + -recover "-recover[keychain to unlock]:keychain file:_files -g '*.keychain(-.)'" ) local -a _1st_arguments @@ -178,7 +178,7 @@ _hdiutil(){ "(-autoopenro)-noautoopenro" \ "(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \ "(-autoopenrw)-noautoopenrw" \ - "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; detach|eject) @@ -195,7 +195,7 @@ _hdiutil(){ "$_common_usage_options[-imagekey]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ - "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; create) @@ -265,7 +265,7 @@ _hdiutil(){ "-ov[overwrite an existing file]" \ "-format:format:_hdiutil_imageformat" \ "-o:target disk image:_files" \ - "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 if [[ $state = keyvalue ]]; then @@ -302,7 +302,7 @@ _hdiutil(){ "-erase[erase the media]" \ "-fullerase[erase all sectors of the disc]" \ "-list[list all burning devices with paths suitable for -device]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; makehybrid) @@ -343,7 +343,7 @@ _hdiutil(){ "(-nokernel)-nokernel[attach with a helper process]" \ "(-kernel)-kernel[attach without a helper process]" \ "-o:target disk image:_files" \ - "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; compact) @@ -356,7 +356,7 @@ _hdiutil(){ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ - "1:sparse image:_files -g \*.sparseimage" && return 0 + "1:sparse image:_files -g '*.sparseimage(-.)'" && return 0 ;; info) _arguments "$_common_options[@]" \ @@ -376,7 +376,7 @@ _hdiutil(){ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; chpass) @@ -386,7 +386,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "-oldstdinpass[specify old password from standard input]" \ "-newstdinpass[specify new password from standard input]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; unflatten) @@ -395,7 +395,7 @@ _hdiutil(){ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; flatten) @@ -408,7 +408,7 @@ _hdiutil(){ "(-noxml)-xml" \ "(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \ "(-norsrcfork)-rsrcfork" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; hfsanalyze) @@ -420,7 +420,7 @@ _hdiutil(){ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ - "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; mountvol) @@ -447,7 +447,7 @@ _hdiutil(){ "$_common_usage_options[-plist]" \ "-format[just print out the image format]" \ "-checksum[just print out the image checksum]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; plugins) @@ -462,7 +462,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "(-yes -no -query)"{-yes,-no,-query} \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 ;; @@ -485,7 +485,7 @@ _hdiutil(){ "-shrinkonly[only allow the image to shrink]" \ "-nofinalgap[allow elimination of trailing free partition]" \ "-limits[displays min/current/max size]" \ - "1:disk image:_files -g \*.dmg\(\|.bin\)" \ + "1:disk image:_files -g \*.dmg\(\|.bin\)\(-.\)" \ && return 0 ;; segment) @@ -501,7 +501,7 @@ _hdiutil(){ "-firstSegmentSize[first segment size]: :_hdiutil_imagesize" \ "-restricted[make restricted segments]" \ "-o[first segment name]:name" \ - "1:source disk image:_files -g \*.dmg\(\|.bin\)" \ + "1:source disk image:_files -g \*.dmg\(\|.bin\)\(-.\)" \ && return 0 ;; pmap) @@ -514,7 +514,7 @@ _hdiutil(){ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "-options[just print out the image checksum]: :->option" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ + "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ && return 0 case "$state" in diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak index 63bf2d06e..5aaaeefbc 100644 --- a/Completion/Debian/Command/_dak +++ b/Completion/Debian/Command/_dak @@ -137,7 +137,7 @@ case $cmd in (clean-proposed-updates) args+=( '(-v --verbose)'{-v,--verbose}'[be more verbose about what is being done]' - '*:changes or admin file:_files -g "*.(changes|joey)"' + '*:changes or admin file:_files -g "*.(changes|joey)(-.)"' ) ;; @@ -151,7 +151,7 @@ case $cmd in args+=( '(-q --quiet)'{-q,--quiet}'[be quieter about what is being done]' '(-v --verbose)'{-v,--verbose}'[be more verbose about what is being done]' - '*:changes or deb or admin file:_files -g "*.(changes|deb|joey)"' + '*:changes or deb or admin file:_files -g "*.(changes|deb|joey)(-.)"' ) ;; @@ -186,7 +186,7 @@ case $cmd in (decode-dot-dak) args+=( - '*:dot-dak file:_files -g "*.dak"' + '*:dot-dak file:_files -g "*.dak(-.)"' ) ;; @@ -222,7 +222,7 @@ case $cmd in args+=( '(-m --message)'{-m,--message=}'[use this message for rejection]:message:' '(-s --no-mail)'{-s,--no-mail}'[do not send any mail]' - '*:changes file:_files -g "*.changes"' + '*:changes file:_files -g "*.changes(-.)"' ) ;; diff --git a/Completion/Debian/Command/_debdiff b/Completion/Debian/Command/_debdiff index de7b9b9c8..6f8519a4a 100644 --- a/Completion/Debian/Command/_debdiff +++ b/Completion/Debian/Command/_debdiff @@ -17,6 +17,6 @@ _arguments \ '(-h --help)'{-h,--help}'[show help]' \ '(-v --version)'{-v,--version}'[show version]' \ '(-q --quiet)'{-q,--quiet}'[be quiet if no differences]' \ - '--from:debs:_files -g "*.deb"' \ - '--to:debs:_files -g "*.deb"' \ - '*:file to compare:_files -g "*.(deb|changes|dsc)"' + '--from:debs:_files -g "*.deb(-.)"' \ + '--to:debs:_files -g "*.deb(-.)"' \ + '*:file to compare:_files -g "*.(deb|changes|dsc)(-.)"' diff --git a/Completion/Debian/Command/_dpkg b/Completion/Debian/Command/_dpkg index e251fbc38..e7184e7cc 100644 --- a/Completion/Debian/Command/_dpkg +++ b/Completion/Debian/Command/_dpkg @@ -73,7 +73,7 @@ _dpkg_options=( _dpkg_options_recursive=( '(--recursive -R)'{--recursive,-R}'[recursive]' ) _dpkg_deb_and_query_only_actions=( - '(--show -W)'{--show,-W}'[show package info]:Debian package:_files -g \*.u\#deb' + '(--show -W)'{--show,-W}'[show package info]:Debian package:_files -g \*.u\#deb\(-.\)' ) _dpkg_deb_and_query_only_options=( diff --git a/Completion/Debian/Command/_linda b/Completion/Debian/Command/_linda index d428d18a8..12ca72f3e 100644 --- a/Completion/Debian/Command/_linda +++ b/Completion/Debian/Command/_linda @@ -23,4 +23,4 @@ _arguments \ '(-U --unpack)'{-U,--unpack}':unpack level:' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-V --version)'{-V,--version}'[version]' \ - ':package:_files -g "*.(changes|u#deb|dsc)"' + ':package:_files -g "*.(changes|u#deb|dsc)(-.)"' diff --git a/Completion/Debian/Command/_lintian b/Completion/Debian/Command/_lintian index 478d77a63..554be4550 100644 --- a/Completion/Debian/Command/_lintian +++ b/Completion/Debian/Command/_lintian @@ -38,7 +38,7 @@ case "$service" in '(-s --source)'{-s,--source}'[the following packages are source]' \ '--udeb[the following packages are udebs]' \ '(-p --packages-file)'{-p,--packages-file}'[process packages listed in file]:list:_files' \ - '*:package:_files -g "*.(changes|deb|dsc)"' && return 0 + '*:package:_files -g "*.(changes|deb|dsc)(-.)"' && return 0 ;; (lintian-info) diff --git a/Completion/Debian/Command/_pbuilder b/Completion/Debian/Command/_pbuilder index 225744f23..7811d567b 100644 --- a/Completion/Debian/Command/_pbuilder +++ b/Completion/Debian/Command/_pbuilder @@ -9,7 +9,7 @@ if (( CURRENT == 2 )); then else compset -n 1 _arguments \ - '--basetgz:location:_files -g "*.tgz"' \ + '--basetgz:location:_files -g "*.tgz(-.)"' \ '--buildplace:location:_files -/' \ '--buildresult:location:_files -/' \ '--mirror:URL:_urls' \ @@ -28,5 +28,5 @@ else '--save-after-login' \ '--save-after-exec' \ '--autocleanaptcache' \ - '*:source package:_files -g "*.dsc"' + '*:source package:_files -g "*.dsc(-.)"' fi diff --git a/Completion/Debian/Command/_piuparts b/Completion/Debian/Command/_piuparts index 83e9ef115..a1b6666a3 100644 --- a/Completion/Debian/Command/_piuparts +++ b/Completion/Debian/Command/_piuparts @@ -24,7 +24,7 @@ case "$state" in if (( $+opt_args[-a] )); then _deb_packages avail else - _files -g '*.deb' + _files -g '*.deb(-.)' fi ;; esac diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index 48aeee973..39e00b4b0 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -117,7 +117,7 @@ _modutils() { _tags files modules while _tags; do - _requested files expl "module file" _files -g '*.ko' && ret=0 + _requested files expl "module file" _files -g '*.ko(-.)' && ret=0 _requested modules expl module compadd -a modules && ret=0 done ;; diff --git a/Completion/Mandriva/Command/_urpmi b/Completion/Mandriva/Command/_urpmi index 36982aae8..2468b2318 100644 --- a/Completion/Mandriva/Command/_urpmi +++ b/Completion/Mandriva/Command/_urpmi @@ -303,7 +303,7 @@ _urpmi() { "($help --all --interactive --name)--summary[print tag summary: summary]" \ "($help)--uniq[do not print identical lines]" \ "($help --all --interactive --name)--url[print tag url: url]" \ - "*:hdlist files:_files -g '*.cz'" \ + "*:hdlist files:_files -g '*.cz(-.)'" \ && ret=0 ;; esac diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index a89b7d923..e54c6c0d2 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -200,6 +200,7 @@ _slrn _socket _sort _spamassassin +_sqlite _sqsh _ssh _stgit @@ -239,6 +240,7 @@ _unison _units _user_admin _uzbl +_vcsh _vim _vorbis _vorbiscomment diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent index 8c31a11ae..f7da2047a 100644 --- a/Completion/Unix/Command/_bittorrent +++ b/Completion/Unix/Command/_bittorrent @@ -50,18 +50,18 @@ case $service in "--max_initiate+[specify peers needed before stopping initiating new connections]:peers:"\ "--report_hash_failures+[report hash failures to user]:enable:(0 1)"\ "--rarest_first_priority_cutoff+[specify peers which need to have a piece before other partials take priority over rarest first]:peers:"\ - ':torrent file:_files -g "*.torrent"' \ + ':torrent file:_files -g "*.torrent(-.)"' \ && return 0 ;; # Next up are the torrent file manipulation programs. btshowmetainfo) - _files -g "*.torrent" && return 0 + _files -g "*.torrent(-.)" && return 0 ;; btrename) - _files -g '*.torrent' && return 0 + _files -g '*.torrent(-.)' && return 0 ;; btmakemetafile) @@ -74,7 +74,7 @@ case $service in ;; btreannounce) - _files -g '*.torrent' && return 0 + _files -g '*.torrent(-.)' && return 0 ;; # Lastly the tracker. diff --git a/Completion/Unix/Command/_bogofilter b/Completion/Unix/Command/_bogofilter index 980d3155e..44953cc71 100644 --- a/Completion/Unix/Command/_bogofilter +++ b/Completion/Unix/Command/_bogofilter @@ -29,16 +29,16 @@ _bogoutil() { {-y,--timestamp-date=}'[date for when unknown]:date in YYYYMMDD format' \ '(--input-file -I)'{-I,--input-file=}'[input file]:input file:_files' \ {-x,--debug-flags=}'[debug flags]:debug flags:' \ - "($_bogoutil_actions)"{-d,--dump=}'[print contents of db]:database file:_files -g "*.db"' \ + "($_bogoutil_actions)"{-d,--dump=}'[print contents of db]:database file:_files -g "*.db(-.)"' \ "($_bogoutil_actions)"{-l,--load=}'[load file into db]:textfile:_files' \ - "($_bogoutil_actions)"{-u,--upgrade=}'[upgrade wordlist version]:database file:_files -g "*.db"' \ + "($_bogoutil_actions)"{-u,--upgrade=}'[upgrade wordlist version]:database file:_files -g "*.db(-.)"' \ "($_bogoutil_actions)"'-m[perform maintenance functions]:file:_files' \ "($_bogoutil_actions)"'-w[display token information]:database file or directory:_files' \ "($_bogoutil_actions)"'-p[display token probability information]:database file or directory:_files' \ "($_bogoutil_actions)"'-H[print histogram]:database file or directory:_files' \ "($_bogoutil_actions)"'-r[recalculate ROBX]:database:_files -/' \ "($_bogoutil_actions)"'-R[recalculate and save ROBX]:database:_files -/' \ - "($_bogoutil_actions)"{-k,--db-cachesize=}'[set Berkeley DB cache size]:size in MB:' \ + "($_bogoutil_actions)"{-k,--db-cachesize=}'[set Berkeley DB cache size]:size in MB' \ "($_bogoutil_actions)"'--db-verify[verify database]:database:_files -/' \ "($_bogoutil_actions)"'--db-recover[run regular recovery]:database:_files -/' \ "($_bogoutil_actions)"'--db-recover-harder[run catastrophic recovery]:database:_files -/' \ diff --git a/Completion/Unix/Command/_cdrdao b/Completion/Unix/Command/_cdrdao index e22ceb509..ce3742bc7 100644 --- a/Completion/Unix/Command/_cdrdao +++ b/Completion/Unix/Command/_cdrdao @@ -91,7 +91,7 @@ common_args=( declare -ga common_toc_args common_toc_args=( $common_args - ':TOC file:_files -g "*.toc"') + ':TOC file:_files -g "*.toc(-.)"') declare -ga common_device_args common_device_args=( diff --git a/Completion/Unix/Command/_cplay b/Completion/Unix/Command/_cplay index 3b4219173..f1755c1a1 100644 --- a/Completion/Unix/Command/_cplay +++ b/Completion/Unix/Command/_cplay @@ -5,4 +5,4 @@ _arguments -s \ '-r[toggle playlist repeat mode]' \ '-R[toggle playlist random mode]' \ '-v[toggle PCM and MASTER volume control]' \ - '*:playlist or directory or audio file:_files -g "*.(mp3|mp2|ogg|669|amf|ams|dsm|far|it|med|mod|mt2|mtm|okt|s3m|stm|ult|gdm|xm|m3u|pls|spx|wav|au)"' + '*:playlist or directory or audio file:_files -g "*.(mp3|mp2|ogg|669|amf|ams|dsm|far|it|med|mod|mt2|mtm|okt|s3m|stm|ult|gdm|xm|m3u|pls|spx|wav|au)(-.)"' diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8a48c04b7..5ed921850 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -3636,7 +3636,7 @@ _git-index-pack () { '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ - ':pack file:_files -g "*.pack"' + ':pack file:_files -g "*.pack(-.)"' } (( $+functions[_git-merge-file] )) || @@ -4075,7 +4075,7 @@ _git-pack-redundant () { '(:)--all[process all packs]' \ '--alt-odb[do not require objects to be present in local packs]' \ '--verbose[output some statistics to standard error]' \ - '(--all)*::packs:_files -g "*.pack"' + '(--all)*::packs:_files -g "*.pack(-.)"' } (( $+functions[_git-rev-list] )) || diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index aeb64f660..f48598278 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -420,8 +420,8 @@ _hg_cmd_backout() { '--parent[parent to choose when backing out merge]' \ '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ - '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ - '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' + '(--message -m)'{-m+,--message}'[specify commit message]:text' \ + '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' } _hg_cmd_bisect() { @@ -472,8 +472,8 @@ _hg_cmd_clone() { _hg_cmd_commit() { _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ - '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ - '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \ + '(--message -m)'{-m+,--message}'[specify commit message]:text' \ + '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' \ '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ '*:file:_hg_files' diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd index e739181d6..d59294717 100644 --- a/Completion/Unix/Command/_ldd +++ b/Completion/Unix/Command/_ldd @@ -28,5 +28,5 @@ fi _arguments $args \ '*: : _alternative - "executables:executable:_files -g \^\*.so\(\*\)" - "shared-objects:shared object:_files -g \*.so"' + "executables:executable:_files -g \^\*.so\(\-\*\)" + "shared-objects:shared object:_files -g \*.so\(-.\)"' diff --git a/Completion/Unix/Command/_metaflac b/Completion/Unix/Command/_metaflac index e6cd13e13..14095e9f9 100644 --- a/Completion/Unix/Command/_metaflac +++ b/Completion/Unix/Command/_metaflac @@ -50,7 +50,7 @@ _metaflac_opers=( ) _arguments "$_metaflac_opts[@]" \ - "*:FLAC file:_files -g \*.flac" \ + "*:FLAC file:_files -g \*.flac\(-.\)" \ - "shortcuts" \ "$_metaflac_shorts[@]" \ - "(operations)" \ diff --git a/Completion/Unix/Command/_osc b/Completion/Unix/Command/_osc index c15b40af2..a18890f5e 100644 --- a/Completion/Unix/Command/_osc +++ b/Completion/Unix/Command/_osc @@ -16,8 +16,8 @@ # version 0.2 # -OSC_BUILD_TARGETS="openSUSE_10.2 openSUSE_10.3 openSUSE_11.0 openSUSE_11.1 openSUSE_11.2 openSUSE_11.3 openSUSE_Factory" -OSC_PROJECTS="openSUSE:Factory openSUSE:11.2 openSUSE:11.3 openSUSE:11.1 openSUSE:11.0 openSUSE:10.3" +OSC_BUILD_TARGETS="openSUSE_11.2 openSUSE_11.3 openSUSE_11.4 openSUSE_12.1 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP1" +OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.1 openSUSE:11.4 openSUSE:11.2 openSUSE:11.3" # user defined variables $OSC_BUILD_TARGETS_EXTRA and # $OSC_PROJECTS_EXTRA can add to the project/build target list diff --git a/Completion/Unix/Command/_pax b/Completion/Unix/Command/_pax index 5d0edac88..7ebaa6aa5 100644 --- a/Completion/Unix/Command/_pax +++ b/Completion/Unix/Command/_pax @@ -19,7 +19,7 @@ _arguments -s \ 123b 124b 125b 126b)' \ '-c[match all but specified]' \ '-d[match only directory but not contents]' \ - '-f:archive:_files -g "*.(tar|cpio)"' \ + '-f:archive:_files -g "*.(tar|cpio)(-.)"' \ '-i[interactively rename files]' \ '-j[filter archive through bzip2]' \ '-k[do not overwrite existing files]' \ diff --git a/Completion/Unix/Command/_rubber b/Completion/Unix/Command/_rubber index 526abaaa8..09e289aa2 100644 --- a/Completion/Unix/Command/_rubber +++ b/Completion/Unix/Command/_rubber @@ -43,7 +43,7 @@ case "$service" in {-f,--force}'[force at least one compilation]' \ '--inplace[compile the documents from their source directory]' \ \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' \ - '*:LaTeX files:_files -g \*.\(tex\|dtx\|lhs\|w\)' + '*:LaTeX files:_files -g "*.(tex|dtx|lhs|w)(-.)"' return 0 ;; @@ -64,7 +64,7 @@ case "$service" in '--errors[show all errors that occured during compilation]' \ '--refs[show the list of undefined references]' \ '--warnings[show all LaTeX warnings]' \ - ':LaTeX file:_files -g \*.\(tex\|dtx\|lhs\|w\)' + ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"' return 0 ;; esac diff --git a/Completion/Unix/Command/_sisu b/Completion/Unix/Command/_sisu index d3d53275b..6ca2abfaa 100644 --- a/Completion/Unix/Command/_sisu +++ b/Completion/Unix/Command/_sisu @@ -59,4 +59,4 @@ _arguments -s -C -M 'r:|[_-]=* r:|=*' \ '--to=dom[XML dom based input representation, experimental]' \ '--convert=footnotes[embedded footnotes]' \ '--to=current[current markup]' \ - '*:SiSU files:_files -g "*.(sst|ssm)(.)"' + '*:SiSU files:_files -g "*.(sst|ssm)(-.)"' diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite new file mode 100644 index 000000000..05027c603 --- /dev/null +++ b/Completion/Unix/Command/_sqlite @@ -0,0 +1,50 @@ +#compdef sqlite sqlite3 + +local ret opt display_opt sqlite3 +local -a options output_modes exclusive dashes + +[[ $service = sqlite3 ]] && sqlite3=true || unset sqlite3 + +# sqlite options require a single hyphen, but +# sqlite3 allows options with one or two +dashes=( '' ) +(( $+sqlite3 )) && dashes+=( - ) + +options=( + '(-init --init)'$^dashes'-init[startup file]:file containing SQLite commands:_files' + $^dashes'-echo[echo commands]' +) + +exclusive=( {,-}-{no,}header ) +options+=( + "($exclusive)"$^dashes'-header[turn headers on]' + "($exclusive)"$^dashes'-noheader[turn headers off]' +) + +output_modes=( column HTML line list ) +(( $+sqlite3 )) && output_modes+=( csv ) +exclusive=( $^dashes-${^output_modes:l} ) +for display_opt in $output_modes ; do + # finagle the description to match the way SQLite's -help formats them + opt=$display_opt:l + [[ $opt = $display_opt ]] && display_opt="'$display_opt'" + options+=( "($exclusive)"$^dashes"-${opt}[set output mode to $display_opt]" ) +done + +options+=( + $^dashes'-separator[set output field separator]:string to separate output fields:' + $^dashes'-nullvalue[set null value string]:string for NULL values:' + '(- :)'$^dashes'-version[show SQLite version]' + '(- :)'$^dashes'-help[show help]' + '1:SQLite database file:_files' + '(- :)2:SQL to run' +) + +(( $+sqlite3 )) && options+=( + $^dashes'-bail[stop after hitting an error]' + '(-*batch -*interactive)'$^dashes'-batch[force batch I/O]' + '(-*batch -*interactive)'$^dashes'-interactive[force interactive I/O]' + $^dashes'-stats[print memory stats before each finalize]' +) + +_arguments $options diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit index 129b21a92..b2f2aeafa 100644 --- a/Completion/Unix/Command/_stgit +++ b/Completion/Unix/Command/_stgit @@ -29,7 +29,7 @@ else ;; (edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide) _wanted -V "patches" expl "patch" \ - compadd $(stg series --noprefix > /dev/null) \ + compadd $(stg series --noprefix 2> /dev/null) \ && ret=0 ;; (*) diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 21d809dd1..11d0b69e4 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -18,7 +18,7 @@ _svn () { if [[ -n $state ]] && (( ! $+_svn_cmds )); then typeset -gHA _svn_cmds - if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then + if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( ${=${(f)${${"$(LC_ALL=C _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) @@ -31,7 +31,7 @@ _svn () { _wanted commands expl 'svn command' _svn_commands && ret=0 ;; args) - local cmd args usage + local cmd args usage idx typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" @@ -50,6 +50,9 @@ _svn () { args=( ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) + while (( idx=$args[(I)*--c(l|hangelist):arg:] )); do + args[(I)*--c(l|hangelist):arg:]=( \*{--cl,--changelist}':change list:_svn_changelists' ) + done _store_cache svn-${cmd}-args args fi @@ -92,6 +95,9 @@ _svn () { '*:file:_files -g "*(e:_svn_controlled:)"' ) ;; + (mergeinfo) + args[(r)--show-revs:arg:]=( '--show-revs:revisions:(merged eligible)' ) + ;; (propget|propedit) args+=( '1:property name:_svn_props' @@ -281,7 +287,7 @@ _svn_urls() { if [[ ! -prefix *://? ]] ; then zstyle -a ":completion:${curcontext}:" url-schemas urlsch \ || urlsch=( file:// http:// https:// svn:// svn+ssh:// ) - + if (( $#urlsch )) ; then compset -S '[^:]*' _wanted url-schemas expl 'URL schema' compadd -S '' - $urlsch[@] && ret=0 @@ -309,6 +315,14 @@ _svn_props() { compadd "$@" -a properties && return 0 } +(( $+functions[_svn_changelists] )) || +_svn_changelists() { + local cls + + cls=( ${${${(M)${(f)"$(LC_ALL=C _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) + compadd "$@" -a cls && return 0 +} + _subversion () { case $service in (svn) _svn "$@" ;; diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index 384e9358b..f8543f865 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -3,7 +3,7 @@ local curcontext="$curcontext" environ e local -a args -zstyle -a "$curcontext" environ environ +zstyle -a ":completion:${curcontext}:" environ environ for e in "${environ[@]}" do local -x "$e" diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl index 69adcf775..3f54092a1 100644 --- a/Completion/Unix/Command/_systemctl +++ b/Completion/Unix/Command/_systemctl @@ -43,6 +43,7 @@ _systemctl() '--global[Enable/disable unit files globally]' \ {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ '--defaults[When disabling unit files, remove default symlinks only]' \ + '--root=[Enable unit files in the specified root directory]:directory:_directories' \ '*::systemctl command:_systemctl_command' } @@ -73,8 +74,13 @@ _hosts_or_user_at_host() "status:Show runtime status of one or more units" "show:Show properties of one or more units/jobs or the manager" "reset-failed:Reset failed state for all, one, or more units" + "list-unit-files:List installed unit files" "enable:Enable one or more unit files" "disable:Disable one or more unit files" + "preset:Enable/disable one or more unit files based on preset configuration" + "mask:Mask one or more units" + "unmask:Unmask one or more units" + "link:Link one or more units into the search path" "is-enabled:Check whether unit files are enabled" "load:Load one or more units" "list-jobs:List jobs" diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 405de2629..12d964e3f 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -157,7 +157,7 @@ case $state in _tags $tags while _tags; do if _requested files expl 'info file'; then - _files "$expl[@]" $infopath -g '*.info' && ret=0 + _files "$expl[@]" $infopath -g '*.info(-.)' && ret=0 fi if _requested items; then items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]}) diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh new file mode 100644 index 000000000..89588e4b2 --- /dev/null +++ b/Completion/Unix/Command/_vcsh @@ -0,0 +1,18 @@ +#compdef vcsh + +_arguments \ + ':subcommand:(( + clone\:"clone from repo" + help\:"display help" + delete\:"delete repo" + enter\:"Enter repo; spawn new \$SHELL" + init\:"init & clone from repo" + list\:"list all repos" + list-tracked\:"list all files tracked by vcsh" + list-tracked-by\:"list files tracked by a repo" + rename\:"rename repo" + run\:"run command on repo" + setup\:"set up repo with recommended settings" + write-gitignore\:"write .gitignore.d/foo via git ls-files" + \<REPO\>\:"Run git command directly" + ))' diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 7aec1ecf7..2c9b0a1a4 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -46,7 +46,7 @@ arguments=( '-D[debugging mode]' '-n[no swap file (memory only)]' '-nb[start as NetBean server]' - {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g \*.sw\?' + {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"' '( -H -F)-A[start in Arabic mode]' '(-A -F)-H[start in Hebrew mode]' '(-A -H )-F[start in Farsi mode]' diff --git a/Completion/Unix/Command/_vorbiscomment b/Completion/Unix/Command/_vorbiscomment index 4cefe1a1a..bd7459e04 100644 --- a/Completion/Unix/Command/_vorbiscomment +++ b/Completion/Unix/Command/_vorbiscomment @@ -13,6 +13,6 @@ _arguments \ '(-l)-w[overwrite comments]' \ '(-l -c)-t[tag and value]:: ' \ '(-l -t)-c[tag file]::_files' \ - '1:OGG file:_files -g \*.ogg' \ - '(-l)2:output OGG file:_files -g \*.ogg' \ + '1:OGG file:_files -g "*.ogg(-.)"' \ + '(-l)2:output OGG file:_files -g "*.ogg(-.)"' \ && return 0 diff --git a/Completion/Unix/Command/_xmms2 b/Completion/Unix/Command/_xmms2 index 95ea04b33..525d5177c 100644 --- a/Completion/Unix/Command/_xmms2 +++ b/Completion/Unix/Command/_xmms2 @@ -198,7 +198,7 @@ _xmms2_radd() { _xmms2_addpls() { local expl _description files expl 'playlist' - _files "$expl[@]" -g '*.([mM]3[uU]|[pP][lL][sS])' + _files "$expl[@]" -g '*.([mM]3[uU]|[pP][lL][sS])(-.)' } _xmms2() { diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 393c0c67e..22d2aaeba 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -82,6 +82,18 @@ if [[ -n $need_desc ]]; then else _wanted commands expl 'external command' compadd "$@" -k commands && ret=0 fi +if [[ -o path_dirs ]]; then + local -a path_dirs + path_dirs=(${^path}/*(/N:t)) + (( ${#path_dirs} )) && + _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0 + + if [[ $PREFIX$SUFFIX = */* ]]; then + # Find command from path, not hashed + _wanted commands expl 'external command' _path_files -W path -g '*(*)' && + ret=0 + fi +fi return $ret } diff --git a/Completion/Unix/Type/_services b/Completion/Unix/Type/_services index 496054795..3dd1e1231 100644 --- a/Completion/Unix/Type/_services +++ b/Completion/Unix/Type/_services @@ -10,7 +10,7 @@ if [[ $OSTYPE = freebsd* ]]; then _wanted services expl service compadd "$@" - $alls[@] && ret=0 fi elif chkconfig --list > /dev/null 2>&1; then - alls=( ${(f)"$(LANGUAGE=C LANG=C LC_ALL=C chkconfig --list)"} ) + alls=( ${(f)"$(LANGUAGE=C LANG=C LC_ALL=C chkconfig --list 2> /dev/null)"} ) inits=( ${${${alls[1,(r)xinetd based*]}[1,-2]}/%[[:space:]]*/} ) xinetds=( ${${${${alls[(r)xinetd based*,-1]}[2,-1]}/#[[:space:]]#}/%:*} ) diff --git a/Completion/X/Command/.distfiles b/Completion/X/Command/.distfiles index 3b6dc49fa..c6835ea54 100644 --- a/Completion/X/Command/.distfiles +++ b/Completion/X/Command/.distfiles @@ -20,6 +20,7 @@ _urxvt _vnc _x_utils _xauth +_xclip _xdvi _xfig _xloadimage diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer index 85c4f6d12..81669fc1c 100644 --- a/Completion/X/Command/_mplayer +++ b/Completion/X/Command/_mplayer @@ -115,12 +115,12 @@ case "$state" in _tags files urls while _tags; do _requested files expl 'video file' _files -g \ - "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|qt|rm|vob|wav|webm|wma|wmv)(-.)" && ret=0 + "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|qt|rm|vob|wav|webm|wma|wmv)(-.)" && ret=0 if _requested urls; then while _next_label urls expl URL; do _urls "$expl[@]" && ret=0 - compadd -S '' "$expl[@]" {dvd,vcd,cdda,cddb,tv}:// && ret=0 - done + compadd -S '' "$expl[@]" {dvd,vcd,cdda,cddb,tv}:// && ret=0 + done fi (( ret )) || return 0 done diff --git a/Completion/X/Command/_xclip b/Completion/X/Command/_xclip new file mode 100644 index 000000000..759251c28 --- /dev/null +++ b/Completion/X/Command/_xclip @@ -0,0 +1,14 @@ +#compdef xclip + +_arguments \ + '(-i -in -o -out)'{-i,-in}'[Read text into X selection]' \ + '(-i -in -o -out)'{-o,-out}'[Print selection to standard out]' \ + {-l,-loops}'[Number of selection requests to wait before exiting]:number:' \ + {-d,-display}'[X display to connect to]:X11 display:' \ + '(-)'{-h,-help}'[Usage information]' \ + '(-selection)-selection[Selection to access]:selection:(primary secondary clipboard buffer-cut)' \ + $'-noutf8[Use old Unicode, don\'t treat text as UTF-8]' \ + '(-)-version[version information]' \ + '(-quiet -verbose)-silent[Errors only, run in background]' \ + $'(-silent -verbose)-quiet[Run in foreground, show what\'s happening]' \ + '(-silent -quiet)-verbose[Running commentary]' diff --git a/Completion/X/Command/_xterm b/Completion/X/Command/_xterm index a246ab48e..7619b280a 100644 --- a/Completion/X/Command/_xterm +++ b/Completion/X/Command/_xterm @@ -9,6 +9,7 @@ _xt_arguments \ '-cc:character class:' \ '-cr:text cursor color:_x_color' \ '-e:program: _command_names -e:*::program arguments: _normal' \ + '-fa:font pattern:_xft_fonts' \ '-fb:bold font:_x_font' \ '-fi:icon font:_x_font' \ '-hc:background color for highlighted text:_x_color' \ diff --git a/Completion/X/Type/.distfiles b/Completion/X/Type/.distfiles index 364e4e6e6..fa5c16ce0 100644 --- a/Completion/X/Type/.distfiles +++ b/Completion/X/Type/.distfiles @@ -6,4 +6,5 @@ _x_colormapid _x_keysym _x_title _x_cursor _x_locale _x_window _x_display _x_modifier _xt_session_id _x_extension _x_name _x_visual +_xft_fonts ' diff --git a/Completion/X/Type/_xft_fonts b/Completion/X/Type/_xft_fonts new file mode 100644 index 000000000..0d5f56fe5 --- /dev/null +++ b/Completion/X/Type/_xft_fonts @@ -0,0 +1,43 @@ +#compdef fc-list fc-match + +local -a suf +local font=${${PREFIX//-[0-9]##:/:}%:*}: ret=1 +local attr + +compset -S ':*' || suf=( -S: -r "-: \t\n\-" ) +if compset -P '*:'; then + attr="${PREFIX%\=*}" + if compset -P '*='; then + case $attr in + hintstyle) + _wanted value expl 'value' compadd "$suf[@]" \ + hint{none,slight,medium,full} && ret=0 + ;; + *) + _wanted value expl 'value' compadd "$suf[@]" \ + ${${(f)"$(_call_program font-attrs + fc-list $font $attr 2>/dev/null)"//,/$'\n'}##*=} && ret=0 + ;; + esac + else + _tags elements {weight,slant}-constants + while _tags; do + _requested elements expl element compadd -qS= hintstyle hinting autohint \ + size ${${(u)${(M)${(f)"$(_call_program elements + fc-list -v $font 2>/dev/null)"}:# [a-z]*}%%:*}#?} && ret=0 + _requested weight-constants expl 'weight constant' compadd "$suf[@]" \ + thin bold regular medium semibold heavy roman && ret=0 + _requested slant-constants expl 'slant constant' compadd "$suf[@]" \ + roman italic oblique && ret=0 + + (( ret )) || break + done + fi +elif compset -P '*[^\\]-'; then + _message -e size 'point size' && ret=0 +else + _wanted fonts expl font compadd "$suf[@]" \ + ${${(f)"$(_call_program fonts fc-list 2>/dev/null)"//,/$'\n'}%%:*} && ret=0 +fi + +return ret diff --git a/Completion/bashcompinit b/Completion/bashcompinit index 63101a9c8..6cc3be580 100644 --- a/Completion/bashcompinit +++ b/Completion/bashcompinit @@ -8,7 +8,7 @@ _bash_complete() { local COMP_LINE="$words" local -A savejobstates savejobtexts - (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX )) + (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX )) (( COMP_CWORD = CURRENT - 1)) COMP_WORDS=( $words ) BASH_VERSINFO=( 2 05b 0 1 release ) @@ -18,15 +18,15 @@ _bash_complete() { [[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=( -S '' ) - matches=( ${(f)"$(compgen $@)"} ) + matches=( ${(f)"$(compgen $@ -- ${words[CURRENT]})"} ) if [[ -n $matches ]]; then if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then compset -P '*/' && matches=( ${matches##*/} ) compset -S '/*' && matches=( ${matches%%/*} ) - compadd -f "${suf[@]}" -a matches && ret=0 + compadd -Q -f "${suf[@]}" -a matches && ret=0 else - compadd "${suf[@]}" -a matches && ret=0 + compadd -Q "${suf[@]}" -a matches && ret=0 fi fi @@ -41,18 +41,12 @@ _bash_complete() { return ret } -_compgen_opt_words() { - typeset -a words - words=( ${~=1} ) - local find="$2" - results=(${(M)words[@]:#$find*}) -} - compgen() { local opts prefix suffix job OPTARG OPTIND ret=1 local -a name res results jids local -A shortopts + # words changes behavior: words[1] -> words[0] emulate -L sh setopt kshglob noshglob braceexpand nokshautoload @@ -127,12 +121,13 @@ compgen() { ;; F) COMPREPLY=() + local -a args + args=( "${words[0]}" "${@[-1]}" "${words[CURRENT-2]}" ) (){ - set -- "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}" # There may be more things we need to add to this typeset to # protect bash functions from compsys special variable names typeset -h words - $OPTARG "$@" + $OPTARG "${args[@]}" } results+=( "${COMPREPLY[@]}" ) ;; @@ -141,7 +136,7 @@ compgen() { results+=( ${~OPTARG} ) unsetopt nullglob ;; - W) _compgen_opt_words "$OPTARG" "${@[-1]}" ;; + W) results+=( ${(Q)~=OPTARG} ) ;; C) results+=( $(eval $OPTARG) ) ;; P) prefix="$OPTARG" ;; S) suffix="$OPTARG" ;; @@ -157,10 +152,9 @@ compgen() { # support for the last, `word' option to compgen. Zsh's matching does a # better job but if you need to, comment this in and use compadd -U - #shift $(( OPTIND - 1 )) - #(( $# )) && results=( "${(M)results[@]:#$1*}" ) + # (( $# >= OPTIND)) && results=( "${(M)results[@]:#${@[-1]}*}" ) - print -l -- "$prefix${^results[@]}$suffix" + print -l -r -- "$prefix${^results[@]}$suffix" } complete() { diff --git a/Completion/openSUSE/Command/_osc b/Completion/openSUSE/Command/_osc index c15b40af2..a18890f5e 100644 --- a/Completion/openSUSE/Command/_osc +++ b/Completion/openSUSE/Command/_osc @@ -16,8 +16,8 @@ # version 0.2 # -OSC_BUILD_TARGETS="openSUSE_10.2 openSUSE_10.3 openSUSE_11.0 openSUSE_11.1 openSUSE_11.2 openSUSE_11.3 openSUSE_Factory" -OSC_PROJECTS="openSUSE:Factory openSUSE:11.2 openSUSE:11.3 openSUSE:11.1 openSUSE:11.0 openSUSE:10.3" +OSC_BUILD_TARGETS="openSUSE_11.2 openSUSE_11.3 openSUSE_11.4 openSUSE_12.1 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP1" +OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.1 openSUSE:11.4 openSUSE:11.2 openSUSE:11.3" # user defined variables $OSC_BUILD_TARGETS_EXTRA and # $OSC_PROJECTS_EXTRA can add to the project/build target list diff --git a/Config/version.mk b/Config/version.mk index 4fe21a1dd..38715c29d 100644 --- a/Config/version.mk +++ b/Config/version.mk @@ -27,5 +27,5 @@ # This must also serve as a shell script, so do not add spaces around the # `=' signs. -VERSION=4.3.15 -VERSION_DATE='December 17, 2011' +VERSION=4.3.16 +VERSION_DATE='February 19, 2011' diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 665c0d454..135a60a41 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1333,7 +1333,7 @@ item(tt(environ))( The environ style is used when completing for `tt(sudo)'. It is set to an array of `var(VAR)tt(=)var(value)' assignments to be exported into the local environment before the completion for the target command is invoked. -example(zstyle :complete:sudo: environ \ +example(zstyle ':completion:*:sudo::' environ \ PATH="/sbin:/usr/sbin:$PATH" HOME="/root") ) kindex(expand, completion style) diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo index 30fec79c6..1eb358ea3 100644 --- a/Doc/Zsh/grammar.yo +++ b/Doc/Zsh/grammar.yo @@ -508,7 +508,7 @@ func+LPAR()RPAR() { echo Do something with $* }) -Because aliases are expanded in function defintions, this causes the +Because aliases are expanded in function definitions, this causes the following command to be executed: example(noglob func+LPAR()RPAR() { diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 68247264f..dd237c0ef 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -567,12 +567,12 @@ tt(IGNORE_BRACES), this option does not disable brace expansion. For example, with both options unset a function may be defined in the following fashion: -example(args() { echo $# }) +example(args+LPAR()RPAR() { echo $# }) while if either option is set, this does not work and something equivalent to the following is required: -example(args() { echo $#; }) +example(args+LPAR()RPAR() { echo $#; }) ) pindex(KSH_GLOB) @@ -1155,6 +1155,20 @@ Whenever a command name is hashed, hash the directory containing it, as well as all directories that occur earlier in the path. Has no effect if neither tt(HASH_CMDS) nor tt(CORRECT) is set. ) +pindex(HASH_EXECUTABLES_ONLY) +pindex(NO_HASH_EXECUTABLES_ONLY) +pindex(HASHEXECUTABLESONLY) +pindex(NOHASHEXECUTABLESONLY) +cindex(hashing, of executables) +cindex(executables, hashing) +item(tt(HASH_EXECUTABLES_ONLY))( +When hashing commands because of tt(HASH_COMMANDS), check that the +file to be hashed is actually an executable. This option +is unset by default as if the path contains a large number of commands, +or consists of many remote files, the additional tests can take +a long time. Trial and error is needed to show if this option is +beneficial. +) pindex(MAIL_WARNING) pindex(NO_MAIL_WARNING) pindex(MAILWARNING) diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 752247461..d3624b1ce 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -370,6 +370,7 @@ xitem(tt(zle) tt(-U) var(string)) xitem(tt(zle) tt(-K) var(keymap)) xitem(tt(zle) tt(-F) [ tt(-L) ] [ var(fd) [ var(handler) ] ]) xitem(tt(zle) tt(-I)) +xitem(tt(zle) tt(-T) [ tt(tc) var(function) | tt(-r) tt(tc) | tt(-L) ] ) item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( The tt(zle) builtin performs a number of different actions concerning ZLE. @@ -572,6 +573,33 @@ this may have been by a previous call to `tt(zle -I)' or by a system notification. To test if a zle widget may be called at this point, execute tt(zle) with no arguments and examine the return status. ) +item(tt(-T))( +This is used to add, list or remove internal transformations on the +processing performed by the line editor. It is typically used only for +debugging or testing and is therefore of little interest to the general +user. + +`tt(zle -T) var(transformation) var(func)' specifies that the +given var(transformation) (see below) is effected by shell function +var(func). + +`tt(zle -Tr) var(transformation)' removes the given var(transformation) +if it was present (it is not an error if none was). + +`tt(zle -TL)' can be used to list all transformations currently in +operation. + +Currently the only transformation is tt(tc). This is used instead +of outputting termcap codes to the terminal. When the transformation is +in operation the shell function is passed the termcap code that would be +output as its first argument; if the operation required a numeric +argument, that is passed as a second argument. The function should set +the shell variable tt(REPLY) to the transformed termcap code. Typically +this is used to produce some simply formatted version of the code and +optional argument for debugging or testing. Note that this +transformation is not applied to other non-printing characters such as +carriage returns and newlines. +) item(var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is active; normally this will be within a user-defined widget. diff --git a/Etc/ChangeLog-3.1 b/Etc/ChangeLog-3.1 index 4327435ea..a1a553794 100644 --- a/Etc/ChangeLog-3.1 +++ b/Etc/ChangeLog-3.1 @@ -5777,7 +5777,7 @@ * Sven: 10272, 10275: Doc/Zsh/builtins.yo, Src/builtin.c, Src/exec.c: autoload can force zsh/ksh styles with -z, -k; integrate execautofn() and loadautofn(). Side effect that -kX must run the - code to get at the function defintion. + code to get at the function definition. * Sven: 10273: Src/Zle/complete.c: problem with test for empty prefix. diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 8db9b6d0c..4036e8d1e 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -302,7 +302,7 @@ sect(On what machines will it run?) sect(What's the latest version?) Zsh 4.2.7 is the latest production version. The latest development - version is 4.3.15; this contains support for multibyte character strings + version is 4.3.16; this contains support for multibyte character strings (such as UTF-8 locales). All the main features for multibyte support are now in place and this is likely soon to become the stable series 5.0. diff --git a/Functions/Prompts/prompt_redhat_setup b/Functions/Prompts/prompt_redhat_setup index 5bde7f9ab..5adf2d7cf 100644 --- a/Functions/Prompts/prompt_redhat_setup +++ b/Functions/Prompts/prompt_redhat_setup @@ -3,7 +3,7 @@ # Styled like the default prompt in Red Hat 5.1 # prompt_redhat_setup () { - PS1="[%n@%m %1~]\\$ " + PS1='[%n@%m %1~]%(#.#.$) ' PS2="> " prompt_opts=( cr percent ) diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit index b07eabb1f..66e73a7a5 100644 --- a/Functions/Prompts/promptinit +++ b/Functions/Prompts/promptinit @@ -155,8 +155,10 @@ Use prompt -h <theme> for help on specific themes.' fi # Reset some commonly altered bits to the default - add-zsh-hook -D precmd "prompt_*_precmd" - add-zsh-hook -D preexec "prompt_*_preexec" + local hook + for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do + add-zsh-hook -D "${hook}" "prompt_*_${hook}" + done set -A zle_highlight ${zle_highlight:#default:*} (( ${#zle_highlight} )) || unset zle_highlight diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index b1cb7302b..41cc3e783 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -6,12 +6,28 @@ setopt localoptions noksharrays extendedglob NO_shwordsplit local svnbase svnbranch a b rrn +local -i rc local -A svninfo parentinfo local -xA hook_com svnbase="."; svninfo=() -${vcs_comm[cmd]} info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done +# Unfortunately, `$pipestatus' is broken currently. Until that problem is +# resolved, here is a workaround that will get things done, without using it. +# Clumsily, but that's life. +local -a dat +dat=( ${(f)"$(${vcs_comm[cmd]} info --non-interactive 2>&1)"} ) +rc=$? +(( rc != 0 )) && return 1 +# The following line is the real code, the following is the workaround. +#${vcs_comm[cmd]} info --non-interactive \ +print -l "${dat[@]}" \ +|& while IFS=: read a b; do + svninfo[${a// /_}]="${b## #}" +done +#rc=${pipestatus[1]} +#(( rc != 0 )) && return 1 + while [[ -d "${svnbase}/../.svn" ]]; do parentinfo=() ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done diff --git a/Functions/VCS_Info/VCS_INFO_check_com b/Functions/VCS_Info/VCS_INFO_check_com index d9f7a1330..1b86593a1 100644 --- a/Functions/VCS_Info/VCS_INFO_check_com +++ b/Functions/VCS_Info/VCS_INFO_check_com @@ -9,7 +9,7 @@ case $1 in [[ -x $1 ]] && return 0 ;; (*) - (( ${+commands[$1]} )) && [[ -x ${commands[$1]} ]] && return 0 + (( ${+commands[$1]} )) && return 0 esac return 1 diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic index ee8b6f62f..c7bb88c5d 100644 --- a/Functions/Zle/url-quote-magic +++ b/Functions/Zle/url-quote-magic @@ -60,6 +60,7 @@ # Use compsys for nested quoting analysis and command parsing. # Establish default values for styles, but only if not already set +local -a reply zstyle -m ':url-quote-magic:\*' url-metas '*' || zstyle ':url-quote-magic:*' url-metas '*?[]^(|)~#{}=' @@ -4,6 +4,16 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH Note also the list of incompatibilities in the README file. +Changes since 4.3.15 +-------------------- + +The option HASH_EXECUTABLES_ONLY has been added. When this is set, +directories in the command path will be checked for executables before +they are added to the command table (hash); otherwise, all files in the +directory are added. The effect of this option was present in 4.3.15, +which could cause significant delays when hashing on systems with +network directories in the path. + Changes since 4.3.12 -------------------- @@ -5,11 +5,11 @@ THE Z SHELL (ZSH) Version ------- -This is version 4.3.15 of the shell. This is a development release, +This is version 4.3.16 of the shell. This is a development release, but is believed to be reasonably stable. Sites where the users need to edit command lines with multibyte characters (in particular UTF-8) will probably want to upgrade. The previous widely released version -of the shell was 4.3.14. +of the shell was 4.3.15. Installing Zsh -------------- diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 2e3556a8d..cb9f8ef57 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -354,6 +354,7 @@ cond_pcre_match(char **a, int id) unmetafy(rhre_plain, NULL); pcre_pat = NULL; ov = NULL; + ovsize = 0; if (isset(BASHREMATCH)) avar="BASH_REMATCH"; diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index b1de6c6cc..39d41bdb5 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -2303,10 +2303,10 @@ addmatches(Cadata dat, char **argv) strcpy(tmp + llpl + gfl + is, lsuf); tokenize(tmp); - remnulargs(tmp); if (haswilds(tmp)) { if (is) tmp[llpl + gfl] = Star; + remnulargs(tmp); if ((cp = patcompile(tmp, 0, NULL))) haspattern = 1; } diff --git a/Src/Zle/complete.mdd b/Src/Zle/complete.mdd index 2aa0cde1c..77e33504d 100644 --- a/Src/Zle/complete.mdd +++ b/Src/Zle/complete.mdd @@ -1,7 +1,7 @@ name=zsh/complete link=either load=yes -functions='Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandriva/*/* Completion/Redhat/*/* Completion/Solaris/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*' +functions='Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandriva/*/* Completion/Redhat/*/* Completion/Solaris/*/* Completion/openSUSE/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*' moddeps="zsh/zle" diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index a08caa069..c3731c47b 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -544,6 +544,7 @@ bindkey(Keymap km, char *seq, Thingy bind, char *str) if(km->first[f]) { char fs[3]; fs[0] = f; + fs[1] = 0; metafy(fs, 1, META_NOALLOC); km->multi->addnode(km->multi, ztrdup(fs), makekeynode(km->first[f], NULL)); diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 3cdc3b2ed..e1a575bdb 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1200,6 +1200,18 @@ zleread(char **lp, char **rp, int flags, int context) putc('\r', shout); if (tmout) alarm(tmout); + + /* + * On some windowing systems we may enter this function before the + * terminal is fully opened and sized, resulting in an infinite + * series of SIGWINCH when the handler prints the prompt before we + * have done so here. Therefore, hold any such signal until the + * first full refresh has completed. The important bit is that the + * handler must not see zleactive = 1 until ZLE really is active. + * See the end of adjustwinsize() in Src/utils.c + */ + queue_signals(); + zleactive = 1; resetneeded = 1; errflag = retflag = 0; @@ -1209,6 +1221,8 @@ zleread(char **lp, char **rp, int flags, int context) zrefresh(); + unqueue_signals(); /* Should now be safe to acknowledge SIGWINCH */ + zlecallhook("zle-line-init", NULL); zlecore(); @@ -1913,7 +1927,7 @@ zle_main_entry(int cmd, va_list ap) static struct builtin bintab[] = { BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL), BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcehM:m:p:r:t:", NULL), - BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDFgGIKlLmMNRU", NULL), + BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDFgGIKlLmMNrRTU", NULL), }; /* The order of the entries in this table has to match the *HOOK diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 260df8bf6..17b78ce59 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -233,6 +233,12 @@ int n_region_highlights; /**/ int region_active; +/* + * Name of function to use to output termcap values, if defined. + */ +/**/ +char *tcout_func_name; + #ifdef HAVE_SELECT /* cost of last update */ /**/ @@ -2271,11 +2277,78 @@ tc_downcurs(int ct) return ret; } +/* + * Output a termcap value using a function defined by "zle -T tc". + * Loosely inspired by subst_string_by_func(). + * + * cap is the internal index for the capability; it will be looked up + * in the table and the string passed to the function. + * + * arg is eithr an argument to the capability or -1 if there is none; + * if it is not -1 it will be passed as an additional argument to the + * function. + * + * outc is the output function; currently this is always putshout + * but in principle it may be used to output to a string. + */ + +/**/ +static void +tcout_via_func(int cap, int arg, int (*outc)(int)) +{ + Shfunc tcout_func; + int osc, osm, old_incompfunc; + + osc = sfcontext; + osm = stopmsg; + old_incompfunc = incompfunc; + + sfcontext = SFC_SUBST; + incompfunc = 0; + + if ((tcout_func = getshfunc(tcout_func_name))) { + LinkList l = newlinklist(); + char buf[DIGBUFSIZE], *str; + + addlinknode(l, tcout_func_name); + addlinknode(l, tccap_get_name(cap)); + + if (arg != -1) { + sprintf(buf, "%d", arg); + addlinknode(l, buf); + } + + (void)doshfunc(tcout_func, l, 1); + + str = getsparam("REPLY"); + if (str) { + while (*str) { + int chr; + if (*str == Meta) { + chr = str[1] ^ 32; + str += 2; + } else { + chr = *str++; + } + (void)outc(chr); + } + } + } + + sfcontext = osc; + stopmsg = osm; + incompfunc = old_incompfunc; +} + /**/ mod_export void tcout(int cap) { - tputs(tcstr[cap], 1, putshout); + if (tcout_func_name) { + tcout_via_func(cap, -1, putshout); + } else { + tputs(tcstr[cap], 1, putshout); + } SELECT_ADD_COST(tclen[cap]); } @@ -2286,7 +2359,11 @@ tcoutarg(int cap, int arg) char *result; result = tgoto(tcstr[cap], arg, arg); - tputs(result, 1, putshout); + if (tcout_func_name) { + tcout_via_func(cap, arg, putshout); + } else { + tputs(result, 1, putshout); + } SELECT_ADD_COST(strlen(result)); } diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 03e73b4ca..49d715e06 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -353,6 +353,7 @@ bin_zle(char *name, char **args, Options ops, UNUSED(int func)) { 'K', bin_zle_keymap, 1, 1 }, { 'I', bin_zle_invalidate, 0, 0 }, { 'F', bin_zle_fd, 0, 2 }, + { 'T', bin_zle_transform, 0, 2}, { 0, bin_zle_call, 0, -1 }, }; struct opn const *op, *opp; @@ -856,6 +857,69 @@ bin_zle_fd(char *name, char **args, Options ops, UNUSED(char func)) return 0; } +/**/ +static int +bin_zle_transform(char *name, char **args, Options ops, UNUSED(char func)) +{ + /* + * -1: too few arguments + * 0: just right + * 1: too many arguments + * 2: first argument not recognised + */ + int badargs = 0; + + if (OPT_ISSET(ops,'L')) { + if (args[0]) { + if (args[1]) { + badargs = 1; + } else if (strcmp(args[0], "tc")) { + badargs = 2; + } + } + if (!badargs && tcout_func_name) { + fputs("zle -T tc ", stdout); + quotedzputs(tcout_func_name, stdout); + putchar('\n'); + } + } else if (OPT_ISSET(ops,'r')) { + if (!args[0]) { + badargs = -1; + } else if (args[1]) { + badargs = 1; + } else if (tcout_func_name) { + zsfree(tcout_func_name); + tcout_func_name = NULL; + } + } else { + if (!args[0] || !args[1]) { + badargs = -1; + /* we've already checked args <= 2 */ + } else { + if (!strcmp(args[0], "tc")) { + if (tcout_func_name) { + zsfree(tcout_func_name); + } + tcout_func_name = ztrdup(args[1]); + } else { + badargs = 2; + } + } + } + + if (badargs) { + if (badargs == 2) { + zwarnnam(name, "-T: no such transformation '%s'", args[0]); + } else { + char *way = (badargs > 0) ? "many" : "few"; + zwarnnam(name, "too %s arguments for option -T", way); + } + return 1; + } + + return 0; +} + /*******************/ /* initialiasation */ /*******************/ diff --git a/Src/builtin.c b/Src/builtin.c index 71fc04ce1..b43c08235 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1652,6 +1652,12 @@ fclist(FILE *f, Options ops, zlong first, zlong last, last = first; first = tmp; } + if (first > last) { + zwarnnam("fc", "history events are in wrong order, aborted"); + if (f != stdout) + fclose(f); + return 1; + } /* suppress "no substitution" warning if no substitution is requested */ if (!subs) fclistdone = 1; diff --git a/Src/exec.c b/Src/exec.c index 9b3c50372..503e0843d 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2174,8 +2174,8 @@ addvars(Estate state, Wordcode pc, int addflags) vl = ecgetlist(state, WC_ASSIGN_NUM(ac), EC_DUPTOK, &htok); if (vl && htok) { - prefork(vl, (isstr ? (PF_SINGLE|PF_ASSIGN) : - PF_ASSIGN)); + prefork(vl, (isstr ? (PREFORK_SINGLE|PREFORK_ASSIGN) : + PREFORK_ASSIGN)); if (errflag) { state->pc = opc; return; @@ -2487,6 +2487,11 @@ execcmd(Estate state, int input, int output, int how, int last1) * with the zsh style. */ while (next && *next == '-' && strlen(next) >= 2) { + if (!firstnode(args)) { + zerr("exec requires a command to execute"); + errflag = lastval = 1; + return; + } uremnode(args, firstnode(args)); if (!strcmp(next, "--")) break; @@ -2499,6 +2504,11 @@ execcmd(Estate state, int input, int output, int how, int last1) /* position on last non-NULL character */ cmdopt += strlen(cmdopt+1); } else { + if (!firstnode(args)) { + zerr("exec requires a command to execute"); + errflag = lastval = 1; + return; + } if (!nextnode(firstnode(args))) { zerr("exec flag -a requires a parameter"); errflag = lastval = 1; @@ -2521,7 +2531,8 @@ execcmd(Estate state, int input, int output, int how, int last1) return; } } - next = (char *) getdata(nextnode(firstnode(args))); + if (firstnode(args) && nextnode(firstnode(args))) + next = (char *) getdata(nextnode(firstnode(args))); } if (exec_argv0) { char *str, *s; @@ -2541,7 +2552,7 @@ execcmd(Estate state, int input, int output, int how, int last1) } /* Do prefork substitutions */ - esprefork = (assign || isset(MAGICEQUALSUBST)) ? PF_TYPESET : 0; + esprefork = (assign || isset(MAGICEQUALSUBST)) ? PREFORK_TYPESET : 0; if (args && htok) prefork(args, esprefork); diff --git a/Src/glob.c b/Src/glob.c index 076d0392a..d003d95da 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -2011,7 +2011,7 @@ xpandredir(struct redir *fn, LinkList redirtab) /* Stick the name in a list... */ init_list1(fake, fn->name); /* ...which undergoes all the usual shell expansions */ - prefork(&fake, isset(MULTIOS) ? 0 : PF_SINGLE); + prefork(&fake, isset(MULTIOS) ? 0 : PREFORK_SINGLE); /* Globbing is only done for multios. */ if (!errflag && isset(MULTIOS)) globlist(&fake, 0); diff --git a/Src/hashtable.c b/Src/hashtable.c index 6fca256e3..775b6a277 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -663,8 +663,9 @@ hashdir(char **dirp) * This is the same test as for the glob qualifier for * executable plain files. */ - if (stat(pathbuf, &statbuf) == 0 && - S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)) + if (unset(HASHEXECUTABLESONLY) || + (stat(pathbuf, &statbuf) == 0 && + S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO))) add = 1; } if (add) { diff --git a/Src/hist.c b/Src/hist.c index aeb6edda5..4d522dddb 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -1664,6 +1664,11 @@ chrealpath(char **junkptr) errno == ENAMETOOLONG || errno == ENOMEM) return 0; +#ifdef HAVE_CANONICALIZE_FILE_NAME + if (!real) + return 0; +#endif + if (nonreal == *junkptr) { *real = '\0'; break; diff --git a/Src/init.c b/Src/init.c index 30cd40e6c..9820070fb 100644 --- a/Src/init.c +++ b/Src/init.c @@ -558,6 +558,19 @@ static char *tccapnams[TC_COUNT] = { "ku", "kd", "kl", "kr", "sc", "rc", "bc", "AF", "AB" }; +/**/ +mod_export char * +tccap_get_name(int cap) +{ + if (cap >= TC_COUNT) { +#ifdef DEBUG + dputs("name of invalid capability %d requested", cap); +#endif + return ""; + } + return tccapnams[cap]; +} + /* Initialise termcap */ /**/ @@ -978,6 +991,7 @@ setupshin(char *runscript) exit(127); } scriptfilename = sfname; + zsfree(argzero); /* ztrdup'd in parseargs */ argzero = runscript; } /* diff --git a/Src/options.c b/Src/options.c index a70d4ff11..5fbb06b11 100644 --- a/Src/options.c +++ b/Src/options.c @@ -140,6 +140,7 @@ static struct optname optns[] = { {{NULL, "globsubst", OPT_EMULATE|OPT_NONZSH}, GLOBSUBST}, {{NULL, "hashcmds", OPT_ALL}, HASHCMDS}, {{NULL, "hashdirs", OPT_ALL}, HASHDIRS}, +{{NULL, "hashexecutablesonly", 0}, HASHEXECUTABLESONLY}, {{NULL, "hashlistall", OPT_ALL}, HASHLISTALL}, {{NULL, "histallowclobber", 0}, HISTALLOWCLOBBER}, {{NULL, "histbeep", OPT_ALL}, HISTBEEP}, diff --git a/Src/params.c b/Src/params.c index 446cccc7e..59d5daf2f 100644 --- a/Src/params.c +++ b/Src/params.c @@ -3788,6 +3788,10 @@ static void setlang(char *x) { struct localename *ln; + char *x2; + + if ((x2 = getsparam("LC_ALL")) && *x2) + return; /* * Set the global locale to the value passed, but override diff --git a/Src/subst.c b/Src/subst.c index 4e8ed721d..894f9cd2f 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -44,7 +44,7 @@ char nulstring[] = {Nularg, '\0'}; * - Brace expansion * - Tilde and equals substitution * - * PF_* flags are defined in zsh.h + * PREFORK_* flags are defined in zsh.h */ /**/ @@ -52,7 +52,7 @@ mod_export void prefork(LinkList list, int flags) { LinkNode node, stop = 0; - int keep = 0, asssub = (flags & PF_TYPESET) && isset(KSHTYPESET); + int keep = 0, asssub = (flags & PREFORK_TYPESET) && isset(KSHTYPESET); queue_signals(); for (node = firstnode(list); node; incnode(node)) { @@ -67,14 +67,18 @@ prefork(LinkList list, int flags) * templates... */ char *cptr = (char *)getdata(node); - filesub(&cptr, flags & (PF_TYPESET|PF_ASSIGN)); + filesub(&cptr, flags & (PREFORK_TYPESET|PREFORK_ASSIGN)); /* * The assignment is so simple it's not worth * testing if cptr changed... */ setdata(node, cptr); } - if (!(node = stringsubst(list, node, flags & PF_SINGLE, asssub))) { + if (!(node = stringsubst(list, node, + flags & (PREFORK_SINGLE|PREFORK_SPLIT| + PREFORK_SHWORDSPLIT| + PREFORK_NOSHWORDSPLIT), + asssub))) { unqueue_signals(); return; } @@ -84,7 +88,7 @@ prefork(LinkList list, int flags) keep = 0; if (*(char *)getdata(node)) { remnulargs(getdata(node)); - if (unset(IGNOREBRACES) && !(flags & PF_SINGLE)) { + if (unset(IGNOREBRACES) && !(flags & PREFORK_SINGLE)) { if (!keep) stop = nextnode(node); while (hasbraces(getdata(node))) { @@ -94,10 +98,10 @@ prefork(LinkList list, int flags) } if (unset(SHFILEEXPANSION)) { char *cptr = (char *)getdata(node); - filesub(&cptr, flags & (PF_TYPESET|PF_ASSIGN)); + filesub(&cptr, flags & (PREFORK_TYPESET|PREFORK_ASSIGN)); setdata(node, cptr); } - } else if (!(flags & PF_SINGLE) && !keep) + } else if (!(flags & PREFORK_SINGLE) && !keep) uremnode(list, node); if (errflag) { unqueue_signals(); @@ -145,7 +149,7 @@ stringsubstquote(char *strstart, char **pstrdpos) /**/ static LinkNode -stringsubst(LinkList list, LinkNode node, int ssub, int asssub) +stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub) { int qt; char *str3 = (char *)getdata(node); @@ -213,7 +217,25 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub) setdata(node, (void *) str3); continue; } else { - node = paramsubst(list, node, &str, qt, ssub); + /* + * To avoid setting and unsetting the SHWORDSPLIT + * option, we pass flags if we need to control it for + * recursive expansion via multsub() + * If PREFORK_NOSHWORDSPLIT is set, the option is + * disregarded; otherwise, use it if set. + * If PREFORK_SPLIT is set, splitting is forced, + * regardless of the option + * If PREFORK_SHWORDSPLIT is already set, or used by the + * previous two to signal paramsubst(), we'll do + * sh-style wordsplitting on parameters. + */ + if ((isset(SHWORDSPLIT) && + !(pf_flags & PREFORK_NOSHWORDSPLIT)) || + (pf_flags & PREFORK_SPLIT)) + pf_flags |= PREFORK_SHWORDSPLIT; + node = paramsubst( + list, node, &str, qt, + pf_flags & (PREFORK_SINGLE|PREFORK_SHWORDSPLIT)); if (errflag || !node) return NULL; str3 = (char *)getdata(node); @@ -268,7 +290,8 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub) (qt && str[1] == '"')))) *str = ztokens[c - Pound]; str++; - if (!(pl = getoutput(str2 + 1, qt || ssub))) { + if (!(pl = getoutput(str2 + 1, qt || + (pf_flags & PREFORK_SINGLE)))) { zerr("parse error in command substitution"); return NULL; } @@ -278,7 +301,7 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub) str = strcpy(str2, str); continue; } - if (!qt && ssub && isset(GLOBSUBST)) + if (!qt && (pf_flags & PREFORK_SINGLE) && isset(GLOBSUBST)) shtokenize(s); l1 = str2 - str3; l2 = strlen(s); @@ -306,7 +329,7 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub) * We are in a normal argument which looks like an assignment * and is to be treated like one, with no word splitting. */ - ssub = 1; + pf_flags |= PREFORK_SINGLE; } str++; } @@ -371,7 +394,7 @@ singsub(char **s) init_list1(foo, *s); - prefork(&foo, PF_SINGLE); + prefork(&foo, PREFORK_SINGLE); if (errflag) return; *s = (char *) ugetnode(&foo); @@ -392,13 +415,13 @@ singsub(char **s) /**/ static int -multsub(char **s, int split, char ***a, int *isarr, char *sep) +multsub(char **s, int pf_flags, char ***a, int *isarr, char *sep) { int l; char **r, **p, *x = *s; local_list1(foo); - if (split) { + if (pf_flags & PREFORK_SPLIT) { /* * This doesn't handle multibyte characters, but we're * looking for whitespace separators which must be ASCII. @@ -413,7 +436,7 @@ multsub(char **s, int split, char ***a, int *isarr, char *sep) init_list1(foo, x); - if (split) { + if (pf_flags & PREFORK_SPLIT) { LinkNode n = firstnode(&foo); int inq = 0, inp = 0; MB_METACHARINIT(); @@ -467,7 +490,7 @@ multsub(char **s, int split, char ***a, int *isarr, char *sep) } } - prefork(&foo, 0); + prefork(&foo, pf_flags); if (errflag) { if (isarr) *isarr = 0; @@ -503,8 +526,8 @@ multsub(char **s, int split, char ***a, int *isarr, char *sep) } /* - * ~, = subs: assign & PF_TYPESET => typeset or magic equals - * assign & PF_ASSIGN => normal assignment + * ~, = subs: assign & PREFORK_TYPESET => typeset or magic equals + * assign & PREFORK_ASSIGN => normal assignment */ /**/ @@ -519,7 +542,7 @@ filesub(char **namptr, int assign) if (!assign) return; - if (assign & PF_TYPESET) { + if (assign & PREFORK_TYPESET) { if ((*namptr)[1] && (eql = sub = strchr(*namptr + 1, Equals))) { str = sub + 1; if ((sub[1] == Tilde || sub[1] == Equals) && filesubstr(&str, assign)) { @@ -1437,7 +1460,7 @@ check_colon_subscript(char *str, char **endp) /**/ static LinkNode -paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) +paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) { char *aptr = *str, c, cc; char *s = aptr, *fstr, *idbeg, *idend, *ostr = (char *) getdata(n); @@ -1514,7 +1537,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) * where we shouldn't, in particular on the multsubs for * handling embedded values for ${...=...} and the like. */ - int spbreak = isset(SHWORDSPLIT) && !ssub && !qt; + int spbreak = (pf_flags & PREFORK_SHWORDSPLIT) && + !(pf_flags & PREFORK_SINGLE) && !qt; /* Scalar and array value, see isarr above */ char *val = NULL, **aval = NULL; /* @@ -1564,6 +1588,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) */ int shsplit = 0; /* + * "ssub" is true when we are called from singsub (via prefork): + * it means that we must join arrays and should not split words. + */ + int ssub = (pf_flags & PREFORK_SINGLE); + /* * The separator from (j) and (s) respectively, or (F) and (f) * respectively (hardwired to "\n" in that case). Slightly * confusingly also used for ${#pm}, thought that's at least @@ -1620,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) * This is one of the things that decides whether multsub * will produce an array, but in an extremely indirect fashion. */ - int nojoin = isset(SHWORDSPLIT) ? !(ifs && *ifs) : 0; + int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) : 0; /* * != 0 means ${...}, otherwise $... What works without braces * is largely a historical artefact (everything works with braces, @@ -2618,7 +2647,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) /* Fall Through! */ case '-': if (vunset) { - int ws = opts[SHWORDSPLIT]; + int split_flags; val = dupstring(s); /* If word-splitting is enabled, we ask multsub() to split * the substituted string at unquoted whitespace. Then, we @@ -2627,9 +2656,20 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) * keep its array splits, and weird constructs such as * ${str+"one two" "3 2 1" foo "$str"} to only be split * at the unquoted spaces. */ - opts[SHWORDSPLIT] = spbreak; - multsub(&val, spbreak && !aspar, (aspar ? NULL : &aval), &isarr, NULL); - opts[SHWORDSPLIT] = ws; + if (spbreak) { + split_flags = PREFORK_SHWORDSPLIT; + if (!aspar) + split_flags |= PREFORK_SPLIT; + } else { + /* + * It's not good enough not passing the flag to use + * SHWORDSPLIT, because when we get to a nested + * paramsubst we need to ignore isset(SHWORDSPLIT). + */ + split_flags = PREFORK_NOSHWORDSPLIT; + } + multsub(&val, split_flags, (aspar ? NULL : &aval), + &isarr, NULL); copied = 1; spbreak = 0; /* Leave globsubst on if forced */ @@ -2647,21 +2687,21 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) case '=': case Equals: if (vunset) { - int ws = opts[SHWORDSPLIT]; char sav = *idend; - int l; + int l, split_flags; *idend = '\0'; val = dupstring(s); if (spsep || !arrasg) { - opts[SHWORDSPLIT] = 0; - multsub(&val, 0, NULL, &isarr, NULL); + multsub(&val, PREFORK_NOSHWORDSPLIT, NULL, &isarr, NULL); } else { - opts[SHWORDSPLIT] = spbreak; - multsub(&val, spbreak, &aval, &isarr, NULL); + if (spbreak) + split_flags = PREFORK_SPLIT|PREFORK_SHWORDSPLIT; + else + split_flags = PREFORK_NOSHWORDSPLIT; + multsub(&val, split_flags, &aval, &isarr, NULL); spbreak = 0; } - opts[SHWORDSPLIT] = ws; if (arrasg) { /* This is an array assignment. */ char *arr[2], **t, **a, **p; @@ -2878,24 +2918,26 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) return NULL; } } - if (horrible_offset_hack) { - /* - * As part of the 'orrible hoffset 'ack, - * (what hare you? Han 'orrible hoffset 'ack, - * sergeant major), if we are given a ksh/bash/POSIX - * style positional parameter array which includes - * offset 0, we use $0. - */ - if (offset == 0 && isarr) { - offset_hack_argzero = 1; - } else if (offset > 0) { - offset--; - } - } if (isarr) { - int alen = arrlen(aval), count; + int alen, count; char **srcptr, **dstptr, **newarr; + if (horrible_offset_hack) { + /* + * As part of the 'orrible hoffset 'ack, + * (what hare you? Han 'orrible hoffset 'ack, + * sergeant major), if we are given a ksh/bash/POSIX + * style positional parameter array which includes + * offset 0, we use $0. + */ + if (offset == 0) { + offset_hack_argzero = 1; + } else if (offset > 0) { + offset--; + } + } + + alen = arrlen(aval); if (offset < 0) { offset += alen; if (offset < 0) @@ -3116,8 +3158,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) * (afterward) may split the joined value (e.g. (s:-:) sets "spsep"). One * exception is that ${name:-word} and ${name:+word} will have already * done any requested splitting of the word value with quoting preserved. - * "ssub" is true when we are called from singsub (via prefork): - * it means that we must join arrays and should not split words. */ + */ if (ssub || (spbreak && isarr >= 0) || spsep || sep) { if (isarr) { val = sepjoin(aval, sep, 1); @@ -1645,9 +1645,18 @@ enum { }; /* Flags as the second argument to prefork */ -#define PF_TYPESET 0x01 /* argument handled like typeset foo=bar */ -#define PF_ASSIGN 0x02 /* argument handled like the RHS of foo=bar */ -#define PF_SINGLE 0x04 /* single word substitution */ +/* argument handled like typeset foo=bar */ +#define PREFORK_TYPESET 0x01 +/* argument handled like the RHS of foo=bar */ +#define PREFORK_ASSIGN 0x02 +/* single word substitution */ +#define PREFORK_SINGLE 0x04 +/* explicitly split nested substitution */ +#define PREFORK_SPLIT 0x08 +/* SHWORDSPLIT in parameter expn */ +#define PREFORK_SHWORDSPLIT 0x10 +/* SHWORDSPLIT forced off in nested subst */ +#define PREFORK_NOSHWORDSPLIT 0x20 /* * Structure for adding parameters in a module. @@ -1986,6 +1995,7 @@ enum { GLOBSUBST, HASHCMDS, HASHDIRS, + HASHEXECUTABLESONLY, HASHLISTALL, HISTALLOWCLOBBER, HISTBEEP, diff --git a/Test/.distfiles b/Test/.distfiles index 8a5d716f4..689b69587 100644 --- a/Test/.distfiles +++ b/Test/.distfiles @@ -1,7 +1,6 @@ DISTFILES_SRC=' .cvsignore .distfiles -compgentest A01grammar.ztst A02alias.ztst A03quoting.ztst @@ -40,10 +39,10 @@ V03mathfunc.ztst V04features.ztst V05styles.ztst V06parameter.ztst +V07pcre.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst -Y04compgen.ztst comptest runtests.zsh ztst.zsh diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst index 629fdd206..57427557f 100644 --- a/Test/C02cond.ztst +++ b/Test/C02cond.ztst @@ -139,6 +139,9 @@ elif [[ "$(find . -prune -fstype nfs 2>/dev/null)" == "." ]]; then print -u$ZTST_fd "Warning: not testing [[ -N file ]] (not supported with NFS)" true + elif test -f /etc/mtab && { grep $(df . | tail -n1 | awk '{print $1}') /etc/mtab | grep -q noatime; }; then + print -u$ZTST_fd "Warning: not testing [[ -N file ]] (not supported with noatime file system)" + true else [[ -N newnewnew && ! -N unmodified ]] fi diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 71c79687f..69606e453 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -255,6 +255,20 @@ >two >words + (setopt shwordsplit # ensure this doesn't get set in main shell... + test_splitting () + { + array="one two three" + for e in $array; do + echo "'$e'" + done + } + test_split_var= + : ${test_split_var:=$(test_splitting)} + echo "_${test_split_var}_") +0:SH_WORD_SPLIT inside $(...) inside ${...} +>_'one' 'two' 'three'_ + print -l "${(f)$(print first line\\nsecond line\\nthird line)}" 0:${(f)$(...)} >first line diff --git a/Test/Y04compgen.ztst b/Test/Y04compgen.ztst deleted file mode 100644 index 90dce6148..000000000 --- a/Test/Y04compgen.ztst +++ /dev/null @@ -1,21 +0,0 @@ -# Tests for bash compgen compatibility. - -%prep - if ( zmodload zsh/parameter ) >/dev/null 2>&1; then - . $ZTST_srcdir/compgentest - comptestinit -z $ZTST_testdir/../Src/zsh && - else - ZTST_unimplemented="the zsh/parameter module is not available" - fi - -%test - - comptest $': \t\t\t\t\t\t\t' -0:bash compatibility: compgen -W ->abc ->abe ->ab - -%clean - - zmodload -ui zsh/parameter diff --git a/Test/compgentest b/Test/compgentest deleted file mode 100644 index 26b202c43..000000000 --- a/Test/compgentest +++ /dev/null @@ -1,15 +0,0 @@ -comptestinit () { - - setopt extendedglob - [[ -d $ZTST_testdir/Modules/zsh ]] && module_path=( $ZTST_testdir/Modules ) - - zmodload -i zsh/parameter || return $? - autoload -Uz bashcompinit || return $? - bashcompinit || return $? - -} - -comptest () { - compgen -W 'abc abe ab a def' ab -} - |