threads / patch / 520

patchgit-tar-tree: Lift path length limit

Subject: [PATCH] git-tar-tree: Lift path length limit

## tl;dr

4 messages between May 7, 2005 and May 7, 2005. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Rene Scharfe· May 7, 2005, 00:25 UTC · lore

Last minute patch? This lifts the limits from path length and link path length that are in git-tar-tree.

Have a nice vacation!
Rene
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

--- commit 2d7b8f2afc47c753aaab4bf48587fdea730b0db3 tree 378fae86e43460c1c53feccbde3573ced26818f6 parent a02ebff6127c5fc981668fb570f0a80f2b7657ca author Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115320521 +0200 committer Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115320521 +0200

Show changes to diff +6 −8
Index: tar-tree.c
===================================================================
--- 8477488c1965186c98b59ad0da04d221aff3c9a1/tar-tree.c  (mode:100644 sha1:a09cb416595094e493a52dd7f45d943c81c0310a)
+++ 378fae86e43460c1c53feccbde3573ced26818f6/tar-tree.c  (mode:100644 sha1:0fb6514c27a0f0edc2fc6e9850c361c8a58c0a9f)
@@ -212,7 +212,7 @@
                                   const char *path, unsigned int namelen,
                                   void *content, unsigned int contentsize)
 {
-	char *p;
+	char *buffer, *p;
 	unsigned int pathlen, size, linkpathlen = 0;
 
 	size = pathlen = extended_header_len("path", namelen);
@@ -220,18 +220,18 @@
 		linkpathlen = extended_header_len("linkpath", contentsize);
 		size += linkpathlen;
 	}
-	if (size > RECORDSIZE)
-		die("tar-tree: extended header too big, wtf?");
 	write_header(NULL, TYPEFLAG_EXT_HEADER, NULL, NULL, headerfilename,
 	             0100600, NULL, size);
 
-	p = get_record();
+	buffer = p = malloc(size);
+	if (!buffer)
+		die("git-tar-tree: %s", strerror(errno));
 	append_extended_header_prefix(&p, pathlen, "path");
 	append_path(&p, is_dir, basepath, prefix, path);
 	append_char(&p, '\n');
 	if (flags & EXT_HEADER_LINKPATH)
 		append_extended_header(&p, "linkpath", content, contentsize);
-	write_if_needed();
+	write_blocked(buffer, size);
 }
 
 static void write_global_extended_header(const char *sha1)
@@ -269,9 +269,7 @@
 	}
 
 	namelen = path_len(S_ISDIR(mode), basepath, prefix, path);
-	if (namelen > 500)
-		die("tar-tree: name too log of object %s\n", sha1_to_hex(sha1));
-	else if (namelen > 100)
+	if (namelen > 100)
 		ext_header |= EXT_HEADER_PATH;
 	if (typeflag == TYPEFLAG_LNK && size > 100)
 		ext_header |= EXT_HEADER_LINKPATH;
Rene Scharfe· May 7, 2005, 00:57 UTC · re: Rene Scharfe · lore

Re: [PATCH] git-tar-tree: Lift path length limit

On Sat, May 07, 2005 at 02:25:27AM +0200, Rene Scharfe wrote:
> Last minute patch?
This leaks memory.  D'oh!

Petr, would you add the (hopefully) fixed version below to your tree now that Linus is on vacation? (Patch applies to tip of GIT tree.)

Thanks, Rene

Lift path length limits from git-tar-tree.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

--- commit d36797f64ee0431e6a73aa1c77a7fe7c18b6ce9f tree ab8e6967a08ac343b69b527f663e6a9722fcea08 parent bf60144c0ab50e88c0086a90c5cb35b81613ad14 author Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115322098 +0200 committer Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115322098 +0200

Show changes to diff +7 −8
Index: tar-tree.c
===================================================================
--- 8ef25a2788d6c225641a3040622b82c364f987b8/tar-tree.c  (mode:100644 sha1:9d9bd7be98502f64e4a643ef0973182f3483251e)
+++ ab8e6967a08ac343b69b527f663e6a9722fcea08/tar-tree.c  (mode:100644 sha1:8b0d75bd2cf12a531aee3d51e59a8ac8102ba6be)
@@ -212,7 +212,7 @@
                                   const char *path, unsigned int namelen,
                                   void *content, unsigned int contentsize)
 {
-	char *p;
+	char *buffer, *p;
 	unsigned int pathlen, size, linkpathlen = 0;
 
 	size = pathlen = extended_header_len("path", namelen);
@@ -220,18 +220,19 @@
 		linkpathlen = extended_header_len("linkpath", contentsize);
 		size += linkpathlen;
 	}
-	if (size > RECORDSIZE)
-		die("tar-tree: extended header too big, wtf?");
 	write_header(NULL, TYPEFLAG_EXT_HEADER, NULL, NULL, headerfilename,
 	             0100600, NULL, size);
 
-	p = get_record();
+	buffer = p = malloc(size);
+	if (!buffer)
+		die("git-tar-tree: %s", strerror(errno));
 	append_extended_header_prefix(&p, pathlen, "path");
 	append_path(&p, is_dir, basepath, prefix, path);
 	append_char(&p, '\n');
 	if (flags & EXT_HEADER_LINKPATH)
 		append_extended_header(&p, "linkpath", content, contentsize);
-	write_if_needed();
+	write_blocked(buffer, size);
+	free(buffer);
 }
 
 static void write_global_extended_header(const char *sha1)
@@ -269,9 +270,7 @@
 	}
 
 	namelen = path_len(S_ISDIR(mode), basepath, prefix, path);
-	if (namelen > 500)
-		die("tar-tree: name too log of object %s\n", sha1_to_hex(sha1));
-	else if (namelen > 100)
+	if (namelen > 100)
 		ext_header |= EXT_HEADER_PATH;
 	if (typeflag == TYPEFLAG_LNK && size > 100)
 		ext_header |= EXT_HEADER_LINKPATH;
Petr Baudis· May 7, 2005, 12:09 UTC · re: Rene Scharfe · lore

Re: [PATCH] git-tar-tree: Lift path length limit

Dear diary, on Sat, May 07, 2005 at 02:57:06AM CEST, I got a letter where Rene Scharfe <rene.scharfe@lsrfire.ath.cx> told me that...

Show 7 quoted lines
> On Sat, May 07, 2005 at 02:25:27AM +0200, Rene Scharfe wrote:
> > Last minute patch?
> 
> This leaks memory.  D'oh!
> 
> Petr, would you add the (hopefully) fixed version below to your tree now
> that Linus is on vacation?  (Patch applies to tip of GIT tree.)

It appears to me that the patch currently in the git tree is this (correct) one?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Junio C Hamano· May 7, 2005, 18:42 UTC · re: Petr Baudis · lore

Re: [PATCH] git-tar-tree: Lift path length limit

>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:

PB> Dear diary, on Sat, May 07, 2005 at 02:57:06AM CEST, I got a letter PB> where Rene Scharfe <rene.scharfe@lsrfire.ath.cx> told me that...

Show 7 quoted lines
>> On Sat, May 07, 2005 at 02:25:27AM +0200, Rene Scharfe wrote:
>> > Last minute patch?
>> 
>> This leaks memory.  D'oh!
>> 
>> Petr, would you add the (hopefully) fixed version below to your tree now
>> that Linus is on vacation?  (Patch applies to tip of GIT tree.)

PB> It appears to me that the patch currently in the git tree is this PB> (correct) one?

Yes it was merged before Linus left the machine last night.

← back to recent threads