Re: [PULL svn-fe] fast-import 'ls', line-buffer changes

Subsystems: the rest

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PULL svn-fe] fast-import 'ls', line-buffer changes

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:40

Jonathan Nieder [off-list ref] writes:
Hi Junio,

Please pull

  git://repo.or.cz/git/jrn.git svn-fe

to get the following changes on top of master + the old jn/svn-fe.

These are patches from the threads $gmane/164146 and $gmane/167536,
providing some plumbing to support incremental import in svn-fe.  They
are probably far from perfect but they seem to work okay so far, and
I'd be fine with putting any fixes on top of them.

Thoughts, suggestions, etc welcome as always.
As I was not involved in the thread heavily, I'll just pull this into
'master', trusting that the responsible parties will be able to handle
potential fallouts to fast-import users, if any, promptly.

... Yikes.  I said the above and then my build for "master" breaks with

  fast-import.c: In function 'dereference':
  fast-import.c:2885: error: pointer of type 'void *' used in arithmetic
  fast-import.c:2890: error: pointer of type 'void *' used in arithmetic

forcing me to redo all three integration branches.  What an un-fun.

Not pulled.

 fast-import.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 6c37b84..cfddb7a 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2882,12 +2882,12 @@ static struct object_entry *dereference(struct object_entry *oe,
 	switch (oe->type) {
 	case OBJ_TAG:
 		if (size < 40 + strlen("object ") ||
-		    get_sha1_hex(buf + strlen("object "), sha1))
+		    get_sha1_hex((char *)buf + strlen("object "), sha1))
 			die("Invalid SHA1 in tag: %s", command_buf.buf);
 		break;
 	case OBJ_COMMIT:
 		if (size < 40 + strlen("tree ") ||
-		    get_sha1_hex(buf + strlen("tree "), sha1))
+		    get_sha1_hex((char *)buf + strlen("tree "), sha1))
 			die("Invalid SHA1 in commit: %s", command_buf.buf);
 	}
 

[PATCH svn-fe] fast-import: make code "-Wpointer-arith" clean

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:41

The dereference() function to peel a tree-ish and find the underlying
tree expects arithmetic to (void *) to work on byte addresses.  We
should be reading the text of objects through a char * anyway.

Noticed-by: Junio C Hamano [off-list ref]
Signed-off-by: Jonathan Nieder <redacted>
---
Junio C Hamano wrote:
... Yikes.  I said the above and then my build for "master" breaks with

  fast-import.c: In function 'dereference':
  fast-import.c:2885: error: pointer of type 'void *' used in arithmetic
  fast-import.c:2890: error: pointer of type 'void *' used in arithmetic
This should fix it, I suppose?  A

	-std=c99 -O3 -Wall -W
	-Wno-sign-compare
	-Wno-unused-parameter
	-Wno-missing-field-initializers
	-Wno-empty-body
	-Wno-pointer-to-int-cast
	-Wno-type-limits
	-Wno-unused-but-set-variable
	-Wold-style-definition -Wpointer-arith -Wvla
	-Wdeclaration-after-statement -Werror

build passes, except for an "unsigned long expire" in builtin-reflog
that confuses this copy of gcc.

 fast-import.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 6c37b84..e1268b8 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2848,7 +2848,7 @@ static struct object_entry *dereference(struct object_entry *oe,
 					unsigned char sha1[20])
 {
 	unsigned long size;
-	void *buf = NULL;
+	char *buf = NULL;
 	if (!oe) {
 		enum object_type type = sha1_object_info(sha1, NULL);
 		if (type < 0)
-- 
1.7.4.1

Re: [PATCH svn-fe] fast-import: make code "-Wpointer-arith" clean

From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:50:41

Heya,

On Mon, Feb 28, 2011 at 22:32, Jonathan Nieder [off-list ref] wrote:
This should fix it, I suppose?  A

       -std=c99 -O3 -Wall -W
       -Wno-sign-compare
       -Wno-unused-parameter
       -Wno-missing-field-initializers
       -Wno-empty-body
       -Wno-pointer-to-int-cast
       -Wno-type-limits
       -Wno-unused-but-set-variable
       -Wold-style-definition -Wpointer-arith -Wvla
       -Wdeclaration-after-statement -Werror

build passes, except for an "unsigned long expire" in builtin-reflog
that confuses this copy of gcc.
How come this slipped by unnoticed (except by Junio)? Is the default
Makefile not strict enough?

-- 
Cheers,

Sverre Rabbelier

Re: [PATCH svn-fe] fast-import: make code "-Wpointer-arith" clean

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:41

Jonathan Nieder wrote:
This should fix it, I suppose?
Pushed out.  Thanks again.

Re: [PATCH svn-fe] fast-import: make code "-Wpointer-arith" clean

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:41

Jonathan Nieder [off-list ref] writes:
Jonathan Nieder wrote:
quoted
This should fix it, I suppose?
Pushed out.  Thanks again.
Thanks, pulled.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help