# [PATCH] Work around broken ln on solaris as used in t8006

6 messages from 2011-03-20 to 2011-03-21. Participants: Ben Walton, Junio C Hamano.
Thread: https://gitlist.dev/t/26809

## Ben Walton, 2011-03-20 23:59

Subject: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <1300665586-24512-1-git-send-email-bwalton@artsci.utoronto.ca>
URL: https://gitlist.dev/e/1300665586-24512-1-git-send-email-bwalton%40artsci.utoronto.ca

```
The test setup in t8006-blame-textconv.sh used ln -sf to overwrite an
existing symlink.  Unfortunately, both /usr/bin/ln and
/usr/xpg4/bin/ln on solaris 9 don't properly handle -f when -s is
used.  This caused the test setup to fail which caused subsequent
checks to also fail.

This patch uses changes the first check in the test to rm the symlink
and then create the new symlink using only -s.

The upstream Solaris bug (fixed in 10, but not 9) is documented here:
http://bugs.opensolaris.org/view_bug.do?bug_id=4372462

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 t/t8006-blame-textconv.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index ea64cd8..c5362d9 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -24,8 +24,9 @@ test_expect_success 'setup ' '
 	GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" &&
 	echo "bin: test 1 version 2" >one.bin &&
 	echo "bin: test number 2 version 2" >>two.bin &&
+	rm symlink.bin &&
 	if test_have_prereq SYMLINKS; then
-		ln -sf two.bin symlink.bin
+		ln -s two.bin symlink.bin
 	fi &&
 	GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
 '
-- 
1.7.1

```

## Ben Walton, 2011-03-21 00:45

Subject: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <1300668306-25662-1-git-send-email-bwalton@artsci.utoronto.ca>
URL: https://gitlist.dev/e/1300668306-25662-1-git-send-email-bwalton%40artsci.utoronto.ca
In-Reply-To: <1300665586-24512-1-git-send-email-bwalton@artsci.utoronto.ca>

```
The test setup in t8006-blame-textconv.sh used ln -sf to overwrite an
existing symlink.  Unfortunately, both /usr/bin/ln and
/usr/xpg4/bin/ln on solaris 9 don't properly handle -f when -s is
used.  This caused the test setup to fail which caused subsequent
checks to also fail.

This patch changes the first check in the test to rm the symlink
and then create the new symlink using only -s.

The upstream Solaris bug (fixed in 10, but not 9) is documented here:
http://bugs.opensolaris.org/view_bug.do?bug_id=4372462

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---

Fixed typo in the original submission...

 t/t8006-blame-textconv.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index ea64cd8..c5362d9 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -24,8 +24,9 @@ test_expect_success 'setup ' '
 	GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" &&
 	echo "bin: test 1 version 2" >one.bin &&
 	echo "bin: test number 2 version 2" >>two.bin &&
+	rm symlink.bin &&
 	if test_have_prereq SYMLINKS; then
-		ln -sf two.bin symlink.bin
+		ln -s two.bin symlink.bin
 	fi &&
 	GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
 '
-- 
1.7.1

```

## Junio C Hamano, 2011-03-21 01:02

Subject: Re: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <7vd3lluvze.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd3lluvze.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1300665586-24512-1-git-send-email-bwalton@artsci.utoronto.ca>

