threads / patch / 265

patchmake file merging respect permissions

Subject: [PATCH] make file merging respect permissions

## tl;dr

14 messages between Apr 23, 2005 and Apr 24, 2005. Diffs are folded; open one to read it.

replies: 13people: 4as markdown or json

James Bottomley· Apr 23, 2005, 18:22 UTC · lore

I noticed when playing about with merging that executable scripts lose their permissions after a merge. This was because unpack-file just unpacks to whatever the current umask is.

I also noticed that the merge-one-file-script thinks that if the file has been removed in both branches, then it should simply be removed. This isn't correct. The file could have been renamed to something different in both branches, in which case we have an unflagged rename conflict.

The attached fixes both issues
James
Show changes to 2 files +51 −9

git-merge-one-file-script, merge-cache.c

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -20,23 +20,47 @@ mkdir -p "$dir"
 
 case "${1:-.}${2:-.}${3:-.}" in
 #
-# deleted in both, or deleted in one and unchanged in the other
+# deleted in both
+#
+"$1..")
+	echo "ERROR: $4 is removed in both branches"
+	echo "ERROR: This is a potential rename conflict"
+	exit 1;;
+#
+# deleted in one and unchanged in the other
 #
 "$1.." | "$1.$1" | "$1$1.")
 	rm -f -- "$4"
+	echo "Removing $4"
 	update-cache --remove -- "$4"
 	exit 0
 	;;
 
 #
-# added in one, or added identically in both
+# added in one
 #
-".$2." | "..$3" | ".$2$2")
-	mv $(unpack-file "${2:-$3}") $4
+".$2." | "..$3" )
+	echo "Adding $4 with perm $6$7"
+	mv $(unpack-file "$2$3") $4
+	chmod "$6$7" $4
 	update-cache --add -- $4
 	exit 0
 	;;
-
+#
+# Added in both (check for same permissions)
+#
+".$2$2")
+	if [ "$6" != "$7" ]; then
+		echo "ERROR:"
+		echo "ERROR: File $4 added in both branches, permissions conflict $6->$7"
+		echo "ERROR:"
+		exit 1
+	fi
+	echo "Adding $4 with perm $6"
+	mv $(unpack-file "$2") $4
+	chmod "$6" $4
+	update-cache --add -- $4
+	exit 0;;
 #
 # Modified in both, but differently ;(
 #
@@ -46,12 +70,21 @@ case "${1:-.}${2:-.}${3:-.}" in
 	src1=$(unpack-file $2)
 	src2=$(unpack-file $3)
 	merge "$src2" "$orig" "$src1"
-	if [ $? -ne 0 ]; then
-		echo Leaving conflict merge in $src2
+	ret=$?
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: Permissions $5->$6->$7" don't match merging $src2"
+		if [ $ret -ne 0 ]; then
+			echo "ERROR: Leaving conflict merge in $src2"
+		fi
+		exit 1
+	fi
+	chmod -- "$6" "$src2"
+	if [ $ -ne 0 ]; then
+		echo "ERROR: Leaving conflict merge in $src2"
 		exit 1
 	fi
-	cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
+	cp -- "$src2" "$4" && chmod -- "$6" "$4" &&  update-cache --add -- "$4" && exit 0
 	;;
 
 *)
--- a/merge-cache.c
+++ b/merge-cache.c
@@ -4,7 +4,7 @@
 #include "cache.h"
 
 static const char *pgm = NULL;
-static const char *arguments[5];
+static const char *arguments[8];
 
 static void run_program(void)
 {
@@ -18,6 +18,9 @@ static void run_program(void)
 			    arguments[2],
 			    arguments[3],
 			    arguments[4],
+			    arguments[5],
+			    arguments[6],
+			    arguments[7],
 			    NULL);
 		die("unable to execute '%s'", pgm);
 	}
