Re: [PATCH] mv: prevent mismatched data when ignoring errors.

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

Re: [PATCH] mv: prevent mismatched data when ignoring errors.

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:17

"brian m. carlson" [off-list ref] writes:
quoted hunk
We shrink the source and destination arrays, but not the modes or
submodule_gitfile arrays, resulting in potentially mismatched data.  Shrink
all the arrays at the same time to prevent this.

Signed-off-by: brian m. carlson <redacted>
---
 builtin/mv.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/builtin/mv.c b/builtin/mv.c
index f99c91e..b20cd95 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 					memmove(destination + i,
 						destination + i + 1,
 						(argc - i) * sizeof(char *));
+					memmove(modes + i, modes + i + 1,
+						(argc - i) * sizeof(char *));
+					memmove(submodule_gitfile + i,
+						submodule_gitfile + i + 1,
+						(argc - i) * sizeof(char *));
 					i--;
 				}
 			} else
Thanks.  Neither this nor John's seems to describe the user-visible
way to trigger the symptom.  Can we have tests for them?

Re: [PATCH] mv: prevent mismatched data when ignoring errors.

From: brian m. carlson <hidden>
Date: 2016-06-15 23:00:18

On Tue, Mar 11, 2014 at 02:45:59PM -0700, Junio C Hamano wrote:
Thanks.  Neither this nor John's seems to describe the user-visible
way to trigger the symptom.  Can we have tests for them?
I'll try to get to writing some test today or tomorrow.  I just noticed
the bugginess by looking at the code, so I'll need to actually spend
time reproducing the problem.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help