* [PATCH] t9700-perl-git.sh: Fix a test failure on cygwin @ 2008-08-27 18:09 Ramsay Jones 2008-08-27 19:34 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Ramsay Jones @ 2008-08-27 18:09 UTC (permalink / raw) To: GIT Mailing-list; +Cc: Junio C Hamano Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> --- This patch fixes the t9700 test failure on cygwin. Don't ask me to explain why the original test.pl fails on cygwin, but passes on Linux! My perl version: $ perl --version This is perl, v5.8.7 built for cygwin-thread-multi-64int (with 1 registered patch, see perl -V for more detail) Copyright 1987-2005, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. $ [My perl version on Linux is whatever comes with Ubuntu 7.04] ATB, Ramsay Jones t/t9700/test.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 4d23125..6d59356 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -15,9 +15,9 @@ BEGIN { use_ok('Git') } # set up our $repo_dir = "trash directory"; -our $abs_repo_dir = Cwd->cwd; +our $abs_repo_dir = cwd(); die "this must be run by calling the t/t97* shell script(s)\n" - if basename(Cwd->cwd) ne $repo_dir; + if basename($abs_repo_dir) ne $repo_dir; ok(our $r = Git->repository(Directory => "."), "open repository"); # config -- 1.6.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on cygwin 2008-08-27 18:09 [PATCH] t9700-perl-git.sh: Fix a test failure on cygwin Ramsay Jones @ 2008-08-27 19:34 ` Junio C Hamano 2008-08-29 20:56 ` Ramsay Jones 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2008-08-27 19:34 UTC (permalink / raw) To: Ramsay Jones; +Cc: GIT Mailing-list, Lea Wiemann Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes: > Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> > --- > > This patch fixes the t9700 test failure on cygwin. Don't ask me to > explain why the original test.pl fails on cygwin, but passes on Linux! > > My perl version: > > $ perl --version > > This is perl, v5.8.7 built for cygwin-thread-multi-64int > (with 1 registered patch, see perl -V for more detail) > > Copyright 1987-2005, Larry Wall > > Perl may be copied only under the terms of either the Artistic License or the > GNU General Public License, which may be found in the Perl 5 source kit. > > Complete documentation for Perl, including FAQ lists, should be found on > this system using `man perl' or `perldoc perl'. If you have access to the > Internet, point your browser at http://www.perl.org/, the Perl Home Page. > $ > > [My perl version on Linux is whatever comes with Ubuntu 7.04] Curious. What does this give you: $ cd t $ sh t9700-perl-git.sh -v with the attached patch? Unfortunately this cannot be run with "-i -v" because 'test_external_without_stderr' uses test_external which in turn exits upon failure when -i is given, without letting the former to report what was given to the standard error stream (this is slightly offtopic but pertains to debuggability of tests, so Lea is Cc'ed). For me, cwd() is the same as Cwd->cwd (this is from Perl 5.8.8); perhaps it behaves differently on Cygwin? t/t9700/test.pl | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git i/t/t9700/test.pl w/t/t9700/test.pl index 851cea4..139711d 100755 --- i/t/t9700/test.pl +++ w/t/t9700/test.pl @@ -15,6 +15,12 @@ BEGIN { use_ok('Git') } # set up our $abs_repo_dir = Cwd->cwd; +our $cwd = cwd(); +print STDERR "Cwd->cwd says '$abs_repo_dir'\n"; +print STDERR "cwd() says '$cwd'\n"; + +exit(1); + ok(our $r = Git->repository(Directory => "."), "open repository"); # config ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on cygwin 2008-08-27 19:34 ` Junio C Hamano @ 2008-08-29 20:56 ` Ramsay Jones 0 siblings, 0 replies; 8+ messages in thread From: Ramsay Jones @ 2008-08-29 20:56 UTC (permalink / raw) To: Junio C Hamano; +Cc: GIT Mailing-list, Lea Wiemann Junio C Hamano wrote: > Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes: >> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> >> --- >> >> This patch fixes the t9700 test failure on cygwin. Don't ask me to >> explain why the original test.pl fails on cygwin, but passes on Linux! >> > Curious. > > What does this give you: > > $ cd t > $ sh t9700-perl-git.sh -v > > with the attached patch? [snip] > For me, cwd() is the same as Cwd->cwd (this is from Perl 5.8.8); perhaps > it behaves differently on Cygwin? > Yes, sorry, I should have spent a few minutes explaining the cause of the bug and why the patch fixes it; my bad! (I was in a bit of a hurry; I had just re-booted twice in quick succession, once into Linux so that I could pull the patch over to test it there, before going back to Windows, in order to format-patch and send it to the ML. Yes it is a PITA 8-) I haven't tried your patch because, well, I already know what it will say! Once I determined that the problem must be in the following four lines of the t/t9700/test.pl script: 17 our $repo_dir = "trash directory"; 18 our $abs_repo_dir = Cwd->cwd; 19 die "this must be run by calling the t/t97* shell script(s)\n" 20 if basename(Cwd->cwd) ne $repo_dir; then the problem and the solution was immediately obvious. Well, maybe that is overstating it slightly. After all, I still indulged in a spot of "printf debugging" just to make sure! I'm sure you can imagine what it looked like ;-) [BTW, the reason it was obvious, is that I have met this problem *too many* times in the past, so I'm "attuned" to it. Don't worry, I will dispense with the rant this time :-P] I won't repeat that here, but offer a quick script: $ cat test-cwd.pl use Cwd; print "cwd(): ", cwd(), "\n"; print "Cwd::cwd(): ", Cwd::cwd(), "\n"; print "Cwd->cwd: ", Cwd->cwd, "\n"; $ on cygwin: $ perl test-cwd.pl cwd(): /home/ramsay Cwd::cwd(): /home/ramsay Usage: Cwd::cwd() at test-cwd.pl line 5. $ and on Linux: $ perl test-cwd.pl cwd(): /home/ramsay Cwd::cwd(): /home/ramsay Cwd->cwd: /home/ramsay $ So it is clear, the problem is caused by the "method invocation syntax". Among other things, this mechanism auto-magically inserts a new (in this case only) first parameter which represents the "class" Cwd to the cwd() "method-call". So, do a "perldoc Cwd" and take a look at the example usage. So is cwd() a method of the Cwd class, or is it a function in the Cwd namespace? Exactly, hence the patch. (Well, some may prefer to see the Cwd::cwd() syntax used instead. Dunno) So, the bug is inappropriate use of the method invocation syntax. But that didn't explain the difference in behaviour on the two platforms, hence my "Don't ask me to explain ..." comment. Now it just so happens that I have the source code to perl v5.8.8 in my home directory (no really!) on Linux, so I spent a little time rooting around to try and explain it. The changelog type files, perl-5.8.8/Changes and perl-5.8.8/ext/Cwd/Changes didn't show much of interest. The module impl. in perl-5.8.8/lib/Cwd.pm was an interesting read but didn't explain it. Then I bumped into the cygwin specific file perl-5.8.8/cygwin/cygwin.c, part of which I include below: ---perl-5.8.8/cygwin/cygwin.c:139-157--- /* see also Cwd.pm */ static XS(Cygwin_cwd) { dXSARGS; char *cwd; if(items != 0) Perl_croak(aTHX_ "Usage: Cwd::cwd()"); if((cwd = getcwd(NULL, -1))) { ST(0) = sv_2mortal(newSVpv(cwd, 0)); free(cwd); #ifndef INCOMPLETE_TAINTS SvTAINTED_on(ST(0)); #endif XSRETURN(1); } XSRETURN_UNDEF; } ------ So, that explains it. ATB, Ramsay Jones P.S. I'm sure someone will say that "the real bug here" is that the cygwin platform should support the method invocation syntax just like all the other platforms. Well, I guess I don't really care that much. But If you were to push me, I would tend to go the other way, and say the other platforms should not allow an incorrect invocation to go unnoticed! Whatever. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin @ 2009-11-19 18:41 Ramsay Jones 2009-12-30 13:40 ` Nanako Shiraishi 0 siblings, 1 reply; 8+ messages in thread From: Ramsay Jones @ 2009-11-19 18:41 UTC (permalink / raw) To: Junio C Hamano; +Cc: GIT Mailing-list The t/t9700/test.pl script uses method invocation syntax when using the Cwd module to determine the current working directory. This fails on cygwin, since cygwin perl specifically checks for any arguments to the cwd() function and croak()'s with the message "Usage: Cwd::cwd()". (In perl v5.8.8 distribution, see the file perl-5.8.8/cygwin/cygwin.c lines 139-157) In order to avoid the problem, we replace the method invocation syntax with a simple function call. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> --- t/t9700/test.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 6c70aec..666722d 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -13,7 +13,7 @@ use File::Basename; BEGIN { use_ok('Git') } # set up -our $abs_repo_dir = Cwd->cwd; +our $abs_repo_dir = cwd(); ok(our $r = Git->repository(Directory => "."), "open repository"); # config -- 1.6.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin 2009-11-19 18:41 [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin Ramsay Jones @ 2009-12-30 13:40 ` Nanako Shiraishi 2009-12-31 6:49 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Nanako Shiraishi @ 2009-12-30 13:40 UTC (permalink / raw) To: Junio C Hamano; +Cc: Ramsay Jones, GIT Mailing-list Junio, could you tell us what happened to this thread? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin 2009-12-30 13:40 ` Nanako Shiraishi @ 2009-12-31 6:49 ` Junio C Hamano 2010-01-01 0:05 ` Nanako Shiraishi 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2009-12-31 6:49 UTC (permalink / raw) To: Nanako Shiraishi; +Cc: Junio C Hamano, Ramsay Jones, GIT Mailing-list Nanako Shiraishi <nanako3@lavabit.com> writes: > Junio, could you tell us what happened to this thread? Hmph, I think we have it as 81f4026 (t9700-perl-git.sh: Fix a test failure on Cygwin, 2009-11-19). ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin 2009-12-31 6:49 ` Junio C Hamano @ 2010-01-01 0:05 ` Nanako Shiraishi 2010-01-01 0:07 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Nanako Shiraishi @ 2010-01-01 0:05 UTC (permalink / raw) To: Junio C Hamano; +Cc: Nanako Shiraishi, Ramsay Jones, GIT Mailing-list Quoting Junio C Hamano <gitster@pobox.com> > Nanako Shiraishi <nanako3@lavabit.com> writes: > >> Junio, could you tell us what happened to this thread? > > Hmph, I think we have it as 81f4026 (t9700-perl-git.sh: Fix a test failure > on Cygwin, 2009-11-19). Oh, my mistake. I'm very sorry for wasting your time. -- Nanako Shiraishi http://ivory.ap.teacup.com/nanako3/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin 2010-01-01 0:05 ` Nanako Shiraishi @ 2010-01-01 0:07 ` Junio C Hamano 0 siblings, 0 replies; 8+ messages in thread From: Junio C Hamano @ 2010-01-01 0:07 UTC (permalink / raw) To: Nanako Shiraishi; +Cc: GIT Mailing-list Nanako Shiraishi <nanako3@lavabit.com> writes: > Quoting Junio C Hamano <gitster@pobox.com> > >> Nanako Shiraishi <nanako3@lavabit.com> writes: >> >>> Junio, could you tell us what happened to this thread? >> >> Hmph, I think we have it as 81f4026 (t9700-perl-git.sh: Fix a test failure >> on Cygwin, 2009-11-19). > > Oh, my mistake. I'm very sorry for wasting your time. That's Ok; your other reminders were all good ones and greatly appreciated. But let me slow down. I'll reply to the other messages next year ;-). ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-01-01 0:08 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-08-27 18:09 [PATCH] t9700-perl-git.sh: Fix a test failure on cygwin Ramsay Jones 2008-08-27 19:34 ` Junio C Hamano 2008-08-29 20:56 ` Ramsay Jones 2009-11-19 18:41 [PATCH] t9700-perl-git.sh: Fix a test failure on Cygwin Ramsay Jones 2009-12-30 13:40 ` Nanako Shiraishi 2009-12-31 6:49 ` Junio C Hamano 2010-01-01 0:05 ` Nanako Shiraishi 2010-01-01 0:07 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).