threads / discuss / 21962

Git on QNX

Subject: Git on QNX

## tl;dr

7 messages between Dec 15, 2009 and Dec 17, 2009.

replies: 6people: 4as markdown or json

Tarmigan· Dec 15, 2009, 21:23 UTC · lore
Is anyone running git on QNX?

I have compiled and installed it (see config below) but it is failing a number of the tests. I suspect that many of the later failures are related to the earlier ones, so I think the earlier ones are probably more interesting. Am I missing some makefile options?

Despite the test failures, I have been running the binaries successfully for a couple days. I'm not planning on using git on QNX very heavily or for very long, but as long as I'm on QNX I figured I try to get git to work on it.

Here's the tests that are currently failing:
	t0000.42  absolute path works as expected
	t0006.14  parse date (2008-02-14 20:30:45)
	t1002-read-tree-m-u-2way.sh lots of failures
	t1100.4 compare commit
	t1400.22,27,38,41
	t1410.8 reflog delete
	t2300.4,5 cd-to-toplevel
	t3200.5,30 branch (maybe same as date in t0006.14?)
	t3900.10,18 NO_ICONV?
	t3901 NO_ICONV?
	t4013-diff-various.sh lots of failures
	t4201.3 shortlog encoding (NO_ICONV?)
	t5000.13 tar tree validate file modification time
	t5100-mailinfo.sh
	t5510-fetch.sh

I got impatient after about t5600 because QNX in a virtual machine is very slow. If anyone else wants to try it, you can download a QNX .iso, get a free 30-day evaluation license and install and run in a virtual machine.

I have started to look into t0000.42 a little. The symlinks seem to get setup properly but make_absolute_path gives incorrect results: # ls -l second/other lrwxrwxrwx 1 root root 8 Dec 15 12:27 second/other -> ../first # ../../test-path-utils make_absolute_path third/../second/other/.git/syml /root/git/t/trash directory.t0000-basic/second/other/.git/syml # ../../test-path-utils make_absolute_path second/other/.git/syml /root/git/t/trash directory.t0000-basic/second/other/.git/syml # ../../test-path-utils make_absolute_path second/other /root/git/t/trash directory.t0000-basic/second/first <---- THIS LOOKS WRONG # ../../test-path-utils make_absolute_path second/other/ /root/git/t/trash directory.t0000-basic/second/first <---- THIS LOOKS WRONG # ../../test-path-utils make_absolute_path second/other/.git ../.git <---- THIS LOOKS WRONG

If anyone has any ideas or interest in the other failing tests, I can provide more specific information.

Here's the diff that I applied to make git compile (cut-n-paste + gmail warning) and it's on top of 9a424b27. I would like to properly submit some bits of it once the tests are passing.

Thanks, Tarmigan

--------
diff --git a/Makefile b/Makefile
index 4a1e5bc..ca78dcd 100644
--- a/Makefile
+++ b/Makefile
@@ -934,6 +934,30 @@ ifeq ($(uname_S),HP-UX)
 	NO_SYS_SELECT_H = YesPlease
 	SNPRINTF_RETURNS_BOGUS = YesPlease
 endif
+ifeq ($(uname_S),QNX)
+	NO_OPENSSL=YesPlease
+	NO_CURL=YesPlease
+	NEEDS_SOCKET=YesPlease
+	NO_D_TYPE_IN_DIRENT=YesPlease
+	NO_STRCASESTR=YesPlease
+	NO_MEMMEM = YesPlease
+	NO_STRLCPY = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MKSTEMPS = YesPlease
+	#NO_ICONV=YesPlease
+	OLD_ICONV=UnfortunatelyYes
+	NEEDS_LIBICONV=yes
+	ICONVDIR=/opt
+	NO_R_TO_GCC_LINKER=UnfortunatelyYes
+	NO_DEFLATE_BOUND=yes
+	FREAD_READS_DIRECTORIES=UnfortunatelyYes
+	NO_PTHREADS=UnfortunatelyYes
+	NO_MMAP=YesPlease
+	NO_NSEC=YesPlease
+	PERL_PATH=/opt/bin/perl
+	#NO_HSTRERROR = YesPlease
+	#NO_SYS_SELECT_H = YesPlease
+endif
 ifeq ($(uname_S),Windows)
 	GIT_VERSION := $(GIT_VERSION).MSVC
 	pathsep = ;
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 8ed4a6f..5cbc16c 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -778,7 +778,7 @@ static int fetch_pack_config(const char *var,
const char *value, void *cb)
 	return git_default_config(var, value, cb);
 }

