Small bug in ports.php

Juan Manuel Palacios jmpp at macports.org
Sat Nov 24 16:11:12 PST 2007


On Nov 24, 2007, at 6:59 PM, Ryan Schmidt wrote:

> Got the database created, a user created, edited the script to point  
> to a password file, changed the spam lovers to me, ran make. Am now  
> trying to run the script.
>
> $ env tclsh PortIndex2MySQL

	No need to do this, the script already has a "#!/usr/bin/env tclsh"  
shebang (you can run it as "./PortIndex2MySQL").
>
>
> It tickles my hard drive for awhile, then ends with no output.
>
> $ echo $?
> 1
> $
>
> So it's failing but I don't know why. I see there should be ui_error  
> output on failures. How can I see it?


	The script creates a /tmp/portsdb.log file where all runtime activity  
is logged and then piped to the /usr/sbin/sendmail program to get it  
through to $SPAM_LOVERS, so you might want to try to find that file.

	In any case, you should first run the script from the shell before  
installing it for launchd. Assuming I didn't introduce any bugs in my  
recent edits, all possible runtime failures should be in the contents  
of that log file and then in your mailbox (in the case of these  
"accounted for failures" --like a failure to connect to the mysqld  
server or no password file found--, the script cleans up after itself  
upon exit and removes everything it creates, including the log file);  
if I did introduce, say, a Tcl syntactic bug, then you should get a  
backtrace spill on your shell. Please let me know how it goes so that  
I can correct potential bugs.

>
> Properly:
>
> <?php
>
> if (isset($_SERVER['HTTP_HOST']) && !preg_match('%(^|\.)macports\.org 
> $%', $_SERVER['HTTP_HOST'])) {
> 	echo "warning";
> }
>
> ?>
>
> Some clients don't set $_SERVER['HTTP_HOST'] so you must test for  
> its existence first.
>
> Fixed the regular expression to actually be a regular expression.
>
> Of course we already have a redirect in place from macports.org to www.macports.org 
>  so nobody will ever be accessing our web site as "http://macports.org/ 
> " (it'll always be "http://www.macports.org/").


	Thanks for this info Ryan, will code it in shortly!

	Regards,...


-jmpp



More information about the macports-dev mailing list