@@ -36,9 +39,13 @@ static int merge_entry(int pos, const ch
 	arguments[2] = "";
 	arguments[3] = "";
 	arguments[4] = path;
+	arguments[5] = "";
+	arguments[6] = "";
+	arguments[7] = "";
 	found = 0;
 	do {
 		static char hexbuf[4][60];
+		static char ownbuf[4][60];
 		struct cache_entry *ce = active_cache[pos];
 		int stage = ce_stage(ce);
 
@@ -46,7 +53,9 @@ static int merge_entry(int pos, const ch
 			break;
 		found++;
 		strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
+		sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
 		arguments[stage] = hexbuf[stage];
+		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < active_nr);
 	if (!found)
 		die("merge-cache: %s not in the cache", path);
Linus Torvalds· Apr 23, 2005, 20:17 UTC · re: James Bottomley · lore

Re: [PATCH] make file merging respect permissions

On Sat, 23 Apr 2005, James Bottomley wrote:
>
> The attached fixes both issues

The attached patch was seriously corrupt. Did you edit it by hand? The second chunk of the git-merge-one-file-script patch claims to have 12 source lines, but only has 11, causing patch no end of confusion.

I fixed up the line counts by hand, and the end result looked almost sane, but when looking closer, I noticed the

	+       if [ $ -ne 0 ]; then
	+               echo "ERROR: Leaving conflict merge in $src2"
	                exit 1

which just can't be right either ("$" never equals 0, so the above will always report an error), so I assume that whatever editing you did was really quite corrupt. Yeah, yeah, you obviously meant "$?", but the fact is, your patch is bogus, and I don't trust it. Can you re-send a valid one (and sign off on it).

		Linus
James Bottomley· Apr 23, 2005, 20:37 UTC · re: Linus Torvalds · lore

Re: [PATCH] make file merging respect permissions

On Sat, 2005-04-23 at 13:17 -0700, Linus Torvalds wrote:
> The attached patch was seriously corrupt. Did you edit it by hand? The 
> second chunk of the git-merge-one-file-script patch claims to have 12 
> source lines, but only has 11, causing patch no end of confusion.

OK ... yes I admit it ... the shame ... I noticed a problem after I generated it and then edited it in source

Show 12 quoted lines
> I fixed up the line counts by hand, and the end result looked almost sane,
> but when looking closer, I noticed the
> 
> 	+       if [ $ -ne 0 ]; then
> 	+               echo "ERROR: Leaving conflict merge in $src2"
> 	                exit 1
> 
> which just can't be right either ("$" never equals 0, so the above will 
> always report an error), so I assume that whatever editing you did was 
> really quite corrupt. Yeah, yeah, you obviously meant "$?", but the fact 
> is, your patch is bogus, and I don't trust it. Can you re-send a valid one 
> (and sign off on it).

Yes boss ... Just getting on a 'plane now. Should be able to send it out in an hour or so.

James
James Bottomley· Apr 23, 2005, 21:44 UTC · re: Linus Torvalds · lore

Re: [PATCH] make file merging respect permissions

On Sat, 2005-04-23 at 13:17 -0700, Linus Torvalds wrote:
> Yeah, yeah, you obviously meant "$?", but the fact 
> is, your patch is bogus, and I don't trust it. Can you re-send a valid
> one 
> (and sign off on it).]
OK, here it is  .. I have an excuse, honest ... and a note from my mum.
---
This patch fixes two problems
1) permissions aren't respected in the merge script (primarily because
they're never passed in to it in the first place).  Fix that and also
check for permission conflicts in the merge
2) the delete of a file in both branches may indeed be just that, but it
could also be the indicator of a rename conflict (file moved to
different locations in both branches), so error out and ask the
committer for guidance.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Show changes to 2 files +51 −9

git-merge-one-file-script, merge-cache.c

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -20,23 +20,47 @@ mkdir -p "$dir"
 
 case "${1:-.}${2:-.}${3:-.}" in
 #
-# deleted in both, or deleted in one and unchanged in the other
+# deleted in both
+#
+"$1..")
+	echo "ERROR: $4 is removed in both branches"
+	echo "ERROR: This is a potential rename conflict"
+	exit 1;;
+#
+# deleted in one and unchanged in the other
 #
 "$1.." | "$1.$1" | "$1$1.")
 	rm -f -- "$4"
+	echo "Removing $4"
 	update-cache --remove -- "$4"
 	exit 0
 	;;
 
 #
-# added in one, or added identically in both
+# added in one
 #
-".$2." | "..$3" | ".$2$2")
-	mv $(unpack-file "${2:-$3}") $4
+".$2." | "..$3" )
+	echo "Adding $4 with perm $6$7"
+	mv $(unpack-file "$2$3") $4
+	chmod "$6$7" $4
 	update-cache --add -- $4
 	exit 0
 	;;
-
+#
+# Added in both (check for same permissions)
+#
+".$2$2")
+	if [ "$6" != "$7" ]; then
+		echo "ERROR:"
+		echo "ERROR: File $4 added in both branches, permissions conflict $6->$7"
+		echo "ERROR:"
+		exit 1
+	fi
+	echo "Adding $4 with perm $6"
+	mv $(unpack-file "$2") $4
+	chmod "$6" $4
+	update-cache --add -- $4
+	exit 0;;
 #
 # Modified in both, but differently ;(
 #
@@ -46,12 +70,21 @@ case "${1:-.}${2:-.}${3:-.}" in
 	src1=$(unpack-file $2)
 	src2=$(unpack-file $3)
 	merge "$src2" "$orig" "$src1"
-	if [ $? -ne 0 ]; then
-		echo Leaving conflict merge in $src2
+	ret=$?
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: Permissions $5->$6->$7 don't match merging $src2"
+		if [ $ret -ne 0 ]; then
+			echo "ERROR: Leaving conflict merge in $src2"
+		fi
+		exit 1
+	fi
+	chmod -- "$6" "$src2"
+	if [ $ -ne 0 ]; then
+		echo "ERROR: Leaving conflict merge in $src2"
 		exit 1
 	fi
-	cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
+	cp -- "$src2" "$4" && chmod -- "$6" "$4" &&  update-cache --add -- "$4" && exit 0
 	;;
 
 *)
--- a/merge-cache.c
+++ b/merge-cache.c
@@ -4,7 +4,7 @@
 #include "cache.h"
 
 static const char *pgm = NULL;
-static const char *arguments[5];
+static const char *arguments[8];
 
 static void run_program(void)
 {
@@ -18,6 +18,9 @@ static void run_program(void)
 			    arguments[2],
 			    arguments[3],
 			    arguments[4],
+			    arguments[5],
+			    arguments[6],
+			    arguments[7],
 			    NULL);
 		die("unable to execute '%s'", pgm);
 	}
@@ -36,9 +39,13 @@ static int merge_entry(int pos, const ch
 	arguments[2] = "";
 	arguments[3] = "";
 	arguments[4] = path;
+	arguments[5] = "";
+	arguments[6] = "";
+	arguments[7] = "";
 	found = 0;
 	do {
 		static char hexbuf[4][60];
+		static char ownbuf[4][60];
 		struct cache_entry *ce = active_cache[pos];
 		int stage = ce_stage(ce);
 
@@ -46,7 +53,9 @@ static int merge_entry(int pos, const ch
 			break;
 		found++;
 		strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
+		sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
 		arguments[stage] = hexbuf[stage];
+		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < active_nr);
 	if (!found)
 		die("merge-cache: %s not in the cache", path);
Petr Baudis· Apr 23, 2005, 23:02 UTC · re: James Bottomley · lore

Re: [PATCH] make file merging respect permissions

Dear diary, on Sat, Apr 23, 2005 at 11:44:40PM CEST, I got a letter where James Bottomley <James.Bottomley@SteelEye.com> told me that...

Show 18 quoted lines
> On Sat, 2005-04-23 at 13:17 -0700, Linus Torvalds wrote:
> > Yeah, yeah, you obviously meant "$?", but the fact 
> > is, your patch is bogus, and I don't trust it. Can you re-send a valid
> > one 
> > (and sign off on it).]
> 
> OK, here it is  .. I have an excuse, honest ... and a note from my mum.
> 
> +	ret=$?
> +	if [ "$6" != "$7" ]; then
> +		echo "ERROR: Permissions $5->$6->$7 don't match merging $src2"
> +		if [ $ret -ne 0 ]; then
> +			echo "ERROR: Leaving conflict merge in $src2"
> +		fi
> +		exit 1
> +	fi
> +	chmod -- "$6" "$src2"
> +	if [ $ -ne 0 ]; then
*cough*
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
James Bottomley· Apr 23, 2005, 23:09 UTC · re: Petr Baudis · lore

Re: [PATCH] make file merging respect permissions

On Sun, 2005-04-24 at 01:02 +0200, Petr Baudis wrote:
> > +	if [ $ -ne 0 ]; then
> 
> *cough*
You're kidding me?

Well ... it's correct in my repository ... I'll investigate my diff script

James
James Bottomley· Apr 23, 2005, 23:21 UTC · re: Petr Baudis · lore

Re: [PATCH] make file merging respect permissions

On Sun, 2005-04-24 at 01:02 +0200, Petr Baudis wrote:
> *cough*
OK, dirty file in the local tree, sorry.
This is the actual diff
---
1) permissions aren't respected in the merge script (primarily because
they're never passed in to it in the first place).  Fix that and also
check for permission conflicts in the merge
2) the delete of a file in both branches may indeed be just that, but it
could also be the indicator of a rename conflict (file moved to
different locations in both branches), so error out and ask the
committer for guidance.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Show changes to 2 files +49 −9