-static struct lock_file lock;
+static struct lock_file lockfile;

 static void fetch_pack_setup(void)
 {
@@ -958,14 +958,14 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 			  )
 			die("shallow file was changed during fetch");

-		fd = hold_lock_file_for_update(&lock, shallow,
+		fd = hold_lock_file_for_update(&lockfile, shallow,
 					       LOCK_DIE_ON_ERROR);
 		if (!write_shallow_commits(&sb, 0)
 		 || write_in_full(fd, sb.buf, sb.len) != sb.len) {
 			unlink_or_warn(shallow);
-			rollback_lock_file(&lock);
+			rollback_lock_file(&lockfile);
 		} else {
-			commit_lock_file(&lock);
+			commit_lock_file(&lockfile);
 		}
 		strbuf_release(&sb);
 	}
diff --git a/git-compat-util.h b/git-compat-util.h
index 5c59687..857e938 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -42,6 +42,11 @@
 /* Approximation of the length of the decimal representation of this type. */
 #define decimal_length(x)	((int)(sizeof(x) * 2.56 + 0.5) + 1)

+#if defined(__QNX__)
+#define getpagesize() sysconf(_SC_PAGESIZE)
+#define SA_RESTART 0
+#endif
+
 #if defined(__sun__)
  /*
   * On Solaris, when _XOPEN_EXTENDED is set, its header file
@@ -55,7 +60,7 @@
 # else
 # define _XOPEN_SOURCE 500
 # endif
-#elif !defined(__APPLE__) && !defined(__FreeBSD__)  &&
!defined(__USLC__) && !defined(_M_UNIX) && !defined(sgi)
+#elif !defined(__APPLE__) && !defined(__FreeBSD__)  &&
!defined(__USLC__) && !defined(_M_UNIX) && !defined(sgi) &&
!defined(__QNX__)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD
needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
@@ -79,6 +84,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+#include <strings.h>
 #include <errno.h>
 #include <limits.h>
 #include <sys/param.h>
Junio C Hamano· Dec 15, 2009, 21:42 UTC · re: Tarmigan · lore

Re: Git on QNX

Tarmigan <tarmigan+git@gmail.com> writes:
Show 32 quoted lines
> diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
> index 8ed4a6f..5cbc16c 100644
> --- a/builtin-fetch-pack.c
> +++ b/builtin-fetch-pack.c
> @@ -778,7 +778,7 @@ static int fetch_pack_config(const char *var,
> const char *value, void *cb)
>  	return git_default_config(var, value, cb);
>  }
>
> -static struct lock_file lock;
> +static struct lock_file lockfile;
>
>  static void fetch_pack_setup(void)
>  {
> @@ -958,14 +958,14 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
>  			  )
>  			die("shallow file was changed during fetch");
>
> -		fd = hold_lock_file_for_update(&lock, shallow,
> +		fd = hold_lock_file_for_update(&lockfile, shallow,
>  					       LOCK_DIE_ON_ERROR);
>  		if (!write_shallow_commits(&sb, 0)
>  		 || write_in_full(fd, sb.buf, sb.len) != sb.len) {
>  			unlink_or_warn(shallow);
> -			rollback_lock_file(&lock);
> +			rollback_lock_file(&lockfile);
>  		} else {
> -			commit_lock_file(&lock);
> +			commit_lock_file(&lockfile);
>  		}
>  		strbuf_release(&sb);
>  	}

Is this because QNX uses "lock" as some global identifier for some other purpose? I think moving the file-scope-static definition to the scope it is used in without renaming would make a cleaner patch.

Show 12 quoted lines
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 5c59687..857e938 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -79,6 +84,7 @@
>  #include <stdlib.h>
>  #include <stdarg.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <errno.h>
>  #include <limits.h>
>  #include <sys/param.h>

Other hunks are QNX specific enough but this hunk is worrisome; you cannot tell how you are hurting other platforms with this change. Can you tell declarations of which functions are missing on QNX without this change?

Tarmigan· Dec 15, 2009, 22:13 UTC · re: Junio C Hamano · lore

Re: Git on QNX

On Tue, Dec 15, 2009 at 1:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 38 quoted lines
> Tarmigan <tarmigan+git@gmail.com> writes:
>
>> diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
>> index 8ed4a6f..5cbc16c 100644
>> --- a/builtin-fetch-pack.c
>> +++ b/builtin-fetch-pack.c
>> @@ -778,7 +778,7 @@ static int fetch_pack_config(const char *var,
>> const char *value, void *cb)
>>       return git_default_config(var, value, cb);
>>  }
>>
>> -static struct lock_file lock;
>> +static struct lock_file lockfile;
>>
>>  static void fetch_pack_setup(void)
>>  {
>> @@ -958,14 +958,14 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
>>                         )
>>                       die("shallow file was changed during fetch");
>>
>> -             fd = hold_lock_file_for_update(&lock, shallow,
>> +             fd = hold_lock_file_for_update(&lockfile, shallow,
>>                                              LOCK_DIE_ON_ERROR);
>>               if (!write_shallow_commits(&sb, 0)
>>                || write_in_full(fd, sb.buf, sb.len) != sb.len) {
>>                       unlink_or_warn(shallow);
>> -                     rollback_lock_file(&lock);
>> +                     rollback_lock_file(&lockfile);
>>               } else {
>> -                     commit_lock_file(&lock);
>> +                     commit_lock_file(&lockfile);
>>               }
>>               strbuf_release(&sb);
>>       }
>
> Is this because QNX uses "lock" as some global identifier for some other
> purpose?  I think moving the file-scope-static definition to the scope
> it is used in without renaming would make a cleaner patch.

Yes, exactly that reason. I agree the declaration should just move into fetch_pack() as a static, but I didn't realize that until after I had renamed all of the uses, and I was lazy as this was not for submission.

Show 17 quoted lines
>
>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index 5c59687..857e938 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -79,6 +84,7 @@
>>  #include <stdlib.h>
>>  #include <stdarg.h>
>>  #include <string.h>
>> +#include <strings.h>
>>  #include <errno.h>
>>  #include <limits.h>
>>  #include <sys/param.h>
>
> Other hunks are QNX specific enough but this hunk is worrisome; you cannot
> tell how you are hurting other platforms with this change.  Can you tell
> declarations of which functions are missing on QNX without this change?

strcasecmp() http://www.opengroup.org/onlinepubs/000095399/functions/strcasecmp.html

I agree that this change could affect other platforms and they've gotten along fine without it so far. I'm surprised no others have needed it. Would it be better wrapped in a #ifdef?

Thanks, Tarmigan

Alex Riesen· Dec 16, 2009, 14:20 UTC · re: Tarmigan · lore

Re: Git on QNX

On Tue, Dec 15, 2009 at 23:13, Tarmigan <tarmigan+git@gmail.com> wrote:
Show 21 quoted lines
> On Tue, Dec 15, 2009 at 1:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Tarmigan <tarmigan+git@gmail.com> writes:
>>> diff --git a/git-compat-util.h b/git-compat-util.h
>>> index 5c59687..857e938 100644
>>> --- a/git-compat-util.h
>>> +++ b/git-compat-util.h
>>> @@ -79,6 +84,7 @@
>>>  #include <stdlib.h>
>>>  #include <stdarg.h>
>>>  #include <string.h>
>>> +#include <strings.h>
>>>  #include <errno.h>
>>>  #include <limits.h>
>>>  #include <sys/param.h>
>>
>> Other hunks are QNX specific enough but this hunk is worrisome; you cannot
>> tell how you are hurting other platforms with this change.  Can you tell
>> declarations of which functions are missing on QNX without this change?
>
> strcasecmp()
> http://www.opengroup.org/onlinepubs/000095399/functions/strcasecmp.html

Just for completeness: http://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/s/strcasecmp.html http://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/s/strcmpi.html

> I agree that this change could affect other platforms and they've
> gotten along fine without it so far.  I'm surprised no others have
> needed it.  Would it be better wrapped in a #ifdef?
If you put the ifdef in git-compat-util.h
Sean Boudreau· Dec 16, 2009, 22:38 UTC · re: Tarmigan · lore

Re: Git on QNX

Tarmigan <tarmigan+git <at> gmail.com> writes:
Show 15 quoted lines
> >
> > Other hunks are QNX specific enough but this hunk is worrisome; you cannot
> > tell how you are hurting other platforms with this change.  Can you tell
> > declarations of which functions are missing on QNX without this change?
> 
> strcasecmp()
> http://www.opengroup.org/onlinepubs/000095399/functions/strcasecmp.html
> 
> I agree that this change could affect other platforms and they've
> gotten along fine without it so far.  I'm surprised no others have
> needed it.  Would it be better wrapped in a #ifdef?
> 
> Thanks,
> Tarmigan
> 

What version of qnx is this on. <strings.h> is now brought in by <string.h> and the lock() / unlock() prototypes have been removed from <unistd.h> AS OF 6.4.1 (the current release).

There's a package for git-4.3.20 here that also has a work around for the SA_RESTART issue.

ftp://ftp.netbsd.org/pub/pkgsrc/packages/QNX/i386/6.4.1_head_20090724/All
-seanb
Tarmigan· Dec 17, 2009, 01:03 UTC · re: Sean Boudreau · lore

Re: Git on QNX

On Wed, Dec 16, 2009 at 2:38 PM, Sean Boudreau <seanb@qnx.com> wrote:
> What version of qnx is this on.  <strings.h> is
> now brought in by <string.h> and the lock() /
> unlock() prototypes have been removed from <unistd.h>
> AS OF 6.4.1 (the current release).
Ahh, that's nice.  At a client's request, I have been working on QNX 6.3.2.

I just installed 6.4.1 in another VM, and it's a bit different. The common way to handle binary packages (iconv and perl) seems to have changed to pkg_add so the PATHs I had set might not make sense anymore.

Also the weird failing test at t0000.42 seems to be fixed.  Funny.

As I might be the only person to run git on 6.3.2 instead of a more modern QNX, it might make sense for me to just submit the minimum patches needed for QNX 6.4.1 and then carry the strings.h, getpagesize, and lock() changes for 6.3.2 on my own.

> There's a package for git-4.3.20 here that also has a work around
> for the SA_RESTART issue.

I think that might be a different program that also used to be named "git". I think it has now been renamed gnuit.

Thanks, Tarmigan

Sean Boudreau· Dec 17, 2009, 01:37 UTC · re: Tarmigan · lore

Re: Git on QNX

On Wed, Dec 16, 2009 at 05:03:16PM -0800, Tarmigan wrote:
Show 19 quoted lines
> On Wed, Dec 16, 2009 at 2:38 PM, Sean Boudreau <seanb@qnx.com> wrote:
> > What version of qnx is this on.  <strings.h> is
> > now brought in by <string.h> and the lock() /
> > unlock() prototypes have been removed from <unistd.h>
> > AS OF 6.4.1 (the current release).
> 
> Ahh, that's nice.  At a client's request, I have been working on QNX 6.3.2.
> 
> I just installed 6.4.1 in another VM, and it's a bit different.  The
> common way to handle binary packages (iconv and perl) seems to have
> changed to pkg_add so the PATHs I had set might not make sense
> anymore.
> 
> Also the weird failing test at t0000.42 seems to be fixed.  Funny.
> 
> As I might be the only person to run git on 6.3.2 instead of a more
> modern QNX, it might make sense for me to just submit the minimum
> patches needed for QNX 6.4.1 and then carry the strings.h,
> getpagesize, and lock() changes for 6.3.2 on my own.
That's why I spoke up :)
Show 6 quoted lines
> 
> > There's a package for git-4.3.20 here that also has a work around
> > for the SA_RESTART issue.
> 
> I think that might be a different program that also used to be named
> "git".  I think it has now been renamed gnuit.
You're probably right, try this one:
ftp://ftp.netbsd.org/pub/pkgsrc/packages/QNX/i386/6.4.1_head_20090724/All/scmgit-base-1.6.2.5.tgz
-seanb 

← back to recent threads