From owner-freebsd-doc Fri Aug 7 11:40:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA25020 for freebsd-doc-outgoing; Fri, 7 Aug 1998 11:40:31 -0700 (PDT) (envelope-from owner-freebsd-doc@FreeBSD.ORG) Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA25014 for ; Fri, 7 Aug 1998 11:40:24 -0700 (PDT) (envelope-from dag-erli@ifi.uio.no) Received: from hrotti.ifi.uio.no (2602@hrotti.ifi.uio.no [129.240.64.15]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with ESMTP id UAA13267 for ; Fri, 7 Aug 1998 20:40:04 +0200 (MET DST) Received: (from dag-erli@localhost) by hrotti.ifi.uio.no ; Fri, 7 Aug 1998 20:40:03 +0200 (MET DST) Mime-Version: 1.0 To: doc@FreeBSD.ORG Subject: www/en/internal/homepage.pl is a major PITA Organization: University of Oslo, Department of Informatics X-url: http://www.stud.ifi.uio.no/~dag-erli/ X-other-addresses: 'finger dag-erli@ifi.uio.no' for a list X-disclaimer-1: The views expressed in this article are mine alone, and do X-disclaimer-2: not necessarily coincide with those of any organisation or X-disclaimer-3: company with which am or have been affiliated. X-Stop-Spam: http://www.cauce.org/ From: dag-erli@ifi.uio.no (Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= ) Date: 07 Aug 1998 20:40:03 +0200 Message-ID: Lines: 111 X-Mailer: Gnus v5.5/Emacs 19.34 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.freebsd.org id LAA25015 Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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
    and
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 "
    \n"; foreach (sort @pages) { ($gcos, $login) = split(/:/); ($firstgecos, @gecos) = split(/,/, $gcos); print qq{
  1. }, $firstgecos, " ", join(', ', @gecos), "
  2. \n"; } - +print "
\n"; --- homepage.sgml.orig Fri Aug 7 20:30:34 1998 +++ homepage.sgml Fri Aug 7 20:27:00 1998 @@ -10,9 +10,7 @@ &header; -
    &homepage; -
&footer; ---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