git-merge-one-file-script, merge-cache.c

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -20,23 +20,45 @@ mkdir -p "$dir"
 
 case "${1:-.}${2:-.}${3:-.}" in
 #
-# deleted in both, or deleted in one and unchanged in the other
+# deleted in both
+#
+"$1..")
+	echo "ERROR: $4 is removed in both branches"
+	echo "ERROR: This is a potential rename conflict"
+	exit 1;;
+#
+# deleted in one and unchanged in the other
 #
 "$1.." | "$1.$1" | "$1$1.")
 	rm -f -- "$4"
+	echo "Removing $4"
 	update-cache --remove -- "$4"
 	exit 0
 	;;
 
 #
-# added in one, or added identically in both
+# added in one
 #
-".$2." | "..$3" | ".$2$2")
-	mv $(unpack-file "${2:-$3}") $4
+".$2." | "..$3" )
+	echo "Adding $4 with perm $6$7"
+	mv $(unpack-file "$2$3") $4
+	chmod "$6$7" $4
 	update-cache --add -- $4
 	exit 0
 	;;
-
+#
+# Added in both (check for same permissions)
+#
+".$2$2")
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: File $4 added in both branches, permissions conflict $6->$7"
+		exit 1
+	fi
+	echo "Adding $4 with perm $6"
+	mv $(unpack-file "$2") $4
+	chmod "$6" $4
+	update-cache --add -- $4
+	exit 0;;
 #
 # Modified in both, but differently ;(
 #
@@ -46,12 +68,21 @@ case "${1:-.}${2:-.}${3:-.}" in
 	src1=$(unpack-file $2)
 	src2=$(unpack-file $3)
 	merge "$src2" "$orig" "$src1"
-	if [ $? -ne 0 ]; then
-		echo Leaving conflict merge in $src2
+	ret=$?
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: Permissions $5->$6->$7 don't match merging $src2"
+		if [ $ret -ne 0 ]; then
+			echo "ERROR: Leaving conflict merge in $src2"
+		fi
+		exit 1
+	fi
+	chmod -- "$6" "$src2"
+	if [ $ret -ne 0 ]; then
+		echo "ERROR: Leaving conflict merge in $src2"
 		exit 1
 	fi
-	cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
+	cp -- "$src2" "$4" && chmod -- "$6" "$4" &&  update-cache --add -- "$4" && exit 0
 	;;
 
 *)
--- a/merge-cache.c
+++ b/merge-cache.c
@@ -4,7 +4,7 @@
 #include "cache.h"
 
 static const char *pgm = NULL;
-static const char *arguments[5];
+static const char *arguments[8];
 
 static void run_program(void)
 {
@@ -18,6 +18,9 @@ static void run_program(void)
 			    arguments[2],
 			    arguments[3],
 			    arguments[4],
+			    arguments[5],
+			    arguments[6],
+			    arguments[7],
 			    NULL);
 		die("unable to execute '%s'", pgm);
 	}
