{"thread":{"id":"7813","subject":"Bug?: import-tars misbehaves on Subversion tarballs","startedAt":"2007-04-24T07:39:07Z","lastAt":"2007-04-24T16:17:49Z","messageCount":8,"participants":["Karl Hasselström","Uwe Kleine-König","Michael Loeffler","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"40299","messageId":"20070424073907.GA22121@diana.vm.bytemark.co.uk","threadId":"7813","inReplyTo":null,"subject":"Bug?: import-tars misbehaves on Subversion tarballs","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-04-24T07:39:07Z","receivedAt":"2007-04-24T07:39:07Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"import-tars behaves very oddly when I try to import the Subversion\ntarballs. (For example,\nhttp://subversion.tigris.org/downloads/subversion-1.4.3.tar.bz2\ntriggers this problem.) It creates two toplevel directories,\nsubversion-1.4.3 and subversion-1.4.3subversion. The former seems to\ncontain at least almost all files; the latter has only a handful of\nfiles, all with very long names.\n\nWhen I unpack it with GNU tar, I get all the files under a single\n\"subversion-1.4.3\" directory, as expected.\n\nCould it simply be that import-tars can't handle long filenames\nsomehow? (This is pure speculation, since I know absolutely nothing\nabout the tar format.)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"40311","messageId":"3BF34FC9-BE89-4A5B-9AC6-57F61C464395@zvpunry.de","threadId":"7813","inReplyTo":"20070424073907.GA22121@diana.vm.bytemark.co.uk","subject":"Re: Bug?: import-tars misbehaves on Subversion tarballs","fromName":"Michael Loeffler","fromEmail":"zvpunry@zvpunry.de","sentAt":"2007-04-24T08:25:40Z","receivedAt":"2007-04-24T08:25:40Z","isPatch":false,"sender":{"key":"zvpunry@zvpunry.de","avatar":null},"body":"Hi,\n\nAm 24.04.2007 um 09:39 schrieb Karl Hasselström:\n\n> import-tars behaves very oddly when I try to import the Subversion\n> tarballs. (For example,\n> http://subversion.tigris.org/downloads/subversion-1.4.3.tar.bz2\n> triggers this problem.) It creates two toplevel directories,\n> subversion-1.4.3 and subversion-1.4.3subversion. The former seems to\n> contain at least almost all files; the latter has only a handful of\n> files, all with very long names.\nI looked at this tarball with midnight commander (under MacOS X) and  \ni saw 2 directories, subversion/ and subversion-1.4.3/. Then i looked  \nat it with GNU tar (1.14) and saw only subversion-1.4.3/.\n\n\n> Could it simply be that import-tars can't handle long filenames\n> somehow? (This is pure speculation, since I know absolutely nothing\n> about the tar format.)\nI don't know, but mc does the same thing. I'll look at it later (i  \nhave more time at 18:00 +0200).\n\n\nbye"},{"id":"40308","messageId":"20070424084037.GA8906@informatik.uni-freiburg.de","threadId":"7813","inReplyTo":"20070424073907.GA22121@diana.vm.bytemark.co.uk","subject":"Re: Bug?: import-tars misbehaves on Subversion tarballs","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-04-24T08:40:37Z","receivedAt":"2007-04-24T08:40:37Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Karl,\n\nKarl Hasselström wrote:\n> import-tars behaves very oddly when I try to import the Subversion\n> tarballs. (For example,\n> http://subversion.tigris.org/downloads/subversion-1.4.3.tar.bz2\n> triggers this problem.) It creates two toplevel directories,\n> subversion-1.4.3 and subversion-1.4.3subversion. The former seems to\n> contain at least almost all files; the latter has only a handful of\n> files, all with very long names.\n> \n> When I unpack it with GNU tar, I get all the files under a single\n> \"subversion-1.4.3\" directory, as expected.\n> \n> Could it simply be that import-tars can't handle long filenames\n> somehow? (This is pure speculation, since I know absolutely nothing\n> about the tar format.)\nI don't know much, but there are two locations that make up the name\n(i.e. prefix + name).  Can you try the following patch:\n\n---\n contrib/fast-import/import-tars.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl\nindex 5585a8b..5f3f742 100755\n--- a/contrib/fast-import/import-tars.perl\n+++ b/contrib/fast-import/import-tars.perl\n@@ -64,7 +64,7 @@ foreach my $tar_file (@ARGV)\n \t\t}\n \t\tprint FI \"\\n\";\n \n-\t\tmy $path = \"$prefix$name\";\n+\t\tmy $path = \"$prefix/$name\";\n \t\t$files{$path} = [$next_mark++, $mode];\n \n \t\t$commit_time = $mtime if $mtime > $commit_time;\n-- \n1.5.1.1.190.g74474\n\nIf it works, we still need a commit log ...\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=5%2B7\n"},{"id":"40315","messageId":"20070424100924.GB23811@diana.vm.bytemark.co.uk","threadId":"7813","inReplyTo":"20070424084037.GA8906@informatik.uni-freiburg.de","subject":"Re: Bug?: import-tars misbehaves on Subversion tarballs","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-04-24T10:09:24Z","receivedAt":"2007-04-24T10:09:24Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-04-24 10:40:37 +0200, Uwe Kleine-König wrote:\n\n> I don't know much, but there are two locations that make up the name\n> (i.e. prefix + name). Can you try the following patch:\n\nNo, it still breaks, but in a new and interesting way: Now I _only_\nget the files with long pathnames!\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"40321","messageId":"20070424115104.GA14986@informatik.uni-freiburg.de","threadId":"7813","inReplyTo":"20070424100924.GB23811@diana.vm.bytemark.co.uk","subject":"[PATCH] [import-tars] fix importing of subversion tars","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-04-24T11:51:04Z","receivedAt":"2007-04-24T11:51:04Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"add a / between the prefix and name fields of the tar archive if prefix\nis non-empty.\n\nSigned-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>\n---\n\n> No, it still breaks, but in a new and interesting way: Now I _only_\n> get the files with long pathnames!\n\nI don't know exactly how standard-conformant it is not to include a\ntrailing / after prefix, but the subversion tar does it. \n\nI checked for a description of the tar format, the best thing I could\nfind is[1]:\n\n\tOn USTAR format archives, the value of the prefix field, if\n\tnon-null, is prefixed to the name field to allow names longer\n\tthen 100 characters\n\nBut it's not specifying if an additional / is needed.\n\n\nWith this patch I get all the filenames right.\n\nNow the common prefix subversion-1.4.3 is stripped, but probably that's\na feature.\n\nBTW I shortly tested a tar that had an entry with prefix ending in / and\nfast-import did the right thing.  So something more complicated as:\n\n\tif ($prefix and $prefix[-1] eq \"/\") ...\n\nshould not be needed.\n\nBest regards\nUwe\n\n[1] http://www.mkssoftware.com/docs/man4/tar.4.asp\n\n contrib/fast-import/import-tars.perl |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl\nindex 5585a8b..1842146 100755\n--- a/contrib/fast-import/import-tars.perl\n+++ b/contrib/fast-import/import-tars.perl\n@@ -64,7 +64,12 @@ foreach my $tar_file (@ARGV)\n \t\t}\n \t\tprint FI \"\\n\";\n \n-\t\tmy $path = \"$prefix$name\";\n+\t\tmy $path;\n+\t\tif ($prefix) {\n+\t\t\t$path = \"$prefix/$name\";\n+\t\t} else {\n+\t\t\t$path = \"$name\";\n+\t\t}\n \t\t$files{$path} = [$next_mark++, $mode];\n \n \t\t$commit_time = $mtime if $mtime > $commit_time;\n-- \n1.5.2.rc0.16.g0f57d\n\n-- \nUwe Kleine-König\n\nexit vi, lesson IV:\nZ Z\n\nNB: may write current file\n"},{"id":"40322","messageId":"20070424123457.GA27766@diana.vm.bytemark.co.uk","threadId":"7813","inReplyTo":"20070424115104.GA14986@informatik.uni-freiburg.de","subject":"Re: [PATCH] [import-tars] fix importing of subversion tars","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-04-24T12:34:57Z","receivedAt":"2007-04-24T12:34:57Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-04-24 13:51:04 +0200, Uwe Kleine-König wrote:\n\n> add a / between the prefix and name fields of the tar archive if\n> prefix is non-empty.\n>\n> Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>\n\nAcked-by: Karl Hasselström <kha@treskal.com>\n\nThis solves my problem with the Subversion tarballs. Thanks!\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"40324","messageId":"20070424124412.GA28009@diana.vm.bytemark.co.uk","threadId":"7813","inReplyTo":"20070424115104.GA14986@informatik.uni-freiburg.de","subject":"Re: [PATCH] [import-tars] fix importing of subversion tars","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-04-24T12:44:12Z","receivedAt":"2007-04-24T12:44:12Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-04-24 13:51:04 +0200, Uwe Kleine-König wrote:\n\n> Now the common prefix subversion-1.4.3 is stripped, but probably\n> that's a feature.\n\nYes, there's code in import-tars that strips the topmost directory if\nand only if all paths in the tar are contained in it.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"40342","messageId":"20070424161749.GR17480@spearce.org","threadId":"7813","inReplyTo":"20070424115104.GA14986@informatik.uni-freiburg.de","subject":"Re: [PATCH] [import-tars] fix importing of subversion tars","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-24T16:17:49Z","receivedAt":"2007-04-24T16:17:49Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Uwe Kleine-K??nig <ukleinek@informatik.uni-freiburg.de> wrote:\n> add a / between the prefix and name fields of the tar archive if prefix\n> is non-empty.\n\nThanks, this is in my fastimport tree now.\n\n-- \nShawn.\n"}]}