Skip to contentSkip to conversation

Support building on GNU/Hurd

PATCH New Thomas Schwinge 3 participants 11 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support building on GNU/Hurd

GNU/Hurd systems don't have strlcpy either.

---
 Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Makefile +4 -0
index 2fea115..8d9a01b 100644
@@ -458,6 +458,10 @@ ifeq ($(uname_S),AIX)
 	NO_STRLCPY = YesPlease
 	NEEDS_LIBICONV=YesPlease
 endif
+ifeq ($(uname_S),GNU)
+	# GNU/Hurd
+	NO_STRLCPY=YesPlease
+endif
 ifeq ($(uname_S),IRIX64)
 	NO_IPV6=YesPlease
 	NO_SETENV=YesPlease
Signature · 1 line
1.5.3.rc3.26.g6c58-dirty
#1 lore raw

PATCH 1/1 Don't rely on unspecified behavior

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in an SIGSEGV.

---
 builtin-add.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-add.c +1 -1
index 5e6748f..c13c738 100644
@@ -74,7 +74,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
 	path = git_path("info/exclude");
 	if (!access(path, R_OK))
 		add_excludes_from_file(dir, path);
-	if (!access(excludes_file, R_OK))
+	if (excludes_file != NULL && !access(excludes_file, R_OK))
 		add_excludes_from_file(dir, excludes_file);
 
 	/*
Signature · 1 line
1.5.3.rc3.26.g6c58-dirty
#2 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hello,

Quoted 2 lines

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in an SIGSEGV.

a friend of mine choked on this one when tried git for the second time (the first time "git-repack -a -d -f" screwed his repository after the initial checkout. This is fixed for a long time). Lucky me that he had his libusbdriver in LD_PRELOAD which could not handle the NULL argument. And I always thought libc would make the check before it does the system call or does GNU/hurts not use the gnu libc?

Thomas

#3 lore raw

PATCH 1/1 Don't rely on unspecified behavior

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in a SIGSEGV.

---
 builtin-add.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-add.c +1 -1
index 7345479..de5c108 100644
@@ -60,7 +60,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,
 		path = git_path("info/exclude");
 		if (!access(path, R_OK))
 			add_excludes_from_file(dir, path);
-		if (!access(excludes_file, R_OK))
+		if (excludes_file != NULL && !access(excludes_file, R_OK))
 			add_excludes_from_file(dir, excludes_file);
 	}
 
Signature · 1 line
1.5.3.rc3.26.g6c58-dirty
#4 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hi,

Quoted 5 lines · Thomas Schwinge

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in a SIGSEGV.

---

Isn't this the same patch as you sent before?

builtin-add.c static void fill_directory(struct dir_struct *dir, const char **pathspec, · line 63

Quoted 13 lines
 builtin-add.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-add.c +1 -1
index 7345479..de5c108 100644
@@ -60,7 +60,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,
 		path = git_path("info/exclude");
 		if (!access(path, R_OK))
 			add_excludes_from_file(dir, path);
-		if (!access(excludes_file, R_OK))
+		if (excludes_file != NULL && !access(excludes_file, R_OK))

We usually omit the "!= NULL"; see the other source code in git.git.

Ciao,
Dscho

#5 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hello Dscho,

Quoted 4 lines

Isn't this the same patch as you sent before?

Review static void fill_directory(struct dir_struct *dir, const char **pathspec,

Quoted 2 lines
(quoted diff) +0 -0
@@ -74,7 +74,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
@@ -60,7 +60,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,

~~~~~ ~~~~~ ~

The offset of the diff has changed. Not that git couldn't sort it out by itself. And the function had one or more parameters less.

Thomas

#6 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hi,

Quoted 8 lines · Thomas Glanzmann
Quoted 4 lines

Isn't this the same patch as you sent before?

Review static void fill_directory(struct dir_struct *dir, const char **pathspec,

Quoted 2 lines
(quoted diff) +0 -0
@@ -74,7 +74,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
@@ -60,7 +60,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,

~~~~~ ~~~~~ ~

The offset of the diff has changed. Not that git couldn't sort it out by itself. And the function had one or more parameters less.

Ah. Thanks for the explanation.

Ciao,
Dscho

#7 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hello,

Quoted 1 line

Ah. Thanks for the explanation.

I have operating system / real time systems exam on monday. I have to prepare myself in stating the obvious.

Thomas

#8 lore raw

Re: [PATCH] Don't rely on unspecified behavior

In reply to Johannes Schindelin

Hello!

Quoted 8 lines · Johannes Schindelin
Quoted 5 lines · Thomas Schwinge

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in a SIGSEGV.

---

Isn't this the same patch as you sent before?

As I wrote in <[email protected]>: ``I noticed that the patch I sent was prepared for an old version of the file. I'll send an updated patch that applies to the current revision.''

Quoted 3 lines

builtin-add.c static void fill_directory(struct dir_struct *dir, const char **pathspec, · line 63

Quoted 1 line
builtin-add.c +1 -0
+		if (excludes_file != NULL && !access(excludes_file, R_OK))

We usually omit the "!= NULL"; see the other source code in git.git.

Okay, so I should sent a thusly modified version to get it applied?

Regards,
Thomas

#9 lore raw

Re: [PATCH] Don't rely on unspecified behavior

Hi,

Quoted 5 lines · Thomas Schwinge
Quoted 4 lines · Johannes Schindelin
Quoted 3 lines · Thomas Schwinge

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in a SIGSEGV.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

Isn't this the same patch as you sent before?

As I wrote in <[email protected]>: ``I noticed that the patch I sent was prepared for an old version of the file. I'll send an updated patch that applies to the current revision.''

Ah.

Quoted 5 lines
Quoted 3 lines

builtin-add.c static void fill_directory(struct dir_struct *dir, const char **pathspec, · line 63

Quoted 1 line
builtin-add.c +1 -0
+		if (excludes_file != NULL && !access(excludes_file, R_OK))

We usually omit the "!= NULL"; see the other source code in git.git.

Okay, so I should sent a thusly modified version to get it applied?

I don't think that is necessary; a small change like this is usually fixed by Junio with --amend.

Ciao,
Dscho

#10 lore raw

Re: [PATCH] Don't rely on unspecified behavior

In reply to Thomas Glanzmann

Hello!

Quoted 9 lines · Thomas Glanzmann
Quoted 2 lines

Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in an SIGSEGV.

a friend of mine choked on this one when tried git for the second time (the first time "git-repack -a -d -f" screwed his repository after the initial checkout. This is fixed for a long time). Lucky me that he had his libusbdriver in LD_PRELOAD which could not handle the NULL argument. And I always thought libc would make the check before it does the system call or does GNU/hurts not use the gnu libc?

GNU/Hurd systems do (obviously ;-) use the GNU libc. The glibc maintainer Roland McGrath explicitly told me that ``access (NULL, m)'' shall not be caught as it is not specified and thus must not be invoked like this.

I noticed that the patch I sent was prepared for an old version of the file. I'll send an updated patch that applies to the current revision.

Regards,
Thomas