@@ -36,9 +39,13 @@ static int merge_entry(int pos, const ch
 	arguments[2] = "";
 	arguments[3] = "";
 	arguments[4] = path;
+	arguments[5] = "";
+	arguments[6] = "";
+	arguments[7] = "";
 	found = 0;
 	do {
 		static char hexbuf[4][60];
+		static char ownbuf[4][60];
 		struct cache_entry *ce = active_cache[pos];
 		int stage = ce_stage(ce);
 
@@ -46,7 +53,9 @@ static int merge_entry(int pos, const ch
 			break;
 		found++;
 		strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
+		sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
 		arguments[stage] = hexbuf[stage];
+		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < active_nr);
 	if (!found)
 		die("merge-cache: %s not in the cache", path);
Linus Torvalds· Apr 24, 2005, 01:01 UTC · re: James Bottomley · lore

Re: [PATCH] make file merging respect permissions

On Sat, 23 Apr 2005, James Bottomley wrote:
> 
> This is the actual diff
This is _still_ corrupted. 

Are you editing your diffs by hand without understanding how the diffs work?

The second chunk of the "git-merge-one-file" diff _still_ claims to change twelve lines, and that diff _still_ only changes eleven lines. My "patch" isn't happy, and I can count the lines in the diff myself and verify that it's not patch that is wrong, it's your diff.

Please please _please_ don't edit diffs by hand if you don't know what you're doing. Generate the diff from a clean source instead. Or ask me to fix it up, I'm so used to editing diffs that I can do it in my sleep.

		Linus
James Bottomley· Apr 24, 2005, 04:42 UTC · re: Linus Torvalds · lore

Re: [PATCH] make file merging respect permissions

On Sat, 2005-04-23 at 18:01 -0700, Linus Torvalds wrote:
Show 9 quoted lines
> 
> On Sat, 23 Apr 2005, James Bottomley wrote:
> > 
> > This is the actual diff
> 
> This is _still_ corrupted. 
> 
> Are you editing your diffs by hand without understanding how the diffs 
> work?

Sort of: I'm taking a diff between my tree and yours but stripping out the extraneous pieces (which are whole file diffs, nothing in the actual diffs I send you).

Show 8 quoted lines
> The second chunk of the "git-merge-one-file" diff _still_ claims to change 
> twelve lines, and that diff _still_ only changes eleven lines. My "patch" 
> isn't happy, and I can count the lines in the diff myself and verify that 
> it's not patch that is wrong, it's your diff.
> 
> Please please _please_ don't edit diffs by hand if you don't know what 
> you're doing. Generate the diff from a clean source instead. Or ask me to 
> fix it up, I'm so used to editing diffs that I can do it in my sleep.

OK ... this is done by reapplying to the top of your git tree and then doing a show-diff. I've checked that it actually applies without rejections to a pristine git tree.

James
git-merge-one-file-script: b2adc5fc4583e6089f4b38a47e1a73caad183f20
Show changes to 2 files +49 −9

git-merge-one-file-script, merge-cache.c

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -20,23 +20,45 @@ mkdir -p "$dir"
 
 case "${1:-.}${2:-.}${3:-.}" in
 #
-# deleted in both, or deleted in one and unchanged in the other
+# deleted in both
+#
+"$1..")
+	echo "ERROR: $4 is removed in both branches"
+	echo "ERROR: This is a potential rename conflict"
+	exit 1;;
+#
+# deleted in one and unchanged in the other
 #
 "$1.." | "$1.$1" | "$1$1.")
 	rm -f -- "$4"
+	echo "Removing $4"
 	update-cache --remove -- "$4"
 	exit 0
 	;;
 
 #
-# added in one, or added identically in both
+# added in one
 #
-".$2." | "..$3" | ".$2$2")
-	mv $(unpack-file "${2:-$3}") $4
+".$2." | "..$3" )
+	echo "Adding $4 with perm $6$7"
+	mv $(unpack-file "$2$3") $4
+	chmod "$6$7" $4
 	update-cache --add -- $4
 	exit 0
 	;;
-
+#
+# Added in both (check for same permissions)
+#
+".$2$2")
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: File $4 added in both branches, permissions conflict $6->$7"
+		exit 1
+	fi
+	echo "Adding $4 with perm $6"
+	mv $(unpack-file "$2") $4
+	chmod "$6" $4
+	update-cache --add -- $4
+	exit 0;;
 #
 # Modified in both, but differently ;(
 #
@@ -46,11 +68,20 @@ case "${1:-.}${2:-.}${3:-.}" in
 	src1=$(unpack-file $2)
 	src2=$(unpack-file $3)
 	merge "$src2" "$orig" "$src1"
-	if [ $? -ne 0 ]; then
-		echo Leaving conflict merge in $src2
+	ret=$?
+	if [ "$6" != "$7" ]; then
+		echo "ERROR: Permissions $5->$6->$7 don't match merging $src2"
+		if [ $ret -ne 0 ]; then
+			echo "ERROR: Leaving conflict merge in $src2"
+		fi
+		exit 1
+	fi
+	chmod -- "$6" "$src2"
+	if [ $ret -ne 0 ]; then
+		echo "ERROR: Leaving conflict merge in $src2"
 		exit 1
 	fi
-	cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
+	cp -- "$src2" "$4" && chmod -- "$6" "$4" &&  update-cache --add -- "$4" && exit 0
 	;;
 
 *)
merge-cache.c: 68ac4ab2d926005a5a729017c1bcb70a30634bd8
--- a/merge-cache.c
+++ b/merge-cache.c
@@ -4,7 +4,7 @@
 #include "cache.h"
 
 static const char *pgm = NULL;
-static const char *arguments[5];
+static const char *arguments[8];
 
 static void run_program(void)
 {
@@ -18,6 +18,9 @@ static void run_program(void)
 			    arguments[2],
 			    arguments[3],
 			    arguments[4],
+			    arguments[5],
+			    arguments[6],
+			    arguments[7],
 			    NULL);
 		die("unable to execute '%s'", pgm);
 	}
