git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t/t7300: workaround ancient touch by rearranging arguments
@ 2010-09-15 20:58 Brandon Casey
  2010-09-15 22:08 ` Junio C Hamano
  2010-09-16  0:31 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: Brandon Casey @ 2010-09-15 20:58 UTC (permalink / raw)
  To: gitster; +Cc: git, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

The ancient touch on Solaris 7 thinks that a decimal number supplied as
the first argument specifies a date_time to give to the files specified by
the remaining arguments.  In this case, it fails to parse '1' as a proper
date_time and exits with a failure status.  Workaround this flaw by
rearranging the arguments supplied to touch so that a non-digit appears
first and touch will not be confused.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 t/t7300-clean.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 7dbbea1..6c776e9 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -443,7 +443,7 @@ test_expect_success 'git clean -e' '
 	(
 		cd repo &&
 		git init &&
-		touch 1 2 3 known &&
+		touch known 1 2 3 &&
 		git add known &&
 		git clean -f -e 1 -e 2 &&
 		test -e 1 &&
-- 
1.7.2.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/t7300: workaround ancient touch by rearranging arguments
  2010-09-15 20:58 [PATCH] t/t7300: workaround ancient touch by rearranging arguments Brandon Casey
@ 2010-09-15 22:08 ` Junio C Hamano
  2010-09-16  0:31 ` Jeff King
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2010-09-15 22:08 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, Brandon Casey

Brandon Casey <casey@nrlssc.navy.mil> writes:

> From: Brandon Casey <drafnel@gmail.com>
>
> The ancient touch on Solaris 7 thinks that a decimal number supplied as
> the first argument specifies a date_time to give to the files specified by
> the remaining arguments.  In this case, it fails to parse '1' as a proper
> date_time and exits with a failure status.  Workaround this flaw by
> rearranging the arguments supplied to touch so that a non-digit appears
> first and touch will not be confused.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>

Yuck, there were other reasons why I tend to write ">file" in our tests,
just to create a new and empty file, but I didn't remember seeing this
one.  It's been a while since I touched Solaris the last time.

Thanks for catching.

>  t/t7300-clean.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
> index 7dbbea1..6c776e9 100755
> --- a/t/t7300-clean.sh
> +++ b/t/t7300-clean.sh
> @@ -443,7 +443,7 @@ test_expect_success 'git clean -e' '
>  	(
>  		cd repo &&
>  		git init &&
> -		touch 1 2 3 known &&
> +		touch known 1 2 3 &&
>  		git add known &&
>  		git clean -f -e 1 -e 2 &&
>  		test -e 1 &&
> -- 
> 1.7.2.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/t7300: workaround ancient touch by rearranging arguments
  2010-09-15 20:58 [PATCH] t/t7300: workaround ancient touch by rearranging arguments Brandon Casey
  2010-09-15 22:08 ` Junio C Hamano
@ 2010-09-16  0:31 ` Jeff King
  2010-09-17 23:26   ` Sverre Rabbelier
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2010-09-16  0:31 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, Brandon Casey

On Wed, Sep 15, 2010 at 03:58:22PM -0500, Brandon Casey wrote:

> From: Brandon Casey <drafnel@gmail.com>
> 
> The ancient touch on Solaris 7 thinks that a decimal number supplied as
> the first argument specifies a date_time to give to the files specified by
> the remaining arguments.  In this case, it fails to parse '1' as a proper
> date_time and exits with a failure status.  Workaround this flaw by
> rearranging the arguments supplied to touch so that a non-digit appears
> first and touch will not be confused.

Hmm, this seemed eerily familiar, and sure enough:

  http://article.gmane.org/gmane.comp.version-control.git/101270

I don't _think_ I had Solaris 7 anytime recently, so the issue may be
even more widespread (I would guess that my patch was a result of
Solaris 8). Anyway, good catch.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/t7300: workaround ancient touch by rearranging arguments
  2010-09-16  0:31 ` Jeff King
@ 2010-09-17 23:26   ` Sverre Rabbelier
  2010-09-18  3:46     ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Sverre Rabbelier @ 2010-09-17 23:26 UTC (permalink / raw)
  To: Jeff King; +Cc: Brandon Casey, gitster, git, Brandon Casey

Heya,

On Thu, Sep 16, 2010 at 02:31, Jeff King <peff@peff.net> wrote:
> Hmm, this seemed eerily familiar, and sure enough:
>
>  http://article.gmane.org/gmane.comp.version-control.git/101270

Does this call for a git_touch which does a regular 'touch' for each
of its arguments?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/t7300: workaround ancient touch by rearranging arguments
  2010-09-17 23:26   ` Sverre Rabbelier
@ 2010-09-18  3:46     ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2010-09-18  3:46 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Brandon Casey, gitster, git, Brandon Casey

On Sat, Sep 18, 2010 at 01:26:25AM +0200, Sverre Rabbelier wrote:

> On Thu, Sep 16, 2010 at 02:31, Jeff King <peff@peff.net> wrote:
> > Hmm, this seemed eerily familiar, and sure enough:
> >
> >  http://article.gmane.org/gmane.comp.version-control.git/101270
> 
> Does this call for a git_touch which does a regular 'touch' for each
> of its arguments?

I don't know the broken touch's behavior, and I don't have it handy. It
might handle "touch 1" fine or it might interpret it as "touch at time
1, no file arguments". Brandon's solution is good enough for a test
script.

If you really wanted a portable git_touch, you would spell it ">>$file".

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-18  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 20:58 [PATCH] t/t7300: workaround ancient touch by rearranging arguments Brandon Casey
2010-09-15 22:08 ` Junio C Hamano
2010-09-16  0:31 ` Jeff King
2010-09-17 23:26   ` Sverre Rabbelier
2010-09-18  3:46     ` Jeff King

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).