RE: Porting git to HP NonStop

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

 



> From: Shawn Pearce [mailto:spearce@xxxxxxxxxxx]
> Sent: Friday, August 10, 2012 7:38 PM
> To: Joachim Schmitz
> Cc: git@xxxxxxxxxxxxxxx; rsbecker@xxxxxxxxxxxxx
> Subject: Re: Porting git to HP NonStop
> 
> On Fri, Aug 10, 2012 at 10:32 AM, Joachim Schmitz
<jojo@xxxxxxxxxxxxxxxxxx>
> wrote:
> >> then use `git init --bare` in a new directory to copy in the
> >> templates,
> > and see if
> >> its the template copying code that is making an incorrect copy.
> >
> > "git init --bare" gives the same error. It isn't copying any of the
> > subdirectories, only the file 'description'
> 
> Time to start debugging copy_templates_1 in builtin/init-db.c. :-(

Found the problem: our mkdir(dir,flags) fails with ENOENT when dir ends with
a '/'.
Not sure whether this us a bug on out platform or just allowed by POSIX and
as such a wrong assumption in git though?

[shortly after]
A bit of googleing revealed that there is a GNUlib solution for this, which
claims that at least NetBSD 1.5.2 has the same problem.
(http://www.opensource.apple.com/source/gpatch/gpatch-2/patch/mkdir.c)

And apparently this has been discussed on the git mailing list too, 2 years
ago:
http://lists-archives.com/git/728359-git-s-use-of-mkdir-2.html, there's a
patch too.

For now I've fixed it like this:
/usr/local/bin/diff -EBbu ./builtin/init-db.c.orig ./builtin/init-db.c
--- ./builtin/init-db.c.orig    2012-08-19 03:55:50 -0500
+++ ./builtin/init-db.c 2012-08-19 03:39:57 -0500
@@ -25,7 +25,16 @@

 static void safe_create_dir(const char *dir, int share)
 {
+#ifdef __TANDEM /* our mkdir() can't cope with a trailing '/' */
+       char mydir[PATH_MAX];
+
+       strcpy(mydir,dir);
+       if (dir[strlen(dir)-1] == '/')
+               mydir[strlen(dir)-1] = '\0';
+       if (mkdir(mydir, 0777) < 0) {
+#else
        if (mkdir(dir, 0777) < 0) {
+#endif
                if (errno != EEXIST) {
                        perror(dir);
                        exit(1);



Bye, Jojo 

--
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]