diff options
-rw-r--r-- | ChangeLog | 30 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 4 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 9 | ||||
-rw-r--r-- | Src/exec.c | 6 | ||||
-rw-r--r-- | Test/E02xtrace.ztst | 34 | ||||
-rw-r--r-- | Test/V13zformat.ztst | 67 | ||||
-rw-r--r-- | configure.ac | 27 |
8 files changed, 163 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog index 65f3ba404..44b45ce07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ 2020-01-15 Daniel Shahaf <danielsh@apache.org> + * 45288: Completion/Unix/Command/_git: Complete bisect/new as + well as bisect/bad. + +2020-01-06 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 45246: configure.ac: Make --disable-multibyte warn, since + the test suite fails in that configuration. + +2020-01-06 Daniel Shahaf <danielsh@apache.org> + + * 45213: README, configure.ac: Make --enable-gdbm default to + false, rather than default to true with an unavoidable warning. + +2019-12-26 Daniel Shahaf <danielsh@apache.org> + + * unposted (follow-up to 45131): Test/E02xtrace.ztst: Extra + testing by Mikael + + * 45137: Src/Modules/zutil.c, Test/V13zformat.ztst: zformat: + Allow the specifying minimum width and a dot with an empty + maximum width. + + * 45138: Src/Modules/zutil.c, Test/V13zformat.ztst: Add zformat + unit tests. + + * 45131: Src/exec.c, Test/E02xtrace.ztst: Make a function that + redefines itself preserve its tracedness. + +2020-01-15 Daniel Shahaf <danielsh@apache.org> + * 45287: Doc/Zsh/expn.yo: zshexpn: Describe parameter elision and add some introductory prose diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7f2c206c1..8e0d57789 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6709,14 +6709,12 @@ __git_heads_local () { local f gitdir declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do [[ -f $gitdir/$f ]] && heads+=$f done - [[ -f $gitdir/refs/stash ]] && heads+=stash - [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad fi __git_describe_commit heads heads-local "local head" "$@" diff --git a/README b/README index a3701abe5..bcec3def1 100644 --- a/README +++ b/README @@ -33,6 +33,10 @@ details, see the documentation. Incompatibilities since 5.7.1 ----------------------------- +Build-time change: The default value of the --enable-gdbm configure +argument has changed from "yes" to "no". Thus, the zsh/db/gdbm module will +not be built unless --enable-gdbm is passed explicitly. + The history expansion !:1:t2 used to be interpreted such that the 2 was a separate character added after the history expansion. Now it is an argument to the :t modifier. diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index 24659cb16..7d9bf05d6 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -797,8 +797,7 @@ static char *zformat_substring(char* instr, char **specs, char **outp, if ((*s == '.' || testit) && idigit(s[1])) { for (max = 0, s++; idigit(*s); s++) max = (max * 10) + (int) STOUC(*s) - '0'; - } - else if (testit) + } else if (*s == '.' || testit) s++; if (testit && STOUC(*s)) { @@ -913,13 +912,13 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) switch (opt) { case 'f': { - char **ap, *specs[256], *out; + char **ap, *specs[256] = {0}, *out; int olen, oused = 0; - memset(specs, 0, 256 * sizeof(char *)); - specs['%'] = "%"; specs[')'] = ")"; + + /* Parse the specs in argv. */ for (ap = args + 2; *ap; ap++) { if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' || idigit(ap[0][0]) || ap[0][1] != ':') { diff --git a/Src/exec.c b/Src/exec.c index fac095d64..356e2974b 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5320,6 +5320,12 @@ execfuncdef(Estate state, Eprog redir_prog) */ removetrapnode(signum); } + /* Is this function traced and redefining itself? */ + if (funcstack && funcstack->tp == FS_FUNC && + !strcmp(s, funcstack->name)) { + Shfunc old = ((Shfunc)shfunctab->getnode(shfunctab, s)); + shf->node.flags |= old->node.flags & (PM_TAGGED|PM_TAGGED_LOCAL); + } shfunctab->addnode(shfunctab, ztrdup(s), shf); } } diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst index da6191cd0..a5a7bc55c 100644 --- a/Test/E02xtrace.ztst +++ b/Test/E02xtrace.ztst @@ -146,3 +146,37 @@ ?+(anon):0> '(anon)' ?+(anon):0> true ?+fn:0> gn + + test_cases=( + f # baseline + foo-bar # Dash + ヌ # Meta (the UTF-8 representation of this character has an 0x83 byte) + \$\'ba\\0z\' # Nul, escaped as though by ${(qqqq)} + ) + for 1 in "$test_cases[@]"; do + eval " + ${1}() { + ${1}() { echo inner } + } + functions -T ${1} + ${1} + which ${1} + " + done +0:a function that redefines itself preserves tracing +>f () { +> # traced +> echo inner +>} +>foo-bar () { +> # traced +> echo inner +>} +>$'\M-c\M-\C-C\M-\C-L' () { +> # traced +> echo inner +>} +>$'ba\C-@z' () { +> # traced +> echo inner +>} diff --git a/Test/V13zformat.ztst b/Test/V13zformat.ztst new file mode 100644 index 000000000..982866e13 --- /dev/null +++ b/Test/V13zformat.ztst @@ -0,0 +1,67 @@ +# Test the use of zformat, if the zsh/zutil module is available. + +%prep + + if ! zmodload zsh/zutil 2>/dev/null; then + ZTST_unimplemented="can't load the zsh/zutil module for testing" + fi + + # Helper function. Expects a single format using %s and a value for it. + zformat_and_print_s() { + zformat -f REPLY "$1" "s:$2" + print -r - ${(qq)REPLY} + } + +%test + + zformat_and_print_s '%s' foo + zformat_and_print_s '%5s' min + zformat_and_print_s '%-5s' neg + zformat_and_print_s '%5.s' empty + zformat_and_print_s '%.5s' max + zformat_and_print_s '%.5s' truncated +0:basic zformat test +>'foo' +>'min ' +>' neg' +>'empty' +>'max' +>'trunc' + + # There may be a set of digits either before or after the opening parenthesis. + zformat_and_print_s 'The answer is "%3(s.yes.no)".' 3 + zformat_and_print_s 'The answer is "%(3s.yes.no)".' 3 + # The test number defaults to zero. + zformat_and_print_s '%(s.equal.unequal)' -1 + zformat_and_print_s '%(s.equal.unequal)' 0 + zformat_and_print_s '%(s.equal.unequal)' 1 + # Negative numbers are allowed + # The delimiter is arbitrary + zformat_and_print_s '%-4(s.minus four.)' -4 + zformat_and_print_s '%(-4s//minus four)' -4 + # The argument is evaluated as a math expression + zformat_and_print_s '%18(s.math.)' '6*3' +0:basic conditionals test +>'The answer is "yes".' +>'The answer is "yes".' +>'unequal' +>'equal' +>'unequal' +>'minus four' +>'' +>'math' + + () { + zformat -f 1 '%(8n.%(5j.yes.no).no)' 'n:8' 'j:5' + echo $1 + } +0:nested conditionals test +>yes + + zformat -a argv . foo:lorem ipsum:bar bazbaz '\\esc\:ape' + print -rl -- "$@" +0:basic -a test +>foo .lorem +>ipsum.bar +>bazbaz +>\esc:ape diff --git a/configure.ac b/configure.ac index c8885cac5..e517d880a 100644 --- a/configure.ac +++ b/configure.ac @@ -444,9 +444,10 @@ dnl Do you want to look for capability support? AC_ARG_ENABLE(cap, AS_HELP_STRING([--enable-cap],[enable the search for POSIX capabilities (may require additional headers to be added by hand)])) +# Default off for licensing reasons AC_ARG_ENABLE(gdbm, -AS_HELP_STRING([--disable-gdbm],[turn off search for gdbm library]), -[gdbm="$enableval"], [gdbm=yes]) +AS_HELP_STRING([--enable-gdbm],[enable the search for the GDBM library (see the zsh/db/gdbm module)]), +[gdbm="$enableval"], [gdbm=no]) dnl ------------------ dnl CHECK THE COMPILER @@ -2539,6 +2540,7 @@ wmemcpy wmemmove wmemset; do AC_MSG_NOTICE([all functions found, multibyte support enabled]) zsh_cv_c_unicode_support=yes else + # Warns at the end of configure AC_MSG_NOTICE([missing functions, multibyte support disabled]) zsh_cv_c_unicode_support=no fi @@ -3285,13 +3287,18 @@ fi echo "See config.modules for installed modules and functions. " -case x$LIBS in - *-lgdbm*) - echo "WARNING: zsh will be linked against libgdbm. -This means the binary is covered by the GNU General Public License. -This does not affect the source code. -Run configure with --disable-gdbm if required." - ;; -esac +if test x$zsh_cv_c_unicode_support != xyes; then + if test "x$zfuncs_absent" = x; then + # The user opted out. + AC_MSG_WARN([You have chosen to build without multibyte support.]) + AC_MSG_WARN([This configuration may not be suitable for production use. It is known to cause errors in 'make test'. We strongly recommend to re-run configure with --enable-multibyte.]) + else + # Some requisite functions are missing. + AC_MSG_WARN([Multibyte support cannot be enabled: some standard library functions are missing: $zfuncs_absent]) + AC_MSG_WARN([This configuration may not be suitable for production use. It is known to cause errors in 'make test'. If your system provides those functions, we recommend to re-run configure appropriately.]) + # If your system doesn't have those functions, consider patching the + # test suite and sending the patch to zsh-workers@ for inclusion. + fi +fi exit 0 |