Problem pushing to a Novell share

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

a push to an .git-repository on a Novell network-share using msysgit
fails with the following error message:

error: unable to create temporary sha1 filename : File exists

The problem has been found in git version 1.7.9

The problem is caused by a non-existing sub-directory in the file path
which is not automatically created on Novell shares.

A quick fix is to improve the create_tmpfile() function in sha1_file.c:

static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
{
    static struct stat sb;
    int fd, dirlen = directory_size(filename);

    if (dirlen + 20 > bufsiz) {
        errno = ENAMETOOLONG;
        return -1;
    }

    memcpy(buffer, filename, dirlen);
    buffer[dirlen-1] = 0;
    if (stat(buffer, &sb) != 0 && errno == ENOENT) {
        if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
            return -1;
    }

    memcpy(buffer, filename, dirlen);
    strcpy(buffer + dirlen, "tmp_obj_XXXXXX");
    fd = git_mkstemp_mode(buffer, 0444);
    return fd;
}

The function will create one missing directory level if it does not
exist prior to creating the tmp-file.

This method seems to work, but it works only if one directory level is
missing which might not be the case in general. A better solution
would be to create the whole directory tree if needed.

The best solution would be if MINGW would handle this issue.

I recommend including this patch into GIT since it does no harm on
posix systems but it improves compatibility on others.

Rüdiger
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]