From b30cacdf8da07f40af03f1b26021d8ec4d8b8b4c Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Sun, 27 Jan 2013 22:09:57 -0500 Subject: Fix longstanding bug (chdir to nonexistent dirs). In test, set up the post-commit hook for more realism (and bugs!). To make wrappers work in test, set PERL5LIB, and allow the wrappee's path to be overridden. Meta-test that post-commit is really hooked up by verifying that content is getting generated in destdir. About the longstanding bug, which as far as I know was harmless: CVS can't operate outside a srcdir, so we're always setting $CWD. "local $CWD" restores the previous value when we go out of scope. Usually that's correct. But if we're removing the last file from a directory, the post-commit hook will exec in a working directory that's about to not exist (CVS will prune it). The fix: chdir() manually in cvs_runcvs(), so we can selectively not chdir() back. --- IkiWiki/Wrapper.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Wrapper.pm') diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 06be36dfc..84b4b5a2f 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -28,10 +28,11 @@ sub gen_wrappers () { %config=(%origconfig); } +our $program_to_wrap = $0; sub gen_wrapper () { $config{srcdir}=File::Spec->rel2abs($config{srcdir}); $config{destdir}=File::Spec->rel2abs($config{destdir}); - my $this=File::Spec->rel2abs($0); + my $this=File::Spec->rel2abs($program_to_wrap); if (! -x $this) { error(sprintf(gettext("%s doesn't seem to be executable"), $this)); } -- cgit v1.2.3