Subject: pkg/23207: dmesg2gif won't run if pkg database doesn't exist
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 10/20/2003 16:21:49
>Number:         23207
>Category:       pkg
>Synopsis:       dmesg2gif won't run if pkg database doesn't exist
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 20 09:27:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Robert Elz
>Release:        NetBSD 1.6T	(pkgsrc current as of now - Date: above)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD delta.cs.mu.OZ.AU 1.6T NetBSD 1.6T (DELTA) #42: Thu May 29 12:23:16 ICT 2003 kre@fuchsia.cs.mu.OZ.AU:/usr/obj/sys/DELTA i386
Architecture: i386
Machine: i386
>Description:
	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
	package database.

	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).

>How-To-Repeat:
	By inspection of the code - or run it in an environment as
	described above.
>Fix:
	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?
>Release-Note:
>Audit-Trail:
>Unformatted: