From e0da57358cc778436a5e5af1a2523611eb64f46e Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 9 Jul 2007 00:39:55 +0000 Subject: [PATCH] get confused. So it's best for ikiwiki to follow the compatability * Support building on systems that lack asprintf. * mercurial getctime is currently broken, apparently by some change in mercurial version 0.9.4. Turn the failing test case into a TODO test case. --- IkiWiki/Wrapper.pm | 23 +++++++++++++++-------- debian/changelog | 7 +++++-- doc/bugs/build_in_opensolaris.mdwn | 2 ++ po/ikiwiki.pot | 6 +++--- t/mercurial.t | 7 +++++-- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 9415d4a17..558cdb1cc 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -33,7 +33,7 @@ sub gen_wrapper () { #{{{ foreach my $var (@envsave) { $envsave.=<<"EOF" if ((s=getenv("$var"))) - asprintf(&newenviron[i++], "%s=%s", "$var", s); + addenv("$var", s); EOF } if ($config{rcs} eq "svn" && $config{notify}) { @@ -41,15 +41,15 @@ EOF # $2 in REV in the environment. $envsave.=<<"EOF" if (argc == 3) - asprintf(&newenviron[i++], "REV=%s", argv[2]); + addenv("REV", argv[2]); else if ((s=getenv("REV"))) - asprintf(&newenviron[i++], "%s=%s", "REV", s); + addenv("REV", s); EOF } if ($config{rcs} eq "tla" && $config{notify}) { $envsave.=<<"EOF" if ((s=getenv("ARCH_VERSION"))) - asprintf(&newenviron[i++], "%s=%s", "ARCH_VERSION", s); + addenv("ARCH_VERSION", s); EOF } @@ -64,7 +64,6 @@ EOF open(OUT, ">$wrapper.c") || error(sprintf(gettext("failed to write %s: %s"), "$wrapper.c", $!));; print OUT <<"EOF"; /* A wrapper for ikiwiki, can be safely made suid. */ -#define _GNU_SOURCE #include #include #include @@ -72,12 +71,20 @@ EOF #include extern char **environ; +char *newenviron[$#envsave+5]; +int i=0; + +addenv(char *var, char *val) { + char *s=malloc(strlen(var)+1+strlen(val)+1); + if (!s) + perror("malloc"); + sprintf(s, "%s=%s", var, val); + newenviron[i++]=s; +} int main (int argc, char **argv) { /* Sanitize environment. */ char *s; - char *newenviron[$#envsave+5]; - int i=0; $envsave newenviron[i++]="HOME=$ENV{HOME}"; newenviron[i++]="WRAPPED_OPTIONS=$configstring"; @@ -90,7 +97,7 @@ $envsave } execl("$this", "$this", NULL); - perror("failed to run $this"); + perror("exec $this"); exit(1); } EOF diff --git a/debian/changelog b/debian/changelog index f8b04172a..7c1625a41 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,10 +2,13 @@ ikiwiki (2.4) UNRELEASED; urgency=low * Make the toc plugin use html-compatible anchors. This is necessary since most web sites serve ikiwiki xhtml files as text/html and mozilla browsers - get confused. So it's best for ikiwiki to follow the compatability + get confused. So it's best for ikiwiki to follow the compatability recommendations in appendix C of the XHTML spec. Closes: #432045 + * Support building on systems that lack asprintf. + * mercurial getctime is currently broken, apparently by some change in + mercurial version 0.9.4. Turn the failing test case into a TODO test case. - -- Joey Hess Sun, 08 Jul 2007 12:54:55 -0400 + -- Joey Hess Sun, 08 Jul 2007 20:25:00 -0400 ikiwiki (2.3) unstable; urgency=low diff --git a/doc/bugs/build_in_opensolaris.mdwn b/doc/bugs/build_in_opensolaris.mdwn index 4e5b92d2d..4b738ccff 100644 --- a/doc/bugs/build_in_opensolaris.mdwn +++ b/doc/bugs/build_in_opensolaris.mdwn @@ -31,3 +31,5 @@ Thanks, Joey et al., for a really cool tool. >> Of the possible patches to make this more portable, I'd generally prefer >> one that uses portable functions (safely), rather than one that includes >> an asprintf implementation in ikiwiki. --[[Joey]] + +[[bugs/done]] diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 4c8756f89..1b86f0708 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-06-29 20:49-0400\n" +"POT-Creation-Date: 2007-07-08 20:26-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -548,13 +548,13 @@ msgid "failed to write %s: %s" msgstr "" #. translators: The parameter is a C filename. -#: ../IkiWiki/Wrapper.pm:100 +#: ../IkiWiki/Wrapper.pm:107 #, perl-format msgid "failed to compile %s" msgstr "" #. translators: The parameter is a filename. -#: ../IkiWiki/Wrapper.pm:108 +#: ../IkiWiki/Wrapper.pm:115 #, perl-format msgid "successfully generated %s" msgstr "" diff --git a/t/mercurial.t b/t/mercurial.t index da4e2beaa..7d6c2eacc 100755 --- a/t/mercurial.t +++ b/t/mercurial.t @@ -56,7 +56,10 @@ is($changes[0]{pages}[0]{"page"}, "test2.mdwn"); is($changes[1]{pages}[0]{"page"}, "test1.mdwn"); -my $ctime = IkiWiki::rcs_getctime("test2.mdwn"); -is($ctime, 0); +TODO: { + local $TODO = "hg behavior change seems to have broken this"; + my $ctime = IkiWiki::rcs_getctime("test2.mdwn"); + is($ctime, 0); +} system "rm -rf $dir"; -- 2.44.0