t7610-mergetool.sh test failure

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

t7610-mergetool.sh test failure

Armin Kunaschik
t7610-mergetool.sh fails on systems without mktemp.

mktemp is used in git-mergetool.sh and throws an error when it's not available.
error: mktemp is needed when 'mergetool.writeToTemp' is true

I see 2 options:
1. code around it, write an own mktemp, maybe use the test-mktemp as a basis.
2. disable the test when mktemp is not available

From my point of view option 2 would be enough.
Any opinions about that?

Peff suggested something like this... works for me.
This patch is probably whitespace damaged... I could not yet figure out a way
to use and preserve tabs with Google mail.

---
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 76306cf..9279bf5 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -589,7 +589,12 @@ test_expect_success 'filenames seen by tools
start with ./' '
        git reset --hard master >/dev/null 2>&1
 '

-test_expect_success 'temporary filenames are used with mergetool.writeToTemp' '
+test_lazy_prereq MKTEMP '
+       tempdir=$(mktemp -d -t foo.XXX) &&
+       test -d "$tempdir"
+'
+
+test_expect_success MKTEMP 'temporary filenames are used with
mergetool.writeToTemp' '
        git checkout -b test16 branch1 &&
        test_config mergetool.writeToTemp true &&
        test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t7610-mergetool.sh test failure

Junio C Hamano
On Tue, May 24, 2016 at 9:44 AM, Armin Kunaschik
<[hidden email]> wrote:
> t7610-mergetool.sh fails on systems without mktemp.
>
> mktemp is used in git-mergetool.sh and throws an error when it's not available.
> error: mktemp is needed when 'mergetool.writeToTemp' is true
>
> I see 2 options:
> 1. code around it, write an own mktemp, maybe use the test-mktemp as a basis.
> 2. disable the test when mktemp is not available

3. find and install mktemp?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t7610-mergetool.sh test failure

Armin Kunaschik
On Tue, May 24, 2016 at 6:45 PM, Junio C Hamano <[hidden email]> wrote:

> 3. find and install mktemp?
Sure, but which one? :-) mktemp is not mentioned in POSIX.
http://stackoverflow.com/questions/2792675/how-portable-is-mktemp1
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t7610-mergetool.sh test failure

Jeff King
In reply to this post by Junio C Hamano
On Tue, May 24, 2016 at 09:45:25AM -0700, Junio C Hamano wrote:

> On Tue, May 24, 2016 at 9:44 AM, Armin Kunaschik
> <[hidden email]> wrote:
> > t7610-mergetool.sh fails on systems without mktemp.
> >
> > mktemp is used in git-mergetool.sh and throws an error when it's not available.
> > error: mktemp is needed when 'mergetool.writeToTemp' is true
> >
> > I see 2 options:
> > 1. code around it, write an own mktemp, maybe use the test-mktemp as a basis.
> > 2. disable the test when mktemp is not available
>
> 3. find and install mktemp?

I'd agree more with (3) if it was some critical part of git-mergetool.
But it seems to be a completely optional feature that we use in only one
place, and git-mergetool even detects this case and complains.

So another alternative would be for the test to detect either that
mergetool worked, or that we got the "mktemp is needed" error.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t7610-mergetool.sh test failure

Jeff King
On Wed, May 25, 2016 at 06:16:15PM -0500, Jeff King wrote:

> On Tue, May 24, 2016 at 09:45:25AM -0700, Junio C Hamano wrote:
>
> > On Tue, May 24, 2016 at 9:44 AM, Armin Kunaschik
> > <[hidden email]> wrote:
> > > t7610-mergetool.sh fails on systems without mktemp.
> > >
> > > mktemp is used in git-mergetool.sh and throws an error when it's not available.
> > > error: mktemp is needed when 'mergetool.writeToTemp' is true
> > >
> > > I see 2 options:
> > > 1. code around it, write an own mktemp, maybe use the test-mktemp as a basis.
> > > 2. disable the test when mktemp is not available
> >
> > 3. find and install mktemp?
>
> I'd agree more with (3) if it was some critical part of git-mergetool.
> But it seems to be a completely optional feature that we use in only one
> place, and git-mergetool even detects this case and complains.
>
> So another alternative would be for the test to detect either that
> mergetool worked, or that we got the "mktemp is needed" error.

BTW, one thing I happened to note while looking at this: running the
test script will write into /tmp (or wherever your $TMPDIR points).
Probably not a big deal, but I wonder if we should be setting $TMPDIR in
our test harness.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Loading...