Subject: pkg/22187: xtide does not run without configuring (there are sensible defaults)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <gdt@ir.bbn.com>
List: netbsd-bugs
Date: 07/18/2003 19:07:46
>Number:         22187
>Category:       pkg
>Synopsis:       xtide does not run without configuring (there are sensible defaults)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 18 23:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Greg Troxel
>Release:        NetBSD 1.6.1_RC3
>Organization:
        Greg Troxel <gdt@ir.bbn.com>
>Environment:
	
	
System: NetBSD fnord.ir.bbn.com 1.6.1_RC3 NetBSD 1.6.1_RC3 (FNORD) #6: Mon Jul 7 12:44:31 EDT 2003 gdt@fnord.ir.bbn.com:/home/gdt/QUIST-current/netbsd/src/sys/arch/i386/compile/FNORD i386
Architecture: i386
Machine: i386
>Description:
When the xtide pkg is installed, a config file (needed by xtide to
find two database files) is placed in
$(PREFIX)/share/examples/xtide.conf.  The user is expected (and told)
to copy this to /usr/pkg/etc/xtide.conf.  If they don't, xtide won't
run, even though the behavior that should be default is obvious: use
the two database files installed by the package.  99.99% of all users
will want to do this; only the most extreme tide weenies will want to
get different databases, and they can still put in a config file if
they want.

>How-To-Repeat:
Install the xtide pkg.  Ignore the advice to install a config file,
since you shouldn't have to if the obvious default behavior is good
enough.  Notice that xtide fails to run, complaining about the lack of
a config file.

>Fix:

Apply the enclosed patch, which makes xtide check the examples dir if
it fails to find config information via the environment or
etc/xtide.conf.

Optionally, rm MESSAGE, since that really isn't needed (copying a file
from share/examples/xtide.conf to etc/xtide.conf if you want a
different config is standard and needs no explanation).

This fix has not been run by Paul Goyette (xtide maintainer), but he
responded "Feel free to fix!" to my suggestion of the concept.

Index: Makefile
===================================================================
RCS file: /NETBSD-CVS/pkgsrc/misc/xtide/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	21 Oct 2002 12:40:53 -0000	1.4
+++ Makefile	18 Jul 2003 22:53:17 -0000
@@ -2,7 +2,7 @@
 
 DISTNAME=	xtide-2.4
 PKGNAME=	${DISTNAME}
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES= 	misc x11
 MASTER_SITES=	ftp://ftp.flaterco.com/xtide/
 DISTFILES=	${XTIDE_SRC} harmonics.txt.gz offsets.xml.gz
Index: distinfo
===================================================================
RCS file: /NETBSD-CVS/pkgsrc/misc/xtide/distinfo,v
retrieving revision 1.3
diff -u -r1.3 distinfo
--- distinfo	2 Jul 2002 12:59:46 -0000	1.3
+++ distinfo	18 Jul 2003 22:53:17 -0000
@@ -7,5 +7,5 @@
 SHA1 (offsets.xml.gz) = 2cc596373b631e7a0146bac2b66a7754334ab5b7
 Size (offsets.xml.gz) = 150845 bytes
 SHA1 (patch-aa) = 48b0c37ba2f664f14508c2096184e75784958205
-SHA1 (patch-ab) = eb7a432bb0f2aef65b1c1f885df942b37ad4c7c3
+SHA1 (patch-ab) = 24599e96ee07867dde71dbcc62ce3da652d923b4
 SHA1 (patch-ac) = 6bfd233418ceeab1211248166a697ed824af1848
Index: patches/patch-ab
===================================================================
RCS file: /NETBSD-CVS/pkgsrc/misc/xtide/patches/patch-ab,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-ab
--- patches/patch-ab	31 May 2001 15:48:05 -0000	1.1.1.1
+++ patches/patch-ab	18 Jul 2003 22:53:17 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-ab,v 1.1.1.1 2001/05/31 15:48:05 agc Exp $
 
---- TideContext.cc.orig	Fri Mar 23 21:52:40 2001
-+++ TideContext.cc	Thu May 31 13:48:53 2001
-@@ -42,12 +42,12 @@
+--- TideContext.cc.orig	Fri Mar 23 16:52:40 2001
++++ TideContext.cc
+@@ -42,12 +42,20 @@ Settings *in_settings) {
    colors = in_colors;
    settings = in_settings;
  
@@ -14,6 +14,14 @@
      FILE *configfile;
 -    if ((configfile = fopen ("/etc/xtide.conf", "r"))) {
 +    if ((configfile = fopen (PREFIX "/etc/xtide.conf", "r"))) {
++      hfile_path.getline (configfile);
++      fclose (configfile);
++    }
++  }
++  // NetBSD: try examples if etc is not present, to provide sensible default
++  if (hfile_path.isNull()) {
++    FILE *configfile;
++    if ((configfile = fopen (PREFIX "/share/examples/xtide.conf", "r"))) {
        hfile_path.getline (configfile);
        fclose (configfile);
      }
>Release-Note:
>Audit-Trail:
>Unformatted: