git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [RFC/PATCH] t0081-*.sh: Fix failure of the 'long read' tests
Date: Tue, 26 Apr 2011 19:48:51 -0400	[thread overview]
Message-ID: <20110426234850.GC32491@sigill.intra.peff.net> (raw)
In-Reply-To: <4DB70972.20308@ramsay1.demon.co.uk>

On Tue, Apr 26, 2011 at 07:05:38PM +0100, Ramsay Jones wrote:

> The infinite loop is caused by the loop variable increment
> expression, which looks something like this:
> 
>     : $((i = $i + 1)) || return
>
> [...]
>
> The reason for the RFC is that I don't understand why (apparently)
> I'm the only person seeing this failure; I suspect that a newer
> version of bash than I have does not have this problem (ie the
> original arithmetic expansion actually works). dunno :-(

Yeah, that syntax is handled just fine by my bash and dash:

  $ cat >foo.sh <<'EOF'
  i=1
  : $((i = $i + 1))
  echo $i
  EOF

  $ bash foo.sh
  2
  $ bash --version | head -n 1
  GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)

  $ dash foo.sh
  2

But I think your i=$(($i + 1)) is the right solution.

-Peff

  parent reply	other threads:[~2011-04-26 23:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 18:05 [RFC/PATCH] t0081-*.sh: Fix failure of the 'long read' tests Ramsay Jones
2011-04-26 19:35 ` Jonathan Nieder
2011-04-30 17:12   ` Ramsay Jones
2011-04-26 23:48 ` Jeff King [this message]
2011-04-30 17:25   ` Ramsay Jones
2011-05-26  4:33     ` [PULL svn-fe/maint] " Jonathan Nieder
2011-05-26 16:03       ` Junio C Hamano

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=20110426234850.GC32491@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /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.
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).