5

I'm on Linux Mint 17 64-bit. Just purged git and re-installed with apt. Deleted ~/.gitconfig. Only configuration I do after supposedly fresh install is (while inside a repo)

git config diff.tool vimdiff

Then I run

git difftool HEAD:switch-monitor.sh master:switch-monitor.sh

and get

fatal: cannot exec 'git-difftool--helper': Bad address
external diff died, stopping at HEAD:switch-monitor.sh.

So I remove the pertinent line from .git/config and try the command again, and sure enough the built in basic git diff works.

I've also tried the instructions in this tutorial: http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/

That leads to a slightly different but similar error. I place the following in a new ~/.gitconfig

[diff]
  external = git_diff_wrapper
[pager]
  diff =

And place and make executable a git_diff_wrapper file on my PATH, and run

git diff HEAD:switch-monitor.sh master:switch-monitor.sh 

And get

fatal: cannot exec 'git_diff_wrapper': Bad address
external diff died, stopping at HEAD:switch-monitor.sh.

However, it seems to have nothing to do with the content of git_diff_wrapper. I placed

#!/bin/bash
echo hello

Into it and that doesn't change anything. However, if I remove the file or rename it, then I do get this

error: cannot run git_diff_wrapper: No such file or directory
external diff died, stopping at HEAD:switch-monitor.sh.

Note it says "No such file or directory" instead of "Bad address" in this case.

I've searched and can't find an instance of a similar problem online.

Update

I'm getting the same problem in a fresh install of Ubuntu 14.04 on a virtual machine

Update

I've spent some time looking at git's source, and I'm pretty sure errno is getting set to EFAULT ("Bad address"), in the course of this function:

static int execv_shell_cmd(const char **argv)
{
    const char **nargv = prepare_shell_cmd(argv);
    trace_argv_printf(nargv, "trace: exec:");
    sane_execvp(nargv[0], (char **)nargv);
    free(nargv);
    return -1;
}

Which calls this:

int sane_execvp(const char *file, char * const argv[])
{
    if (!execvp(file, argv))
        return 0; /* cannot happen ;-) */

    /*
     * When a command can't be found because one of the directories
     * listed in $PATH is unsearchable, execvp reports EACCES, but
     * careful usability testing (read: analysis of occasional bug
     * reports) reveals that "No such file or directory" is more
     * intuitive.
     *
     * We avoid commands with "/", because execvp will not do $PATH
     * lookups in that case.
     *
     * The reassignment of EACCES to errno looks like a no-op below,
     * but we need to protect against exists_in_PATH overwriting errno.
     */
    if (errno == EACCES && !strchr(file, '/'))
        errno = exists_in_PATH(file) ? EACCES : ENOENT;
    else if (errno == ENOTDIR && !strchr(file, '/'))
        errno = ENOENT;
    return -1;
}

Any ideas?

Thanks

1
  • I have the same problem on renamed files with git difftool -C --tool=meld -Y master Without the -C flag, it doesn't crash (but it doesn't see renames neither...) Commented Feb 14, 2015 at 8:02

3 Answers 3

1

I know this is an old thread, but it doesn't seem to be closed...

I've encountered similar error (I also wanted to use vimdiff to check the difference between the two commits). What worked for me: git difftool HEAD..HEAD~1 --path-to-file/file

as in https://stackoverflow.com/questions/3338126/git-how-to-diff-the-same-file-between-two-different-commits-on-the-same-branch

Cheers

0

The solution for me was to upgrade to git 2.x. With git 2.3.4, I no longer have this issue.

-1

I had the same problem on Ubuntu14, fixed by upgrading git from v1.9.1 to v2.11.0.

I had to use git maintainer repo for the upgrade, as described HERE.

1
  • link-only answes are not very helpful. Your answer by itself should contain all relevant information.
    – Ramhound
    Commented Mar 31, 2017 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .