{"thread":{"id":"14014","subject":"[PATCH] Remove dependency on IO::String from Git.pm test","startedAt":"2008-06-18T13:37:04Z","lastAt":"2008-06-19T18:25:32Z","messageCount":10,"participants":["Michael Hendricks","Jakub Narebski","Rafael Garcia-Suarez","Johannes Schindelin","Junio C Hamano","Lea Wiemann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"80219","messageId":"1213796224-995-1-git-send-email-michael@ndrix.org","threadId":"14014","inReplyTo":null,"subject":"[PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Michael Hendricks","fromEmail":"michael@ndrix.org","sentAt":"2008-06-18T13:37:04Z","receivedAt":"2008-06-18T13:37:04Z","isPatch":true,"sender":{"key":"michael@ndrix.org","avatar":"https://gravatar.com/avatar/315311e6daa79f24e5648f9534420c24ec48eada42efd4110f1d17167ff44fa8?d=mp&s=160"},"body":"Instead of using IO::String to create an in-memory filehandle, use\nopen() with a scalar reference as the filename.  This feature has been\navailable since Perl 5.8.0 (which was released in 2002), so it should\nbe available pretty much everywhere by now.\n\nSigned-off-by: Michael Hendricks <michael@ndrix.org>\n---\n\nThis patch should apply on top of Junio's lw/perlish branch.\n\n t/t9700/test.pl |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 8318fec..e34c01e 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -9,7 +9,6 @@ use Test::More qw(no_plan);\n use Cwd;\n use File::Basename;\n use File::Temp;\n-use IO::String;\n \n BEGIN { use_ok('Git') }\n \n@@ -69,20 +68,21 @@ is($r->ident_person(\"Name\", \"email\", \"123 +0000\"), \"Name <email>\",\n \n # objects and hashes\n ok(our $file1hash = $r->command_oneline('rev-parse', \"HEAD:file1\"), \"(get file hash)\");\n-our $iostring = IO::String->new;\n+my $output;\n+open our $iostring, '>', \\$output;\n is($r->cat_blob($file1hash, $iostring), 15, \"cat_blob: size\");\n-is(${$iostring->string_ref}, \"changed file 1\\n\", \"cat_blob: data\");\n+is($output, \"changed file 1\\n\", \"cat_blob: data\");\n our $tmpfile = File::Temp->new();\n-print $tmpfile ${$iostring->string_ref};\n+print $tmpfile $output;\n is(Git::hash_object(\"blob\", $tmpfile), $file1hash, \"hash_object: roundtrip\");\n $tmpfile = File::Temp->new();\n print $tmpfile my $test_text = \"test blob, to be inserted\\n\";\n $tmpfile->close;\n like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,\n      \"hash_and_insert_object: returns hash\");\n-$iostring = IO::String->new;\n+open $iostring, '>', \\$output;\n is($r->cat_blob($newhash, $iostring), length $test_text, \"cat_blob: roundtrip size\");\n-is(${$iostring->string_ref}, $test_text, \"cat_blob: roundtrip data\");\n+is($output, $test_text, \"cat_blob: roundtrip data\");\n \n # paths\n is($r->repo_path, \"./.git\", \"repo_path\");\n-- \n1.5.5.23.g2a5fe\n"},{"id":"80221","messageId":"m37icmol6y.fsf@localhost.localdomain","threadId":"14014","inReplyTo":"1213796224-995-1-git-send-email-michael@ndrix.org","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-18T14:46:22Z","receivedAt":"2008-06-18T14:46:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael Hendricks <michael@ndrix.org> writes:\n\n> Instead of using IO::String to create an in-memory filehandle, use\n> open() with a scalar reference as the filename.  This feature has been\n> available since Perl 5.8.0 (which was released in 2002), so it should\n> be available pretty much everywhere by now.\n\nBesides if I understand correctly gitweb very much requires Perl >= 5.8\nbecause of required Unicode support.\n\nNevertheless adding \"use v5.8.0;\" or \"use 5.008_000;\" would be I guess\ngood idea.\n\n\nAnd best solution, although perhaps unnecessary, would be to check\nfor version >= 5.8, if older check for IO::String, and even if that\nfails, simply skip those tests that require in-memory filehandle\n(or use tempfile).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"80223","messageId":"b77c1dce0806180810r46a3e2a5i4eb228e6dc19613d@mail.gmail.com","threadId":"14014","inReplyTo":"m37icmol6y.fsf@localhost.localdomain","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Rafael Garcia-Suarez","fromEmail":"rgarciasuarez@gmail.com","sentAt":"2008-06-18T15:10:57Z","receivedAt":"2008-06-18T15:10:57Z","isPatch":true,"sender":{"key":"rgarciasuarez@gmail.com","avatar":null},"body":"2008/6/18 Jakub Narebski <jnareb@gmail.com>:\n> Michael Hendricks <michael@ndrix.org> writes:\n>\n>> Instead of using IO::String to create an in-memory filehandle, use\n>> open() with a scalar reference as the filename.  This feature has been\n>> available since Perl 5.8.0 (which was released in 2002), so it should\n>> be available pretty much everywhere by now.\n>\n> Besides if I understand correctly gitweb very much requires Perl >= 5.8\n> because of required Unicode support.\n>\n> Nevertheless adding \"use v5.8.0;\" or \"use 5.008_000;\" would be I guess\n> good idea.\n\n\"use 5.008;\" is preferred form; \"use v5.8.0\" might yield obscure error\nmessages on perls < 5.6, which is not the desired result.\n"},{"id":"80232","messageId":"alpine.DEB.1.00.0806181756540.6439@racer","threadId":"14014","inReplyTo":"m37icmol6y.fsf@localhost.localdomain","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-18T17:00:14Z","receivedAt":"2008-06-18T17:00:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 18 Jun 2008, Jakub Narebski wrote:\n\n> Michael Hendricks <michael@ndrix.org> writes:\n> \n> > Instead of using IO::String to create an in-memory filehandle, use \n> > open() with a scalar reference as the filename.  This feature has been \n> > available since Perl 5.8.0 (which was released in 2002), so it should \n> > be available pretty much everywhere by now.\n> \n> Besides if I understand correctly gitweb very much requires Perl >= 5.8 \n> because of required Unicode support.\n\nDid I miss something?  Was this patch not more about Git.pm?\n\nBTW I think it is not nice at all how the dependency hell with Git.pm is \nmade worse recently.\n\nIt is fascinating through how much _pain_ we go with the shell scripts to \nmaintain portability, even with _very_ old or obscure systems (see the SCO \nserver patches that came in not long ago!), and just walk over that \nportability when it comes to Perl...\n\nCiao,\nDscho\n"},{"id":"80234","messageId":"200806181952.02048.jnareb@gmail.com","threadId":"14014","inReplyTo":"alpine.DEB.1.00.0806181756540.6439@racer","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-18T17:52:00Z","receivedAt":"2008-06-18T17:52:00Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 18 Jun 2008, Johannes Schindelin wrote:\n> On Wed, 18 Jun 2008, Jakub Narebski wrote:\n> > Michael Hendricks <michael@ndrix.org> writes:\n> > \n> > > Instead of using IO::String to create an in-memory filehandle, use \n> > > open() with a scalar reference as the filename.  This feature has been \n> > > available since Perl 5.8.0 (which was released in 2002), so it should \n> > > be available pretty much everywhere by now.\n> > \n> > Besides if I understand correctly gitweb very much requires Perl >= 5.8 \n> > because of required Unicode support.\n> \n> Did I miss something?  Was this patch not more about Git.pm?\n\nOops... You are right, my mistake.\n\nFor my defense I'd like to point out that the patch this patch is\nresponse to was made by gitweb caching project GSoC student, Lea Wiemann\n(who should have been CC-ed, by the way).\n \n> BTW I think it is not nice at all how the dependency hell with Git.pm is \n> made worse recently.\n\nIt is not dependency for Git.pm, but for Git.pm TEST.\n\n> It is fascinating through how much _pain_ we go with the shell scripts to \n> maintain portability, even with _very_ old or obscure systems (see the SCO \n> server patches that came in not long ago!), and just walk over that \n> portability when it comes to Perl...\n\nAnd I pointed out how it could be resolved (use 5.8 specific feature,\nor IO::String, or skip tests).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"80240","messageId":"7vzlpiy2sm.fsf@gitster.siamese.dyndns.org","threadId":"14014","inReplyTo":"alpine.DEB.1.00.0806181756540.6439@racer","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-18T19:13:29Z","receivedAt":"2008-06-18T19:13:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Wed, 18 Jun 2008, Jakub Narebski wrote:\n>\n>> Michael Hendricks <michael@ndrix.org> writes:\n>> \n>> > Instead of using IO::String to create an in-memory filehandle, use \n>> > open() with a scalar reference as the filename.  This feature has been \n>> > available since Perl 5.8.0 (which was released in 2002), so it should \n>> > be available pretty much everywhere by now.\n>> \n>> Besides if I understand correctly gitweb very much requires Perl >= 5.8 \n>> because of required Unicode support.\n>\n> Did I miss something?  Was this patch not more about Git.pm?\n>\n> BTW I think it is not nice at all how the dependency hell with Git.pm is \n> made worse recently.\n>\n> It is fascinating through how much _pain_ we go with the shell scripts to \n> maintain portability, even with _very_ old or obscure systems (see the SCO \n> server patches that came in not long ago!), and just walk over that \n> portability when it comes to Perl...\n\nHey, calm down a bit and give me a bit more credit.  I am not that stupid.\nI've looked at the patch, and it is parked in 'pu', not near 'next'.\n"},{"id":"80242","messageId":"alpine.DEB.1.00.0806182030200.6439@racer","threadId":"14014","inReplyTo":"200806181952.02048.jnareb@gmail.com","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-18T19:35:36Z","receivedAt":"2008-06-18T19:35:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 18 Jun 2008, Jakub Narebski wrote:\n\n> On Wed, 18 Jun 2008, Johannes Schindelin wrote:\n>\n> > BTW I think it is not nice at all how the dependency hell with Git.pm \n> > is made worse recently.\n> \n> It is not dependency for Git.pm, but for Git.pm TEST.\n\nSo?  Why do you want to break the _test_ on those machines where you need \nthem most?  We _know_ that a release from Junio works fine on Linux.\n\n> > It is fascinating through how much _pain_ we go with the shell scripts \n> > to maintain portability, even with _very_ old or obscure systems (see \n> > the SCO server patches that came in not long ago!), and just walk over \n> > that portability when it comes to Perl...\n> \n> And I pointed out how it could be resolved (use 5.8 specific feature, or \n> IO::String, or skip tests).\n\nI have to point out that the platforms I was speaking of are not know to \nmake upgrading as easy as Linux.  And some of them _do_ come with pretty \nold perl.  And yes, I had this exact issue (remember when I worked on \nremoving Git's dependency on Python?  That was it.  Not enough quota.  \nUncooperative admin.  Desperate need for a sensible SCM).\n\nIn any case, I have to reiterate my point: breaking \nbackwards-compatibility for _no_ good reason is wrong.  I have not looked \nat the patch in question, but I seriously doubt that this is the easiest, \nmost elegant (and yes, backwards-compatible) solution.\n\nTypically, it is not a good sign when you _require_ newer and newer \nfeatures and versions of components you use.\n\nWhatever,\nDscho\n"},{"id":"80243","messageId":"alpine.DEB.1.00.0806182036080.6439@racer","threadId":"14014","inReplyTo":"7vzlpiy2sm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-18T19:37:06Z","receivedAt":"2008-06-18T19:37:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 18 Jun 2008, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > It is fascinating through how much _pain_ we go with the shell scripts \n> > to maintain portability, even with _very_ old or obscure systems (see \n> > the SCO server patches that came in not long ago!), and just walk over \n> > that portability when it comes to Perl...\n> \n> Hey, calm down a bit and give me a bit more credit.  I am not that \n> stupid. I've looked at the patch, and it is parked in 'pu', not near \n> 'next'.\n\nHeh.  The part about the shell scripts was actually meant as a genuine \npraise.  And I did not mean to criticize _you_ for introducing IO::Stream.\n\nCiao,\nDscho\n"},{"id":"80245","messageId":"48596542.4000308@gmail.com","threadId":"14014","inReplyTo":"alpine.DEB.1.00.0806182030200.6439@racer","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-18T19:42:58Z","receivedAt":"2008-06-18T19:42:58Z","isPatch":true,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Johannes Schindelin wrote:\n> So?  Why do you want to break the _test_ on those machines where you need \n> them most?  We _know_ that a release from Junio works fine on Linux.\n\nGoodness.  Everyone in this thread, please relax a notch.  I thought we \nhad pretty clear agreement that we want to keep Perl 5.6 compatibility \nfor Git.pm.  The solution is to use a temporary file in the current \ndirectory (and unlink it afterwards).  If nobody has done that by \ntomorrow I'll do it.  It'll take that less time than to even read this \nthread.\n\nNow lets get back to work.\n\n-- Lea\n"},{"id":"80346","messageId":"485AA49C.5060607@gmail.com","threadId":"14014","inReplyTo":"1213796224-995-1-git-send-email-michael@ndrix.org","subject":"Re: [PATCH] Remove dependency on IO::String from Git.pm test","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-19T18:25:32Z","receivedAt":"2008-06-19T18:25:32Z","isPatch":true,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Michael Hendricks wrote:\n> Instead of using IO::String to create an in-memory filehandle, use\n> open() with a scalar reference as the filename.\n\nI've now sent a new version of my script that uses File::Temp and only \ndepends on Perl 5.6.2.  Thanks for making the start!\n\nJakub Narebski wrote:\n > [...] Lea Wiemann (who should have been CC-ed, by the way).\n\nFor the record, CC'ing me or not doesn't make a difference if it's \nposted to the list (I don't actually notice whether I'm CC'ed).\n\n-- Lea\n"}]}