Subject: pkg/23207: dmesg2gif won't run if pkg database doesn't exist
To: None <email@example.com>
From: None <kre@munnari.OZ.AU>
Date: 10/20/2003 16:21:49
>Synopsis: dmesg2gif won't run if pkg database doesn't exist
>Arrival-Date: Mon Oct 20 09:27:00 UTC 2003
>Originator: Robert Elz
>Release: NetBSD 1.6T (pkgsrc current as of now - Date: above)
Prince of Songkla University
System: NetBSD delta.cs.mu.OZ.AU 1.6T NetBSD 1.6T (DELTA) #42: Thu May 29 12:23:16 ICT 2003 firstname.lastname@example.org.OZ.AU:/usr/obj/sys/DELTA i386
dmesg2gif has dependencies on graphviz and perl (as it should, as
it uses both at run time).
However, it also checks that graphviz is present every time it is
run, and what's more, does that using pkg_info - which works only
on systems where the package database is installed. This means
it cannot work on systems that mount $PREFIX (/usr/pkg or whatever)
from a server, but have no need for (and usually no access to) the
If a run time check is needed at all, it should be to test that the
"dot" command is present in the path somewhere, which is what is
required -- but if that is the right thing to do, why is no similar
check made for perl, which is alsu used (and assumed to be in $PATH).
dmesg2gif also contains the "quaint" idiom
cat | grep -v '^#' | ...
where just using
grep -v '^#' | ...
would do just as well. It also suggests in its usage that people
use "cat file | dmesg2gif" rather than "dmesg2gif < file".
While I believe pipes are a wonderful thing, people really should
be encouraged to use them when needed, and not just because they
can't be bothered learning about input re-directions. Similarly,
there are plenty of uses for the cat command - but whenever one is
tempted to actually use it in a pipeline, one should really think
again - 80% of the time it gets used there incorrectly.
(The statistic is my invention ... but is probably close).
By inspection of the code - or run it in an environment as
Rewrite the script...
Aside: I thought pkgsrc was still in a freeze, other commits to it of updated
versions I can understand as being required to make the whole thing work
together, but this one?