Don't print messages inside platform directives
Ryan Schmidt
ryandesign at macports.org
Fri May 25 14:44:59 PDT 2007
A user on macports-users reported this problem, which I can confirm:
On May 25, 2007, at 15:03, Valentin Kuznetsov wrote:
> When I run portindex I've got 0 errors, but along the output lines
> I saw:
> Error: ==== ATTENTION!!!! ====
> Error: Sockstat is not working under darwin 8 nor tiger. Please use
> Error: lsof -i6/lsof -i4/lsof -U instead.
> Error: ==== ATTENTION!!!! ====
I also see the message just by typing "port info sockstat", which is
likely due to recent changes to "port info":
$ port info sockstat
Error: ==== ATTENTION!!!! ====
Error: Sockstat is not working under darwin 8 nor tiger. Please use
Error: lsof -i6/lsof -i4/lsof -U instead.
Error: ==== ATTENTION!!!! ====
Error: Please sudo port uninstall sockstat
sockstat 1.6.2.6, sysutils/sockstat (Variants: universal, darwin_8)
http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/sockstat/?
hideattic=0&only_with_tag=RELENG_4_9
The sockstat command lists open Internet or UNIX domain sockets.
Current version of sockstat from FreeBSD is written in C while this
old version is still in Perl. This program is from FreeBSD's source
tree.
Platforms: darwin
Maintainers: mjhsieh at yahoo.com
sysutils/sockstat does this:
platform darwin 8 {
ui_error "==== ATTENTION!!!! ===="
ui_error "Sockstat is not working under darwin 8 nor tiger. Please use"
ui_error "lsof -i6/lsof -i4/lsof -U instead."
ui_error "==== ATTENTION!!!! ===="
ui_error "Please sudo port uninstall sockstat"
}
I don't think we should be outputting any messages of any kind in
platform variants which MacPorts auto-selects, because they get
executed at all sorts of times where outputting messages is not
appropriate. Instead, I believe the port should do something like
this if it wants to output a message:
platform darwin 8 {}
pre-fetch {
if { [variant_isset darwin_8] } {
ui_error "==== ATTENTION!!!! ===="
ui_error "Sockstat is not working under darwin 8 nor tiger. Please
use"
ui_error "lsof -i6/lsof -i4/lsof -U instead."
ui_error "==== ATTENTION!!!! ===="
ui_error "Please sudo port uninstall sockstat"
}
}
I'm also concerned that the port would output a message saying that
the port is not compatible with Tiger, yet not prevent installation
on Tiger. It should exit after printing that message. Well, the
message should be reworded too, since it's not a forgone conclusion
that the user already has sockstat installed at the point that they
see the message. The user may be trying to install it for the first
time, in which case an uninstall is not necessary or possible.
Finally, it's not clear why we are preventing the port from
installing on 10.4. Will it work on earlier OS versions like 10.3 or
10.2? I assume yes. What about later OS versions like 10.5? I assume
no, but I don't know for sure. The port description, or at least a
comment in the portfile, should explain this, and if it's expected
that the port won't work on 10.5 either, then darwin 9 should be
excluded also.
More information about the macports-dev
mailing list