```
Ben Walton <bwalton@artsci.utoronto.ca> writes:

> The test setup in t8006-blame-textconv.sh used ln -sf to overwrite an
> existing symlink.  Unfortunately, both /usr/bin/ln and
> /usr/xpg4/bin/ln on solaris 9 don't properly handle -f when -s is
> used.

Thanks for reporting.  I recall "ln -s -f" traditionally has been a pain
point not just on Solaris.

> This caused the test setup to fail which caused subsequent
> checks to also fail.
>
> This patch uses changes the first check in the test to rm the symlink
> and then create the new symlink using only -s.

s/uses //; I think.

It is curious why "rm symlink.bin" is not inside the test-have-prereq
part, iow, immediately before the problematic "ln -s", where it logically
belongs to, though.  What does the updated code do on systems without
symbolic link support?

> The upstream Solaris bug (fixed in 10, but not 9) is documented here:
> http://bugs.opensolaris.org/view_bug.do?bug_id=4372462
>
> Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
> ---
>  t/t8006-blame-textconv.sh |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
> index ea64cd8..c5362d9 100755
> --- a/t/t8006-blame-textconv.sh
> +++ b/t/t8006-blame-textconv.sh
> @@ -24,8 +24,9 @@ test_expect_success 'setup ' '
>  	GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" &&
>  	echo "bin: test 1 version 2" >one.bin &&
>  	echo "bin: test number 2 version 2" >>two.bin &&
> +	rm symlink.bin &&
>  	if test_have_prereq SYMLINKS; then
> -		ln -sf two.bin symlink.bin
> +		ln -s two.bin symlink.bin
>  	fi &&
>  	GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
>  '

```

## Ben Walton, 2011-03-21 01:10

Subject: Re: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <1300669724-sup-450@pinkfloyd.chass.utoronto.ca>
URL: https://gitlist.dev/e/1300669724-sup-450%40pinkfloyd.chass.utoronto.ca
In-Reply-To: <7vd3lluvze.fsf@alter.siamese.dyndns.org>

```
Excerpts from Junio C Hamano's message of Sun Mar 20 21:02:13 -0400 2011:

Hi Junio,

> > This patch uses changes the first check in the test to rm the symlink
> > and then create the new symlink using only -s.
> 
> s/uses //; I think.

Yes, I caught that right after send.  A follow up corrected it, but
I'll resubmit taking your feedback below into account.

> It is curious why "rm symlink.bin" is not inside the
> test-have-prereq part, iow, immediately before the problematic "ln
> -s", where it logically belongs to, though.  What does the updated
> code do on systems without symbolic link support?

I think you're right about this.  They should be logically grouped.
I'll send an update shortly.

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

```

## Ben Walton, 2011-03-21 01:12

Subject: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <1300669946-26326-1-git-send-email-bwalton@artsci.utoronto.ca>
URL: https://gitlist.dev/e/1300669946-26326-1-git-send-email-bwalton%40artsci.utoronto.ca
In-Reply-To: <1300669724-sup-450@pinkfloyd.chass.utoronto.ca>

```
The test setup in t8006-blame-textconv.sh used ln -sf to overwrite an
existing symlink.  Unfortunately, both /usr/bin/ln and
/usr/xpg4/bin/ln on solaris 9 don't properly handle -f when -s is
used.  This caused the test setup to fail which caused subsequent
checks to also fail.

This patch changes the setup to rm the symlink and then create the new
one using only -s.

The upstream Solaris bug (fixed in 10, but not 9) is documented here:
http://bugs.opensolaris.org/view_bug.do?bug_id=4372462

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 t/t8006-blame-textconv.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index ea64cd8..32ec82a 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -25,7 +25,8 @@ test_expect_success 'setup ' '
 	echo "bin: test 1 version 2" >one.bin &&
 	echo "bin: test number 2 version 2" >>two.bin &&
 	if test_have_prereq SYMLINKS; then
-		ln -sf two.bin symlink.bin
+		rm symlink.bin &&
+		ln -s two.bin symlink.bin
 	fi &&
 	GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
 '
-- 
1.7.1

```

## Junio C Hamano, 2011-03-21 05:00

Subject: Re: [PATCH] Work around broken ln on solaris as used in t8006
Message-ID: <7v4o6xukys.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4o6xukys.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1300669946-26326-1-git-send-email-bwalton@artsci.utoronto.ca>

```
Ben Walton <bwalton@artsci.utoronto.ca> writes:

> The upstream Solaris bug (fixed in 10, but not 9) is documented here:
> http://bugs.opensolaris.org/view_bug.do?bug_id=4372462
>
> Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>

Thanks; will queue.

```
