Bug 102651 - [patch] New command-line option for jabberd port start-up (for /usr/ports/net-im/jabberd)
Summary: [patch] New command-line option for jabberd port start-up (for /usr/ports/net...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-29 19:10 UTC by Aaron Gifford
Modified: 2006-10-07 15:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Gifford 2006-08-29 19:10:14 UTC
While the current jabberd port (jabberd-2.0.11_1 in /usr/ports/net-im/jabberd) supports command-line option -c to specify a configuration file, if one's OTHER configuration files are NOT in the default /usr/local/etc directory, start-up will fail.

To fix this, I've added the option -d to specify an alternate configuration directory in which configuration files may reside.

This patch is simple, and is quick and easy to apply.

Aaron out.

Fix: 

$debug = 1 if exists($opts{D});
 $daemon = 1 if exists($opts{b});
@@ -123,6 +129,7 @@
     &debug("jabberd","stdout","debug on\n");
     &debug("jabberd","stdout","version($VERSION)\n");
     &debug("jabberd","stdout","config_dir($config_dir)\n");
+    &debug("jabberd","stdout","config($config)\n");
 }

 #-------------------------------------------------------------------------------Kp4CkwiP5J4oASJPVkzh57Hns1EgPHazpNaAKe6vzECGmtkj
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- /usr/local/bin/jabberd.orig Tue Aug 29 01:19:01 2006
+++ /usr/local/bin/jabberd      Tue Aug 29 11:57:21 2006
@@ -28,8 +28,7 @@
 my $Bin = "/usr/local/bin";
 my $VERSION = "2.0s11";
 my $config_dir = "/usr/local/etc/jabberd";
-my $config = $config_dir."/jabberd.cfg";
-$config = "internal" unless (-e $config);
+my $config = "jabberd.cfg";
 my $debug = 0;
 my $daemon = 0;
 my $select = IO::Select->new();
@@ -43,13 +42,20 @@
 # Process the command line arguments
 #-----------------------------------------------------------------------------
 my %opts;
-getopts("c:Dhb",\%opts);
+getopts("c:d:Dhb",\%opts);
 &usage if exists($opts{h});
 if (exists($opts{c}))
 {
     $config = $opts{c} if (defined($opts{c}) && ($opts{c} ne ""));
     &usage() if (!defined($opts{c}) || ($opts{c} eq ""));
 }
+if (exists($opts{d}))
+{
+    $config_dir = $opts{d} if (defined($opts{d}) && ($opts{d} ne ""));
+    &usage() if (!defined($opts{d}) || ($opts{d} eq ""));
+}
+$config = $config_dir.'/'.$config if ($config !~ /^\.?\//);
+$config = "internal" unless (-e $config);
How-To-Repeat: N/A
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-08-29 19:10:24 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Kirk Strauser 2006-08-29 21:04:12 UTC
On Tuesday 29 August 2006 1:10 pm, Edwin Groothuis wrote:
> Maintainer of net-im/jabberd,
>
> Please note that PR ports/102651 has just been submitted.
>
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
>
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/102651


I approve this patch, but think it should be submitted upstream as well.
-- 
Kirk Strauser
Comment 3 Aaron Gifford 2006-08-29 22:09:25 UTC
Oh, one tiny change.  The line in the patch that was:

+$config = $config_dir.'/'.$config if ($config !~ /^\.?\//);

Should instead read:

+$config = $config_dir.'/'.$config if ($config !~ /^\//);

That gets rid of the spurious \.? that I don't know why I included in
the first place.

As for submitting the patch upstream, whom would I contact to do that?

Hopefully gmail won't screw up the updated patch included in this
message too badly.

Aaron out.

--- /usr/local/bin/jabberd.orig Tue Aug 29 01:19:01 2006
+++ /usr/local/bin/jabberd      Tue Aug 29 15:02:41 2006
@@ -28,8 +28,7 @@
 my $Bin = "/usr/local/bin";
 my $VERSION = "2.0s11";
 my $config_dir = "/usr/local/etc/jabberd";
-my $config = $config_dir."/jabberd.cfg";
-$config = "internal" unless (-e $config);
+my $config = "jabberd.cfg";
 my $debug = 0;
 my $daemon = 0;
 my $select = IO::Select->new();
@@ -43,13 +42,20 @@
 # Process the command line arguments
 #-----------------------------------------------------------------------------
 my %opts;
-getopts("c:Dhb",\%opts);
+getopts("c:d:Dhb",\%opts);
 &usage if exists($opts{h});
 if (exists($opts{c}))
 {
     $config = $opts{c} if (defined($opts{c}) && ($opts{c} ne ""));
     &usage() if (!defined($opts{c}) || ($opts{c} eq ""));
 }
+if (exists($opts{d}))
+{
+    $config_dir = $opts{d} if (defined($opts{d}) && ($opts{d} ne ""));
+    &usage() if (!defined($opts{d}) || ($opts{d} eq ""));
+}
+$config = $config_dir.'/'.$config if ($config !~ /^\//);
+$config = "internal" unless (-e $config);

 $debug = 1 if exists($opts{D});
 $daemon = 1 if exists($opts{b});
@@ -123,6 +129,7 @@
     &debug("jabberd","stdout","debug on\n");
     &debug("jabberd","stdout","version($VERSION)\n");
     &debug("jabberd","stdout","config_dir($config_dir)\n");
+    &debug("jabberd","stdout","config($config)\n");
 }

 #-----------------------------------------------------------------------------
Comment 4 dfilter service freebsd_committer freebsd_triage 2006-10-07 15:35:17 UTC
pav         2006-10-07 14:35:12 UTC

  FreeBSD ports repository

  Modified files:
    net-im/jabberd       Makefile 
  Added files:
    net-im/jabberd/files patch-tools-jabberd.in 
  Log:
  - Add a command line option -d to specify configuration directory
  
  PR:             ports/102651
  Submitted by:   Aaron Gifford <astounding@gmail.com>
  Approved by:    Kirk Strauser <kirk@strauser.com> (maintainer)
  
  Revision  Changes    Path
  1.39      +1 -1      ports/net-im/jabberd/Makefile
  1.1       +42 -0     ports/net-im/jabberd/files/patch-tools-jabberd.in (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2006-10-07 15:35:20 UTC
State Changed
From-To: feedback->closed

Committed, thanks!