From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11469 invoked by alias); 25 Apr 2015 17:15:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34961 Received: (qmail 25522 invoked from network); 25 Apr 2015 17:15:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=IVjv3XGwXlyjOblwAiJu8jpY/AJlzd655w8Opgf/A3c=; b=JGWj6hVwM1Owj3+OJmsOSLjwuG+HEio2yQw+nD8R7SY0nHBDKSX4txWgNQHu+ksvJS y8m2nCl/1PNr6TlI7M9XiKO8Kv1Xk+L38phYcmXAha9/flPwwzA8PJhoMtNC64pmodv0 aZZYQG0HJP4XY2ZhBRubNR4xXgsZQpWc8A2LVMfcYGwX+zRMQ16CTqf5BkIoqBZFjAXP wCLT1EkfW+ufnpyZu0u58oMBNGdUFvWNn7vYs6Xu6AmbW+rc1ZQGD1He5AIfzZf/hzZD NWzQDID6C31f3emzOwMNmAXUcAdAoq61mU7oznbGg6sTZMY8gWQpNEZt0ScadJOGx6H/ QmiQ== X-Gm-Message-State: ALoCoQkVQ7C/WmUlMIDNbtFCYX/z1odNURjhaZsVRE1nAlsGtI53AZVqz8WmDo1YE1kcH/oOtvfM X-Received: by 10.182.87.228 with SMTP id bb4mr3008420obb.27.1429982102533; Sat, 25 Apr 2015 10:15:02 -0700 (PDT) From: Bart Schaefer Message-Id: <150425101458.ZM30959@torch.brasslantern.com> Date: Sat, 25 Apr 2015 10:14:58 -0700 In-Reply-To: <20150422100153.2bd64435@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Potential 3.0.8 [was Re: broken parsing with $((`:`))]" (Apr 22, 10:01am) References: <20150415030531.GA8187@vapier> <20150415100324.296ffa3e@pwslap01u.europe.root.pri> <150415081348.ZM26219@torch.brasslantern.com> <20150415162650.61a7d399@pwslap01u.europe.root.pri> <150415092300.ZM26692@torch.brasslantern.com> <20150422100153.2bd64435@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Pre-3.0.8 consolidated PATCH MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 22, 10:01am, Peter Stephenson wrote: } Subject: Re: Potential 3.0.8 [was Re: broken parsing with $((`:`))] } } On Wed, 15 Apr 2015 09:23:00 -0700 } Bart Schaefer wrote: } > I have the following un-pushed changes (some of which have been posted } > in previous articles, some not): } > } > remove _message from _mkdir } > unquote history words when command line has a quote } > no files to add in compaudit } > compsys.yo tweak "will" -> "will be" } > local TZ in strftime } > quote/quotebreak remove useless cast } > doc vindex pid } > allow clobber of zero-sized files } > maybe-helpful change free() to zfree() in two places } > add backslash to alias expansion matching in _expand } > test for breadth-first glob with (Y1) } } As far as I can see the only potentially controversial thing there is } "allow clobber of zero-sized files", but I haven't looked back over the } messages. The following patch includes all of the above except that "clobber" one. This is just to get an article number, I'll do separate commits for each of the changes. diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand index e52144c..3c76e13 100644 --- a/Completion/Base/Completer/_expand +++ b/Completion/Base/Completer/_expand @@ -87,7 +87,7 @@ if [[ "$force" = *s* ]] || setopt aliases eval 'exp=( ${${(e)exp//\\[ -]/ }//(#b)([ +]/ }//(#b)([ \\ ])/\\$match[1]} )' 2>/dev/null setopt NO_aliases else diff --git a/Completion/Base/Completer/_history b/Completion/Base/Completer/_history index 63878ac..cd69ca1 100644 --- a/Completion/Base/Completer/_history +++ b/Completion/Base/Completer/_history @@ -51,9 +51,14 @@ ISUFFIX= # We skip the first element of historywords so the current word doesn't # interfere with the completion +local -a hslice while [[ $compstate[nmatches] -eq 0 && beg -lt max ]]; do + if [[ -n $compstate[quote] ]] + then hslice=( ${(Q)historywords[beg,beg+slice]} ) + else hslice=( ${historywords[beg,beg+slice]} ) + fi _wanted "$opt" history-words expl 'history word' \ - compadd -Q -a 'historywords[beg,beg+slice]' + compadd -Q -a hslice (( beg+=slice )) done diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir index b5f7519..58d6c74 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -61,7 +61,7 @@ case "$state" in [[ $variant == zsh && ${#${${words[2,-1]}:#-*}} -gt 0 ]]; then _wanted directories expl \ 'parent directory (alternatively specify name of directory)' \ - _path_files -/ && ret=0 || _message 'name of directory' + _path_files -/ && ret=0 fi ;; esac diff --git a/Completion/compaudit b/Completion/compaudit index 00125e4..fb0463c 100644 --- a/Completion/compaudit +++ b/Completion/compaudit @@ -71,6 +71,7 @@ if [[ -n $_compdir ]]; then _i_addfiles=(${_compdir}/*(/^M)) fi for _i_line in {1..$#_i_addfiles}; do + (( $_i_line )) || break _i_file=${_i_addfiles[$_i_line]} [[ -d $_i_file && -z ${fpath[(r)$_i_file]} ]] || _i_addfiles[$_i_line]= diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 45afe24..b699502 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -354,7 +354,7 @@ tt(all): no further completion is attempted; a string containing the substring tt(patterns): no pattern completion functions will be called; a string containing tt(default): the function for the `tt(-default-)' context will not be called, but -functions defined for commands will +functions defined for commands will be. ) kindex(-math-, completion context) item(tt(-math-))( diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo index d6b3765..7101e37 100644 --- a/Doc/Zsh/mod_system.yo +++ b/Doc/Zsh/mod_system.yo @@ -181,10 +181,12 @@ A readonly associative array. The keys are: startitem() item(tt(pid))( +vindex(pid, sysparams) Returns the process ID of the current process, even in subshells. Compare tt($$), which returns the process ID of the main shell process. ) item(tt(ppid))( +vindex(ppid, sysparams) Returns the process ID of the parent of the current process, even in subshells. Compare tt($PPID), which returns the process ID of the parent of the main shell process. diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c index 00ebd2b..63a04dc 100644 --- a/Src/Modules/datetime.c +++ b/Src/Modules/datetime.c @@ -94,7 +94,7 @@ reverse_strftime(char *nam, char **argv, char *scalar, int quiet) } static int -bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) +output_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) { int bufsize, x; char *endptr = NULL, *scalar = NULL, *buffer; @@ -145,6 +145,25 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) return 0; } +static int +bin_strftime(char *nam, char **argv, Options ops, int func) +{ + int result = 1; + char *tz = getsparam("TZ"); + + startparamscope(); + if (tz && *tz) { + Param pm = createparam("TZ", PM_LOCAL|PM_SCALAR|PM_EXPORTED); + if (pm) + pm->level = locallevel; /* because createparam() doesn't */ + setsparam("TZ", ztrdup(tz)); + } + result = output_strftime(nam, argv, ops, func); + endparamscope(); + + return result; +} + static zlong getcurrentsecs(UNUSED(Param pm)) { diff --git a/Src/compat.c b/Src/compat.c index 09b3d6a..b3a8b06 100644 --- a/Src/compat.c +++ b/Src/compat.c @@ -443,7 +443,7 @@ zgetcwd(void) ret = getcwd(cwdbuf, PATH_MAX); if (ret) ret = dupstring(ret); - free(cwdbuf); + zfree(cwdbuf, PATH_MAX); #endif /* GETCWD_CALLS_MALLOC */ } #endif /* HAVE_GETCWD */ diff --git a/Src/hist.c b/Src/hist.c index 185d0a0..bd03c4f 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2255,10 +2255,10 @@ getargs(Histent elist, int arg1, int arg2) } /**/ -int +static int quote(char **tr) { - char *ptr, *rptr, **str = (char **)tr; + char *ptr, *rptr, **str = tr; int len = 3; int inquotes = 0; @@ -2299,7 +2299,7 @@ quote(char **tr) static int quotebreak(char **tr) { - char *ptr, *rptr, **str = (char **)tr; + char *ptr, *rptr, **str = tr; int len = 3; for (ptr = *str; *ptr; ptr++, len++) diff --git a/Src/init.c b/Src/init.c index 3e41fb9..102276a 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1409,7 +1409,7 @@ source(char *s) retflag = 0; scriptname = old_scriptname; scriptfilename = old_scriptfilename; - free(cmdstack); + zfree(cmdstack, CMDSTACKSZ); cmdstack = ocs; cmdsp = ocsp; diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 217ce7c..3e2095a 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -548,6 +548,7 @@ (){ print "Negated:" $@:t } glob.tmp/dir*(Y1^Y) (){ print "Sorting:" $@:t } glob.tmp/dir*(Y4On) (){ [[ $#@ -eq 1 ]] && print Globs before last path component } glob.tmp/dir?/subdir(NY1) + (){ [[ $1 == glob.tmp/a ]] } glob.tmp/**/a(Y1) && print Breadth first (){ [[ $#@ -eq 0 ]] && print Respects qualifiers } glob.tmp/dir*(NY1.) (print -- *(Y)) 2>/dev/null || print "Argument required" 0:short-circuit modifier @@ -558,6 +559,7 @@ >Negated: dir1 dir2 dir3 dir4 >Sorting: dir4 dir3 dir2 dir1 >Globs before last path component +>Breadth first >Respects qualifiers >Argument required -- Barton E. Schaefer