zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Boundary error in VCS_INFO_set --nvcs
Date: Wed, 13 Apr 2022 14:34:28 -0700	[thread overview]
Message-ID: <CAH+w=7bNc7LpU+Rdyw8=+eKLXEB43YGkq+uVU3gk4q60rCr3Zw@mail.gmail.com> (raw)

This output is from an older version of VCS_INFO but I don't see a
diff that would have changed anything but line numbers:

+vcs_info:52> VCS_INFO_set --nvcs
+VCS_INFO_set:5> setopt localoptions noksharrays NO_shwordsplit
+VCS_INFO_set:6> local -i i j
+VCS_INFO_set:8> [[ --nvcs == --nvcs ]]
+VCS_INFO_set:9> [[ '' == -preinit- ]]
+VCS_INFO_set:10> i=0
+VCS_INFO_set:11> typeset -gx 'vcs_info_msg_0_='
+VCS_INFO_set:10> i=-1
+VCS_INFO_set:11> typeset -gx 'vcs_info_msg_-1_='
VCS_INFO_set:typeset:11: not valid in this context: vcs_info_msg_-1_

The problem is that when disable-patterns matches the current
directory, vcs_info invokes VCS_INFO_set --nvcs, which hits this loop:

 if [[ $1 == '--nvcs' ]] ; then
     [[ $2 == '-preinit-' ]] && (( maxexports == 0 )) && (( maxexports = 1 ))
     for i in {0..$((maxexports - 1))} ; do

Because $2 is not "-preeinit-", when maxexports is zero it is never
reset to 1 and the "for" loop runs backwards to -1.  I don't otherwise
know how to reproduce the situation where VCS_INFO_maxexports is never
called.


             reply	other threads:[~2022-04-14  2:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 21:34 Bart Schaefer [this message]
2022-04-17 18:04 ` Daniel Shahaf
2022-04-17 18:48   ` Daniel Shahaf
2022-04-17 21:31     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bNc7LpU+Rdyw8=+eKLXEB43YGkq+uVU3gk4q60rCr3Zw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).