@@ -36,9 +39,13 @@ static int merge_entry(int pos, const ch
 	arguments[2] = "";
 	arguments[3] = "";
 	arguments[4] = path;
+	arguments[5] = "";
+	arguments[6] = "";
+	arguments[7] = "";
 	found = 0;
 	do {
 		static char hexbuf[4][60];
+		static char ownbuf[4][60];
 		struct cache_entry *ce = active_cache[pos];
 		int stage = ce_stage(ce);
 
@@ -46,7 +53,9 @@ static int merge_entry(int pos, const ch
 			break;
 		found++;
 		strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
+		sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
 		arguments[stage] = hexbuf[stage];
+		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < active_nr);
 	if (!found)
 		die("merge-cache: %s not in the cache", path);
Linus Torvalds· Apr 24, 2005, 04:55 UTC · re: James Bottomley · lore

Re: [PATCH] make file merging respect permissions

On Sat, 23 Apr 2005, James Bottomley wrote:
> 
> OK ... this is done by reapplying to the top of your git tree and then
> doing a show-diff.  I've checked that it actually applies without
> rejections to a pristine git tree.

Well, I actually ended up editing the line numbers manually and already pushed out the previous one, so you might want to double-check that my current tree matches yours.

		Linus
James Bottomley· Apr 24, 2005, 05:03 UTC · re: Linus Torvalds · lore

Re: [PATCH] make file merging respect permissions

On Sat, 2005-04-23 at 21:55 -0700, Linus Torvalds wrote:
> Well, I actually ended up editing the line numbers manually and already 
> pushed out the previous one, so you might want to double-check that my 
> current tree matches yours.

Yes, the sha1 of my changed file and the one you merged match, so everything looks sane.

Sorry for the confusion,
James
Andreas Gal· Apr 24, 2005, 05:05 UTC · re: Linus Torvalds · lore

[PATH] fix segfault in fsck-cache

I somehow got some corrupted object files in my repository that zlib refuses to decompress. This patch makes sure we abort early before the memcpy a few lines downtream segfaults (due to total_out == 0).

Andreas
Signed-off-by: Andreas Gal <gal@uci.edu>

--- 66308ede85c2dad6b184fb74a7215b06a173d8f7/sha1_file.c +++ sha1_file.c

Show changes to diff +2 −0
@@ -155,6 +155,8 @@
 
 	inflateInit(&stream);
 	ret = inflate(&stream, 0);
+	if (ret != Z_OK)
+		return NULL;
 	if (sscanf(buffer, "%10s %lu", type, size) != 2)
 		return NULL;
 
Andreas Gal· Apr 24, 2005, 05:24 UTC · re: Andreas Gal · lore

Re: [PATH] fix segfault in fsck-cache

This isn't working right either, depending on your ZLIB version. Do not apply.

Andreas
On Sat, 23 Apr 2005, Andreas Gal wrote:
Show 26 quoted lines
> 
> I somehow got some corrupted object files in my repository that zlib 
> refuses to decompress. This patch makes sure we abort early before the 
> memcpy a few lines downtream segfaults (due to total_out == 0).
> 
> Andreas
> 
> Signed-off-by: Andreas Gal <gal@uci.edu>
> 
> --- 66308ede85c2dad6b184fb74a7215b06a173d8f7/sha1_file.c
> +++ sha1_file.c
> @@ -155,6 +155,8 @@
>  
>  	inflateInit(&stream);
>  	ret = inflate(&stream, 0);
> +	if (ret != Z_OK)
> +		return NULL;
>  	if (sscanf(buffer, "%10s %lu", type, size) != 2)
>  		return NULL;
>  
> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
James Bottomley· Apr 24, 2005, 12:46 UTC · re: Linus Torvalds · lore

Re: [PATCH] make file merging respect permissions

On Sat, 2005-04-23 at 21:55 -0700, Linus Torvalds wrote:
> Well, I actually ended up editing the line numbers manually and already 
> pushed out the previous one, so you might want to double-check that my 
> current tree matches yours.

Just to get closure on this, I went over all the parts of patch generation, and the culprit turns out to be emacs. Apparently its diff mode (which I never thought to investigate how to use) does these re- writes ... no idea why, but the problem goes away if I strip out the extraneous pieces in fundamental-mode. It's never given me this trouble before ... I think the diff I'm producing must be confusing it somehow.

James

← back to recent threads