Jul 022015
 

FreshPorts is a tender beast. It is both massive and sensitive. One example of that sensitivity came to light today.

Jeffrey Bouquet wrote in to tell me of a problem with paths on FreshSource (our sister website, which displays more, but less). The problem has been corrected, but I took screen shots to illustrate this post.

Looking

Looking at FreshSource and scrolling down, I saw this:

Screen Shot 2015-07-02 at 11.49.27 AM

The top commit does not list the files. The second commit does. Oh.

I started looking at those two commits in FreshPorts and I found:

Screen Shot 2015-07-02 at 11.52.40 AM

URL for above commit

The path name is listed, but that’s just text. Notice that the Links column is empty.

Compare that with the previous commit:

Screen Shot 2015-07-02 at 11.46.08 AM

URL to above commit

As you see, the Links column is populated.

Source

Digging around in the code for this output, I noticed a call to freshports_MessageIdToRepoName($message_id) and that is what clued me in.

message_id

If you examine the two URLs to commits above, you will notice a difference in the message_id paramter:

  • message_id=201507011852.t61Iqbv2094356@repo.freebsd.org
  • message_id=201507011757.t61Hv8u7065602@svn.freebsd.org

Ahh, they changed the hostname for outgoing commit emails.

The fix

A few minutes later and some quick tests, we had a fix:

 $ svn di freshports.php 
Index: freshports.php
===================================================================
--- freshports.php	(revision 4718)
+++ freshports.php	(working copy)
@@ -35,7 +35,7 @@
 
 DEFINE('SPONSORS', 'Servers and bandwidth provided by<br><a href="http://www.nyi.net/" TARGET="_new">New York Internet</a>, <a href="http://www.supernews.com/"  TARGET="_new">SuperNews</a>, and <a href="http://www.rootbsd.net/" TARGET="_new">RootBSD</a>');
 
-DEFINE('FRESHPORTS_ENCODING', 'UTF-8');
+DEFINE('FRESHPORTS_ENCODING', 'ISO-8859-15');
 
 if ($Debug) echo "'" . $_SERVER['DOCUMENT_ROOT'] . '/../classes/watchnotice.php<br>';
 
@@ -2093,7 +2093,9 @@
 {
   $repo = array(
             '/\@svn.freebsd.org$/i'     => FREEBSD_REPO_SVN,
-            '/\@repoman.freebsd.org$/i' => FREEBSD_REPO_CVS);
+            '/\@repoman.freebsd.org$/i' => FREEBSD_REPO_CVS,
+            '/\@repo.freebsd.org$/i'    => FREEBSD_REPO_SVN,
+);
 
   # given a message id, figure out what repo it came from
   $RepoName = '';

Why bother?

FreshPorts predates the change from cvs to svn. The data in FreshPorts does not care what type of revision management tool you use, it does link back to the repo for your browsing pleasure. If FreshPorts knows the repo related to a given commit, it can link. If not, it can’t.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

  One Response to “hostname change causes missing links and pathnames”

  1. NOTE: this occurred again. This time, the fix should be permanent:

    +  
    +  if (Empty($RepoName)) {
    +    $RepoName = FREEBSD_REPO_SVN;
    +  }