r77622 - in /branches/upstream/libapp-daemon-perl/current: Changes Daemon.pm META.yml README
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Wed Jul 20 07:48:27 UTC 2011
Author: carnil
Date: Wed Jul 20 07:48:24 2011
New Revision: 77622
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=77622
Log:
[svn-upgrade] new version libapp-daemon-perl (0.13)
Modified:
branches/upstream/libapp-daemon-perl/current/Changes
branches/upstream/libapp-daemon-perl/current/Daemon.pm
branches/upstream/libapp-daemon-perl/current/META.yml
branches/upstream/libapp-daemon-perl/current/README
Modified: branches/upstream/libapp-daemon-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-daemon-perl/current/Changes?rev=77622&op=diff
==============================================================================
--- branches/upstream/libapp-daemon-perl/current/Changes (original)
+++ branches/upstream/libapp-daemon-perl/current/Changes Wed Jul 20 07:48:24 2011
@@ -1,4 +1,10 @@
Revision history for Perl extension App::Daemon.
+
+0.13 (07/19/2011)
+ (ms) [rt.cpan.org #69561] default log and pid files are now in the
+ current directory, not in /tmp by default because of security
+ concerns.
+ (ms) [rt.cpan.org #69561] not setting umask anymore
0.12 (07/18/2011)
(ms) 'status' now doesn't write to the logfile (suggested by Brian Pitts)
Modified: branches/upstream/libapp-daemon-perl/current/Daemon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-daemon-perl/current/Daemon.pm?rev=77622&op=diff
==============================================================================
--- branches/upstream/libapp-daemon-perl/current/Daemon.pm (original)
+++ branches/upstream/libapp-daemon-perl/current/Daemon.pm Wed Jul 20 07:48:24 2011
@@ -2,7 +2,7 @@
use strict;
use warnings;
-our $VERSION = '0.12';
+our $VERSION = '0.13';
use Getopt::Std;
use Pod::Usage;
@@ -24,10 +24,13 @@
use constant ALREADY_RUNNING => 150;
our ($pidfile, $logfile, $l4p_conf, $as_user, $background,
- $loglevel, $action, $appname);
+ $loglevel, $action, $appname, $default_pid_dir, $default_log_dir);
$action = "";
$appname = appname();
+$default_pid_dir = ".";
+$default_log_dir = ".";
+
our $kill_retries = 3;
our $kill_sig = SIGTERM; # maps to 15 via POSIX.pm
@@ -43,14 +46,14 @@
$pidfile = $_pidfile;
}
else {
- $pidfile ||= ( '/tmp/' . $appname . ".pid" );
+ $pidfile ||= ( "$default_pid_dir/" . $appname . ".pid" );
}
if(my $_logfile = find_option('-l', 1)) {
$logfile = $_logfile;
}
else {
- $logfile ||= ( '/tmp/' . $appname . ".log" );
+ $logfile ||= ( "$default_log_dir/" . $appname . ".log" );
}
if(my $_l4p_conf = find_option('-l4p', 1)) {
@@ -100,6 +103,8 @@
log4perl.appender.FileApp = Log::Log4perl::Appender::File
log4perl.appender.FileApp.filename = $logfile
log4perl.appender.FileApp.owner = $as_user
+ # this umask is only temporary
+ log4perl.appender.FileApp.umask = 0133
log4perl.appender.FileApp.layout = PatternLayout
log4perl.appender.FileApp.layout.ConversionPattern = %d %m%n
});
@@ -190,7 +195,8 @@
###########################################
my($as_user) = @_;
- umask(0);
+ # newly created files have rw-r--r-- permissions by default
+ umask(0133);
# Make sure the child isn't killed when the user closes the
# terminal session before the child detaches from the tty.
@@ -366,7 +372,8 @@
###########################################
my($pid) = @_;
- open FILE, "+>$pidfile" or LOGDIE "Cannot open pidfile $pidfile";
+ sysopen FILE, $pidfile, O_RDWR|O_CREAT, 0644 or
+ LOGDIE "Cannot open pidfile $pidfile";
flock FILE, LOCK_EX;
seek(FILE, 0, 0);
print FILE "$pid\n";
@@ -470,7 +477,7 @@
and which PID it has:
./my-app status
- Pid file: /tmp/tt.pid
+ Pid file: ./tt.pid
Pid in file: 14914
Running: no
Name match: 0
@@ -489,9 +496,18 @@
default action,
$ ./my-app
+ $
-will also run the 'start' action. If the -X option is given, the program
-is run in foreground mode for testing purposes.
+will also run the 'start' action. By default, it will create a pid file
+and a log file in the current directory
+(named C<my-app.pid> and C<my-app.log>. To change these locations, see
+the C<-l> and C<-p> options.
+
+If the -X option is given, the program
+is running in foreground mode for testing purposes:
+
+ $ ./my-app -X
+ ...
=item stop
@@ -510,9 +526,9 @@
=item status
will print out diagnostics on what the status of the daemon is. Typically,
-the output look like this:
-
- Pid file: /tmp/tt.pid
+the output looks like this:
+
+ Pid file: ./tt.pid
Pid in file: 15562
Running: yes
Name match: 1
@@ -532,7 +548,7 @@
If the process is no longer running, the status output might look like
this instead:
- Pid file: /tmp/tt.pid
+ Pid file: ./tt.pid
Pid in file: 14914
Running: no
Name match: 0
@@ -570,7 +586,9 @@
=item -l logfile
Logfile to send Log4perl messages to in background mode. Defaults
-to C</tmp/[appname].log>.
+to C<./[appname].log>. Note that having a logfile in the current directory
+doesn't make sense except for testing environments, make sure to set this
+to somewhere within C</var/log> for production use.
=item -u as_user
@@ -584,7 +602,11 @@
=item -p pidfile
Where to save the pid of the started process.
-Defaults to C</tmp/[appname].pid>.
+Defaults to C<./[appname].pid>.
+Note that
+having a pidfile in the current directory
+doesn't make sense except for testing environments, make sure to set this
+to somewhere within C</var/run> for production use.
=item -v
@@ -677,16 +699,6 @@
2011, Mike Schilli <cpan at perlmeister.com>
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (C) 2008 by Mike Schilli
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.8.5 or,
-at your option, any later version of Perl 5 you may have available.
-
-=cut
-
=head1 LICENSE
Copyright 2011 by Mike Schilli, all rights reserved.
Modified: branches/upstream/libapp-daemon-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-daemon-perl/current/META.yml?rev=77622&op=diff
==============================================================================
--- branches/upstream/libapp-daemon-perl/current/META.yml (original)
+++ branches/upstream/libapp-daemon-perl/current/META.yml Wed Jul 20 07:48:24 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: App-Daemon
-version: 0.12
+version: 0.13
abstract: Start an Application as a Daemon
author:
- Mike Schilli <m at perlmeister.com>
@@ -26,7 +26,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.56
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: branches/upstream/libapp-daemon-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-daemon-perl/current/README?rev=77622&op=diff
==============================================================================
--- branches/upstream/libapp-daemon-perl/current/README (original)
+++ branches/upstream/libapp-daemon-perl/current/README Wed Jul 20 07:48:24 2011
@@ -1,5 +1,5 @@
######################################################################
- App::Daemon 0.12
+ App::Daemon 0.13
######################################################################
NAME
@@ -55,7 +55,7 @@
and which PID it has:
./my-app status
- Pid file: /tmp/tt.pid
+ Pid file: ./tt.pid
Pid in file: 14914
Running: no
Name match: 0
@@ -68,9 +68,18 @@
default action,
$ ./my-app
-
- will also run the 'start' action. If the -X option is given, the
- program is run in foreground mode for testing purposes.
+ $
+
+ will also run the 'start' action. By default, it will create a pid
+ file and a log file in the current directory (named "my-app.pid" and
+ "my-app.log". To change these locations, see the "-l" and "-p"
+ options.
+
+ If the -X option is given, the program is running in foreground mode
+ for testing purposes:
+
+ $ ./my-app -X
+ ...
stop
will find the daemon's PID in the pidfile and send it a SIGTERM
@@ -88,9 +97,9 @@
status
will print out diagnostics on what the status of the daemon is.
- Typically, the output look like this:
-
- Pid file: /tmp/tt.pid
+ Typically, the output looks like this:
+
+ Pid file: ./tt.pid
Pid in file: 15562
Running: yes
Name match: 1
@@ -110,7 +119,7 @@
If the process is no longer running, the status output might look
like this instead:
- Pid file: /tmp/tt.pid
+ Pid file: ./tt.pid
Pid in file: 14914
Running: no
Name match: 0
@@ -140,7 +149,9 @@
-l logfile
Logfile to send Log4perl messages to in background mode. Defaults to
- "/tmp/[appname].log".
+ "./[appname].log". Note that having a logfile in the current
+ directory doesn't make sense except for testing environments, make
+ sure to set this to somewhere within "/var/log" for production use.
-u as_user
User to run as if started as root. Defaults to 'nobody'.
@@ -151,7 +162,9 @@
-p pidfile
Where to save the pid of the started process. Defaults to
- "/tmp/[appname].pid".
+ "./[appname].pid". Note that having a pidfile in the current
+ directory doesn't make sense except for testing environments, make
+ sure to set this to somewhere within "/var/run" for production use.
-v Increase default Log4perl verbosity from $INFO to $DEBUG. Note that
this option will be ignored if Log4perl is initialized independently
@@ -234,13 +247,6 @@
AUTHOR
2011, Mike Schilli <cpan at perlmeister.com>
-
-COPYRIGHT AND LICENSE
- Copyright (C) 2008 by Mike Schilli
-
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself, either Perl version 5.8.5 or, at
- your option, any later version of Perl 5 you may have available.
LICENSE
Copyright 2011 by Mike Schilli, all rights reserved. This program is
More information about the Pkg-perl-cvs-commits
mailing list