Skip to contentSkip to conversation

t9350-fast-export.sh broken on peff/pu under Mac OS X

DISCUSSION Torsten Bögershausen 4 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

The short version:
echo -n doesn't seem to be portable.
The following works for me:

(And is this a typo: test_expect_success 'test biridectionality' ')

/Torsten

diff ../../git.peff/t/t9350-fast-export.sh t9350-fast-export.sh
444,445c444,445
< echo -n > marks-cur &&
< echo -n > marks-new &&
---

Quoted 2 lines
      > marks-cur &&
      > marks-new &&

464c464
< echo -n > tmp-marks &&
---

Quoted 1 line
      > tmp-marks &&

474c474
< echo -n > expected &&
---

Quoted 1 line
      > expected &&
#1 lore raw
Quoted 3 lines · Torsten Bögershausen

The short version:
echo -n doesn't seem to be portable.
The following works for me:

Right, I was supposed to change that to:

true > marks-cur &&

I don't think the code below works everywhere.

Quoted 1 line

(And is this a typo: test_expect_success 'test biridectionality' ')

Right, thanks.

Quoted 1 line

diff ../../git.peff/t/t9350-fast-export.sh t9350-fast-export.sh

Please use diff -u, I think everybody is more familiar with that.

Cheers.

Signature · 1 line
Felipe Contreras
#2 lore raw
Quoted 8 lines · Felipe Contreras
Quoted 3 lines · Torsten Bögershausen

The short version:
echo -n doesn't seem to be portable.
The following works for me:

Right, I was supposed to change that to:

true > marks-cur &&

Please make it like so:

	>marks-cur &&

No command is necessary when creating an empty file or truncating an existing file to empty, and no SP between redirection and its target.

#3 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 7 lines · Felipe Contreras
Quoted 3 lines · Torsten Bögershausen

The short version:
echo -n doesn't seem to be portable.
The following works for me:

Right, I was supposed to change that to:

Quoted 8 lines
Quoted 1 line

true > marks-cur &&

Please make it like so:

        >marks-cur &&

No command is necessary when creating an empty file or truncating an existing file to empty, and no SP between redirection and its target.

That hangs on zsh (presumably waiting for stdin).

Signature · 1 line
Felipe Contreras
#4 lore raw
Quoted 12 lines · Felipe Contreras
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Felipe Contreras
Quoted 3 lines · Torsten Bögershausen

The short version:
echo -n doesn't seem to be portable.
The following works for me:

Right, I was supposed to change that to:

true > marks-cur &&

Quoted 9 lines
Quoted 6 lines

Please make it like so:

        >marks-cur &&

No command is necessary when creating an empty file or truncating an existing file to empty, and no SP between redirection and its target.

That hangs on zsh (presumably waiting for stdin).

Unless you set:

NULLCMD=:

early in your test script.

Or, to be extra-safe, you could steal this initialization code from autoconf:

# Be more Bourne compatible.
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
setopt NO_GLOB_SUBST
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"'
else
case (set -o) 2>/dev/null in *posix*) set -o posix ;; esac
fi

All of this untested with the real Git testsuite, of course ;-)

Regards, and HTH,
Stefano

#5 lore raw
Quoted 31 lines · Stefano Lattarini
Quoted 12 lines · Felipe Contreras
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Felipe Contreras
Quoted 3 lines · Torsten Bögershausen

The short version:
echo -n doesn't seem to be portable.
The following works for me:

Right, I was supposed to change that to:

true > marks-cur &&

Quoted 9 lines
Quoted 6 lines

Please make it like so:

        >marks-cur &&

No command is necessary when creating an empty file or truncating an existing file to empty, and no SP between redirection and its target.

That hangs on zsh (presumably waiting for stdin).

Unless you set:

NULLCMD=:

early in your test script.

Or, to be extra-safe, you could steal this initialization code from autoconf:

Quoted 8 lines
    # Be more Bourne compatible.
    if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
      emulate sh
      NULLCMD=:
      setopt NO_GLOB_SUBST
      # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
      # is contrary to our usage.  Disable this feature.
      alias -g '${1+"$@"}'='"$@"'

It doesn't seem like zsh listens to that variable in sh mode:

% zsh -c 'emulate sh; NULLCMD=foobar; > content'

And it doesn't seem like NO_GLOB_SUBST is needed any more.

I think it doesn't hurt to do 'true > marks-cur', but whatever.

Cheers.

Signature · 1 line
Felipe Contreras
#6 lore raw
Quoted 4 lines · Felipe Contreras

It doesn't seem like zsh listens to that variable in sh mode:

  $ zsh -c 'emulate sh; NULLCMD=foobar; > content'

Right; "emulate sh" by itself is probably enough today (autoconf, trying to make its generated scripts extra-portable, tends to accumulate a lot of cruft unfortunately).

Thanks,
Stefano