Date: 07 Aug 1998 20:40:03 +0200 From: dag-erli@ifi.uio.no (Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= ) To: doc@FreeBSD.ORG Subject: www/en/internal/homepage.pl is a major PITA Message-ID: <xzpsoj8tz3w.fsf@hrotti.ifi.uio.no>
index | next in thread | raw e-mail
The Perl scrip www/en/internal/homepage.pl (which generates a list of
homepages on a site, and is run by the Makefile in en/internal) poses
several problems. In no particular order:
First, mirror sites may not want to generate such a list at all. It
would definitely be incorrect/incomplete, since the page is supposed
to list the homepages of FreeBSD developers and core members who have
accounts on freefall. A mirror may run as a virtual host on a machine
that serves several different purposes, and it may be undesirable to
disclose the list that the script generates.
Second, the script crashes and burns if it doesn't find any pages.
Why? What is wrong with an empty list? Will it prevent the server from
running properly? IMHO this is pure, unadultered brain damage. It only
serves to piss off mirror maintainers by forcing them to edit either
the makefile or the script to get the mirror to compile.
Third, it assumes that the mirror is running on an NCSA-derived server
(such as Apache) with a default configuration. I happen to prefer
www_docs to public_html (if only from old habit) and always configure
my servers to use www_docs. This should at the very least be possible
to specify on the make command line.
Fourth, the "disable daemons" and "uucp accounts" code in the while
loop in the script is bogus. I've never yet seen a daemon or UUCP
account with a home directory that contains a www_docs or public_html
directory; simply checking for the existence of such a directory is
more than enough. BTW, how can you be sure that there are no
legitimate users whose login name begins with an uppercase U?
Fifth, even if it were not bogus, the abovementioned code should
compare the shell against the contents of /etc/shells rather than
relying on heuristics such as:
next if $shell =~~m%/(pppd|sliplogin|nologin|nonexistent)$%;
Sixth, the server name is hardcoded in the script, which means that
even if it doesn't get hit by any of the above, it will produce
nothing but a nice long list of dangling links.
Seventh, it should not rely on the existence of /etc/passwd, but use
getpwent().
Eight, the script should print the <ol> and </ol> tags itself rather
than relying on them to be in homepage.sgml. If the script does not
produce any output, compilation of homepage.sgml will fail because the
list has no items.
Ninth, since there is no reliable way to determine whether the list of
homepages has changed from one day to the next (assuming you rebuild
the mirror daily, which I do), homepage.inc should *always* be
rebuilt.
So, please, at the *very* least apply these patches, and if possible,
reevaluate the entire code.
---cut---
--- Makefile.orig Fri Aug 7 20:29:13 1998
+++ Makefile Fri Aug 7 20:30:07 1998
@@ -8,6 +8,9 @@
DOCS+= mirror.sgml
DOCS+= resignation.sgml
+.BEGIN:
+ @rm -f homepage.inc
+
homepage.inc:
perl homepage.pl > ${.TARGET}
--- homepage.pl.orig Fri Aug 7 20:21:32 1998
+++ homepage.pl Fri Aug 7 20:26:51 1998
@@ -1,5 +1,9 @@
#!/usr/bin/perl
+if (`hostname` ne "freefall.freebsd.org") {
+ exit(0);
+}
+
$passwd = '/etc/passwd';
$homepagedir = 'public_html';
@index = ('index.html', 'index.cgi');
@@ -41,10 +45,11 @@
die "No users found!\n";
}
+print "<ol>\n";
foreach (sort @pages) {
($gcos, $login) = split(/:/);
($firstgecos, @gecos) = split(/,/, $gcos);
print qq{<LI><A HREF="http://www.freebsd.org/~$login/">},
$firstgecos, "</A> ", join(', ', @gecos), "</LI>\n";
}
-
+print "</ol>\n";
--- homepage.sgml.orig Fri Aug 7 20:30:34 1998
+++ homepage.sgml Fri Aug 7 20:27:00 1998
@@ -10,9 +10,7 @@
<html>
&header;
-<ol>
&homepage;
-</ol>
&footer;
</body>
---cut---
DES
--
Dag-Erling Smørgrav - dag-erli@ifi.uio.no
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpsoj8tz3w.fsf>
