r19734 - in /trunk/pperl: Makefile.PL PPerl.pm debian/ debian/changelog debian/compat debian/control debian/copyright debian/rules main.c pass_fd.c pperl.h.header t/04args.t t/11autoclose.t t/env.plx

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Fri May 9 11:53:47 UTC 2008


Author: dmn
Date: Fri May  9 11:53:45 2008
New Revision: 19734

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=19734
Log:
[svn-inject] Applying Debian modifications to trunk

Added:
    trunk/pperl/debian/
    trunk/pperl/debian/changelog
    trunk/pperl/debian/compat
    trunk/pperl/debian/control
    trunk/pperl/debian/copyright
    trunk/pperl/debian/rules   (with props)
Modified:
    trunk/pperl/Makefile.PL
    trunk/pperl/PPerl.pm
    trunk/pperl/main.c
    trunk/pperl/pass_fd.c
    trunk/pperl/pperl.h.header
    trunk/pperl/t/04args.t
    trunk/pperl/t/11autoclose.t
    trunk/pperl/t/env.plx

Modified: trunk/pperl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/Makefile.PL?rev=19734&op=diff
==============================================================================
--- trunk/pperl/Makefile.PL (original)
+++ trunk/pperl/Makefile.PL Fri May  9 11:53:45 2008
@@ -1,4 +1,5 @@
 use ExtUtils::MakeMaker;
+use ExtUtils::Embed;
 use Config;
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
@@ -55,10 +56,16 @@
       (ABSTRACT_FROM => 'PPerl.pm', # retrieve abstract from module
        AUTHOR     => 'Matt Sergeant, matt at sergeant.org') : ()),
        DEFINE     => "-DVARIANT_$variant -DPERL_INTERP='\"$perl_path\"' -I.",
+       MAN1PODS   => { "PPerl.pm" => 'pperl.1p' },
+       MAN3PODS   => { },
 );
 
 
 sub MY::postamble {
+    my $ccopts = ccopts;
+    chomp $ccopts;
+    my $ldopts = ldopts;
+    chomp $ldopts;
     "
 # just hacking around
 $hacking
@@ -69,7 +76,7 @@
 main.o: Makefile main.c pperl.h
 
 pperl: main.o pass_fd.o
-\t\$(CC) \$(CFLAGS) \$(LDFLAGS) \$(DEFINE) -o pperl main.o pass_fd.o $Config{libs}
+\t\$(CC) \$(DEFINE) -o pperl main.o pass_fd.o $ldopts
 
 pass_fd.c: pass_fd.h
 

Modified: trunk/pperl/PPerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/PPerl.pm?rev=19734&op=diff
==============================================================================
--- trunk/pperl/PPerl.pm (original)
+++ trunk/pperl/PPerl.pm Fri May  9 11:53:45 2008
@@ -30,7 +30,7 @@
 
 This program turns ordinary perl scripts into long running daemons, making
 subsequent executions extremely fast. It forks several processes for each
-script, allowing many proceses to call the script at once.
+script, allowing many processes to call the script at once.
 
 It works a lot like SpeedyCGI, but is written a little differently. I didn't
 use the SpeedyCGI codebase, because I couldn't get it to compile, and needed
@@ -75,6 +75,13 @@
 Alternatively look for a .pid file for the script in your tmp directory, and
 kill (with SIGINT) the process with that PID.
 
+=head1 ENVIRONMENT
+
+B<pperl> uses the B<PPERL_TMP_PATH> environment variable to determine
+the directory where to store the files used for inter-process
+communication.  By default, the subdirectory I<.pperl> of the user's
+home directory is used.
+
 =head1 BUGS
 
 The process does not reload when the script or modules change.

Added: trunk/pperl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/debian/changelog?rev=19734&op=file
==============================================================================
--- trunk/pperl/debian/changelog (added)
+++ trunk/pperl/debian/changelog Fri May  9 11:53:45 2008
@@ -1,0 +1,47 @@
+pperl (0.25-5) unstable; urgency=medium
+
+  * Pass PPERL_TMP_PATH through the environment test, fixing build
+    failures on buildds without a writeable home directory.
+  * Urgency medium because #461439 is actually RC.
+
+ -- Florian Weimer <fw at deneb.enyo.de>  Sun, 27 Apr 2008 11:31:52 +0200
+
+pperl (0.25-4) unstable; urgency=low
+
+  * Acknowledge NMU.  Closes: #463559
+  * Fix file descriptor passing.  Closes: #461439
+  * Add PPERL_TMP_PATH environment variable.
+  * Run test suite at build time
+
+ -- Florian Weimer <fw at deneb.enyo.de>  Sun, 27 Apr 2008 10:49:34 +0200
+
+pperl (0.25-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Conditionally remove usr/share/perl5 (closes: #463559)
+
+ -- Stephen Gran <sgran at debian.org>  Sat, 05 Apr 2008 12:05:32 +0100
+
+pperl (0.25-3) unstable; urgency=medium
+
+  * Do not change umask when becoming a daemon.  Closes: #287119.
+    Added a regression test to t/11autoclose.t.
+
+ -- Florian Weimer <fw at deneb.enyo.de>  Fri, 24 Dec 2004 20:02:04 +0100
+
+pperl (0.25-2) unstable; urgency=low
+
+  * Adding libperl-dev build dependency.  Sorry.  Closes: #273231.
+
+ -- Florian Weimer <fw at deneb.enyo.de>  Fri, 24 Sep 2004 22:21:16 +0200
+
+pperl (0.25-1) unstable; urgency=low
+
+  * Initial Release. Closes: #270845.
+  * Some Makefile.PL surgery is required to get the correct linker flags,
+    and to install a pperl(1p) manpage.
+  * The control files are stored in ~/.pperl, not in /tmp.  (This closes a
+    local security hole.)
+
+ -- Florian Weimer <fw at deneb.enyo.de>  Thu,  9 Sep 2004 14:51:48 +0200
+

Added: trunk/pperl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/debian/compat?rev=19734&op=file
==============================================================================
--- trunk/pperl/debian/compat (added)
+++ trunk/pperl/debian/compat Fri May  9 11:53:45 2008
@@ -1,0 +1,1 @@
+4

Added: trunk/pperl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/debian/control?rev=19734&op=file
==============================================================================
--- trunk/pperl/debian/control (added)
+++ trunk/pperl/debian/control Fri May  9 11:53:45 2008
@@ -1,0 +1,15 @@
+Source: pperl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 4.0.2), perl (>= 5.8.4-2.2), libperl-dev
+Maintainer: Florian Weimer <fw at deneb.enyo.de>
+Standards-Version: 3.6.1
+
+Package: pperl
+Architecture: any
+Depends: ${perl:Depends}, ${shlibs:Depends}
+Description:  Make Perl scripts persistent in memory
+ This program turns ordinary Perl scripts into long running daemons,
+ making subsequent executions extremely fast.  It forks several
+ processes for each script, allowing many processes to call the script
+ at once.

Added: trunk/pperl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/debian/copyright?rev=19734&op=file
==============================================================================
--- trunk/pperl/debian/copyright (added)
+++ trunk/pperl/debian/copyright Fri May  9 11:53:45 2008
@@ -1,0 +1,19 @@
+This is the debian package for the PPerl Persistent Perl wrapper.
+It was created by Florian Weimer <fw at deneb.enyo.de>.
+
+The upstream author is: Matt Sergeant <matt at sergeant.org>
+
+The upstream copyright statement is:
+
+    COPYRIGHT AND LICENCE
+    
+    Copyright (C) 2001 MessageLabs Ltd. Written by Matt Sergeant.
+    
+    This is free software. You may use it and redistribute it under the
+    same terms as Perl itself.
+
+Perl is distributed under your choice of the GNU General Public License
+or the Artistic License.  On Debian GNU/Linux systems, the complete text
+of the GNU General Public License can be found in
+'/usr/share/common-licenses/GPL' and the Artistic Licence in
+'/usr/share/common-licenses/Artistic'.

Added: trunk/pperl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/debian/rules?rev=19734&op=file
==============================================================================
--- trunk/pperl/debian/rules (added)
+++ trunk/pperl/debian/rules Fri May  9 11:53:45 2008
@@ -1,0 +1,104 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+
+ifndef PERL
+PERL = /usr/bin/perl
+endif
+
+TMP     =$(CURDIR)/debian/$(PACKAGE)
+
+# Allow disabling build optimation by setting noopt in
+# $DEB_BUILD_OPTIONS
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+        CFLAGS += -O2
+endif
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add commands to compile the package here
+	$(PERL) Makefile.PL INSTALLDIRS=vendor
+	$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
+
+	mkdir -p sockets
+	PPERL_TMP_PATH=$(CURDIR)/sockets make test
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+
+	# Add commands to clean up after the build process here
+	-$(MAKE) realclean
+	-rm pperl.h pperl.1p
+	-rm -rf sockets
+
+	dh_clean build-stamp install-stamp
+
+install: install-stamp
+install-stamp:
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+
+	# Add here commands to install the package into debian/tmp.
+	#$(MAKE) test
+	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+	
+	# As this is a architecture dependent package, we are not supposed to install
+	# stuff to /usr/share/perl5. MakeMaker creates the dirs, we delete them from 
+	# the deb:
+	[ ! -d $(TMP)/usr/share/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/share/perl5
+
+	touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs README TODO
+	dh_installexamples 
+#	dh_installmenu
+#	dh_installcron
+	dh_installman pperl.1p
+	dh_installchangelogs Changes
+	dh_link
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	dh_strip
+endif
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_perl 
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+source diff:                                                                  
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary

Propchange: trunk/pperl/debian/rules
------------------------------------------------------------------------------
    svn:executable = *

Modified: trunk/pperl/main.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/main.c?rev=19734&op=diff
==============================================================================
--- trunk/pperl/main.c (original)
+++ trunk/pperl/main.c Fri May  9 11:53:45 2008
@@ -6,10 +6,12 @@
 #include <stdarg.h>
 #include <memory.h>
 #include <errno.h>
+#include <pwd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
@@ -45,6 +47,7 @@
 int prefork = 5;
 int maxclients = 100;
 int path_max;
+char* tmp_path;
 int no_cleanup = 0;
 FILE *log_fd = NULL;
 
@@ -68,11 +71,55 @@
     fflush(log_fd);
 }
 
+static void *my_malloc(size_t);
+
+/* Set tmp_path to a user-specific path for the pperl control files. */
+static void
+setup_tmp_path(void)
+{
+    uid_t me = getuid();
+    struct passwd *pw = getpwuid(me);
+
+    tmp_path = my_malloc(path_max);
+    if (pw) {
+        snprintf(tmp_path, path_max, "%s/.pperl", pw->pw_dir);
+        mkdir(tmp_path, 0700);  /* ignore failure */
+    } else {
+        snprintf(tmp_path, path_max, "%s/pperl.%u",
+                 P_tmpdir, (unsigned)pw->pw_uid);
+        if (mkdir(tmp_path, 0600) == -1) {
+            /* The directory already exists.  Check ownership and
+               permissions. */
+            struct stat buf;
+            if (lstat(tmp_path, &buf) == -1) {
+                fprintf(stderr, "could not stat %s: %s\n",
+                        tmp_path, strerror(errno));
+                exit(1);
+            }
+            if (!S_ISDIR(buf.st_mode)) {
+                fprintf(stderr, "%s: not a directory\n",
+                        tmp_path);
+                exit(1);
+            }
+            if (buf.st_uid != me) {
+                fprintf(stderr, "%s: wrong directory ownership\n",
+                        tmp_path);
+                exit(1);
+            }
+            if ((buf.st_mode & 0777) != 0700) {
+                fprintf(stderr, "%s: wrong directory mode\n",
+                        tmp_path);
+                exit(1);
+            }
+        }
+    }
+}
+
 
 int main( int argc, char **argv )
 {
     int i;
-    char *pArg;
+    char *pArg = 0;
     int pperl_section = 0;
     int return_code = 0;
 
@@ -87,6 +134,10 @@
         path_max = 4096;
     }
 #endif
+
+    tmp_path = getenv("PPERL_TMP_PATH");
+    if (!tmp_path)
+        setup_tmp_path();
 
     pperl_section = 0;
     for ( i = 1; i < argc; i++ ) {
@@ -230,10 +281,10 @@
     }
     Dx(Debug("realpath returned: %s\n", fullpath));
     /* Ugh. I am a terrible C programmer! */
-    sockname = my_malloc(strlen(P_tmpdir) + strlen(fullpath) + 3);
+    sockname = my_malloc(strlen(tmp_path) + strlen(fullpath) + 3);
     save = sockname;
-    sprintf(sockname, "%s/", P_tmpdir);
-    sockname += strlen(P_tmpdir) + 1;
+    sprintf(sockname, "%s/", tmp_path);
+    sockname += strlen(tmp_path) + 1;
     while (fullpath[i] != '\0') {
         if (fullpath[i] == '/') {
             *sockname = '_';
@@ -264,7 +315,6 @@
 static int DispatchCall( char *scriptname, int argc, char **argv )
 {
     register int i, sd, len;
-    int error_number;
     ssize_t readlen;
     struct sockaddr_un saun;
     struct stat stat_buf;
@@ -446,7 +496,7 @@
             goto cleanup;
         }
 
-        snprintf(temp_file, BUF_SIZE, "%s/%s", P_tmpdir, "pperlXXXXXX");
+        snprintf(temp_file, BUF_SIZE, "%s/%s", tmp_path, "pperlXXXXXX");
         tmp_fd = mkstemp(temp_file);
         if (tmp_fd == -1) {
             perror("pperl: Cannot create temporary file");

Modified: trunk/pperl/pass_fd.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/pass_fd.c?rev=19734&op=diff
==============================================================================
--- trunk/pperl/pass_fd.c (original)
+++ trunk/pperl/pass_fd.c Fri May  9 11:53:45 2008
@@ -1,165 +1,75 @@
-/* code lifted from Stevens' APUE */
+/* Code based on Stevens' UNIX Network Programming, and simplified. */
+/* Florian Weimer <fw at deneb.enyo.de>, April 2008 */
 
-#include	<errno.h>		/* for definition of errno */
-#include	<stdarg.h>		/* ANSI C header file */
+#include	<errno.h>
 #include	<sys/types.h>
 #include	<sys/socket.h>
-#include	<sys/uio.h>
-#include	<string.h>
 #include        <unistd.h>
 #include	"pass_fd.h"
-
-#if VARIANT_SVR4
 
 int
 s_pipe(int fd[2])
 {
-    return( pipe(fd) );
+  return socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
 }
-
-#elif defined(VARIANT_43BSD) || defined(VARIANT_44BSD)
-
-int
-s_pipe(int fd[2])
-{
-    return( socketpair(AF_UNIX, SOCK_STREAM, 0, fd) );
-}
-
-#else
-
-#error "Couldn't guess variant"
-
-#endif
-
-
-#if VARIANT_43BSD
 
 int
 send_fd(int clifd, int fd)
 {
-    struct iovec  iov[1];
-    struct msghdr msg;
-    char   buf[2];
+  union {
+    struct cmsghdr cm;
+    char control[CMSG_SPACE(sizeof(int))];
+  } control_aligned;
 
-    iov[0].iov_base = buf;
-    iov[0].iov_len  = 2;
-    msg.msg_iov     = iov;
-    msg.msg_iovlen  = 1;
-    msg.msg_name    = NULL;
-    msg.msg_namelen = 0;
+  struct msghdr msg = {0};
+  msg.msg_control = control_aligned.control;
+  msg.msg_controllen = sizeof(control_aligned.control);
 
-    if (fd < 0) {
-	msg.msg_accrights    = NULL;
-	msg.msg_accrightslen = 0;
-	buf[1] = -fd;
-	if (buf[1] == 0)
-	    buf[1] = 1;
-    } 
-    else {
-	msg.msg_accrights    = (caddr_t) &fd;
-	msg.msg_accrightslen = sizeof(int);
-	buf[1] = 0;
-    }
-    buf[0] = 0;
+  struct cmsghdr *cmptr = CMSG_FIRSTHDR(&msg);
+  cmptr->cmsg_len = CMSG_LEN(sizeof(int));
+  cmptr->cmsg_level = SOL_SOCKET;
+  cmptr->cmsg_type = SCM_RIGHTS;
+  *((int *) CMSG_DATA(cmptr)) = fd;
 
-    if (sendmsg(clifd, &msg, 0) != 2)
-	return(-1);
-    
-    return(0);
+  char buf[1] = {0};
+  struct iovec iov = {.iov_base = buf, .iov_len = sizeof(buf)};
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+
+  if (sendmsg(clifd, &msg, 0) != 1)
+    return -1;
+  return 0;
 }
 
 int
 recv_fd(int servfd)
 {
-    int newfd, nread, status;
-    char *ptr, buf[2];
-    struct iovec  iov[1];
-    struct msghdr msg;
+  union {
+    struct cmsghdr cm;
+    char control[CMSG_SPACE(sizeof(int))];
+  } control_aligned;
 
-    iov[0].iov_base = buf;
-    iov[0].iov_len  = 2;
-    msg.msg_iov     = iov;
-    msg.msg_iovlen  = 1;
-    msg.msg_name    = NULL;
-    msg.msg_namelen = 0;
-    msg.msg_accrights = (caddr_t) &newfd;
-    msg.msg_accrightslen = sizeof(int);
-    
-    if ( (nread = recvmsg(servfd, &msg, 0)) <= 0)
-	return(-1);
-    
-    return(newfd);/* descriptor, or -status */
+  struct msghdr msg = {0};
+  msg.msg_control = control_aligned.control;
+  msg.msg_controllen = sizeof(control_aligned.control);
+
+  char buf[1] = {0};
+  struct iovec iov = {.iov_base = buf, .iov_len = sizeof(buf)};
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+
+  ssize_t result = recvmsg(servfd, &msg, 0);
+  if (result < 0)
+    return -1;
+  if (result != 1) {
+    errno = EINVAL;
+    return -1;
+  }
+
+  struct cmsghdr *cmptr = CMSG_FIRSTHDR(&msg);
+  if (cmptr && cmptr->cmsg_len == CMSG_LEN(sizeof(int))
+      && cmptr->cmsg_level == SOL_SOCKET && cmptr->cmsg_type == SCM_RIGHTS)
+    return *((int *) CMSG_DATA(cmptr));
+  errno = ENXIO;
+  return -1;
 }
-
-#else 
-
-struct cmessage {
-    struct cmsghdr cmsg;
-    int fd;
-};
-
-int
-send_fd(int over, int this)
-{
-    struct iovec iov[1];
-    struct msghdr msg;
-    struct cmessage cm;
-    char sendbuf[] = "";
-
-    iov[0].iov_base = (char *)&sendbuf;
-    iov[0].iov_len = sizeof(sendbuf);
-    
-    cm.cmsg.cmsg_type  = SCM_RIGHTS;
-    cm.cmsg.cmsg_level = SOL_SOCKET;
-    cm.cmsg.cmsg_len = sizeof(struct cmessage);
-    cm.fd = this;
-
-    msg.msg_iov = iov;
-    msg.msg_iovlen = 1;
-    msg.msg_name = NULL;
-    msg.msg_namelen = 0;
-    msg.msg_control = (caddr_t)&cm;
-    msg.msg_controllen = sizeof(struct cmessage);
-    msg.msg_flags = 0;
-
-    if (sendmsg(over, &msg, 0) < 0)
-	return -1;
-    return 0;
-}
-
-int 
-recv_fd(int over)
-{
-    struct iovec iov[1];
-    struct msghdr msg;
-    struct cmessage cm;
-    ssize_t got;
-    char recbuf;
-
-    /* in examples this was >1 but this causes too much to be read,
-     * causing sync issues */
-
-    iov[0].iov_base = &recbuf;
-    iov[0].iov_len = 1;
-
-    bzero((char *)&cm, sizeof(cm));
-    bzero((char *)&msg, sizeof(msg));
-
-    msg.msg_iov = iov;
-    msg.msg_iovlen = 1;
-    msg.msg_name = NULL;
-    msg.msg_namelen = 0;
-    msg.msg_control = (caddr_t)&cm;
-    msg.msg_controllen = sizeof(struct cmessage);
-    msg.msg_flags = 0;
-
-    if ((got = recvmsg(over, &msg, 0)) < 0)
-	return -1;
-
-    if (cm.cmsg.cmsg_type != SCM_RIGHTS)
-	return -1;
-
-    return cm.fd;
-}
-
-#endif

Modified: trunk/pperl/pperl.h.header
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/pperl.h.header?rev=19734&op=diff
==============================================================================
--- trunk/pperl/pperl.h.header (original)
+++ trunk/pperl/pperl.h.header Fri May  9 11:53:45 2008
@@ -188,7 +188,6 @@
   open(STDOUT,">/dev/null");
   open(STDERR, '>&STDOUT');
   chdir '/';           # change working directory
-  umask(0);            # forget file mode creation mask
   $ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin';
   delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
   $SIG{CHLD} = \&reap_child;
@@ -261,9 +260,11 @@
 
 # $SIG{INT} = $SIG{TERM} = sub { $DONE++ };
 
-$PPERL::SOCKET_NAME =~ m~^([a-z0-9/_-]+)$~i
+$PPERL::SOCKET_NAME =~ m~^(/.*)$~
   or die "unclean socket name '$PPERL::SOCKET_NAME'";
 $PPERL::SOCKET_NAME = $1;
+$PPERL::SOCKET_NAME =~ m~/\.\.(?:/|$)~
+  and die "unclean socket name '$PPERL::SOCKET_NAME'";
 if (-e $PPERL::SOCKET_NAME) {
   if (-e "${PPERL::SOCKET_NAME}.pid") {
     die "socket and pid file both exist - possible error state. Delete both and retry";

Modified: trunk/pperl/t/04args.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/t/04args.t?rev=19734&op=diff
==============================================================================
--- trunk/pperl/t/04args.t (original)
+++ trunk/pperl/t/04args.t Fri May  9 11:53:45 2008
@@ -17,9 +17,11 @@
 
 `./pperl t/env.plx`; # run it once so there's a $ENV{PATH} about
 
+my $tmp_path = $ENV{PPERL_TMP_PATH};
 %ENV = ( foo       => "bar\nbaz",
          "quu\nx"  => "wobble",
          null      => '');
+$ENV{PPERL_TMP_PATH} = $tmp_path if $tmp_path;
 
 ok(capture($^X, 't/env.plx'),
   qq{'foo' => 'bar\nbaz'\n'null' => ''\n'quu\nx' => 'wobble'\n});

Modified: trunk/pperl/t/11autoclose.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/t/11autoclose.t?rev=19734&op=diff
==============================================================================
--- trunk/pperl/t/11autoclose.t (original)
+++ trunk/pperl/t/11autoclose.t Fri May  9 11:53:45 2008
@@ -1,16 +1,26 @@
 #!perl -w
 use Test;
-BEGIN { plan tests => 4 }
+use Fcntl ':mode';
+BEGIN { plan tests => 6 }
 
 `./pperl --prefork=1 t/autoclose.plx`;
 
 my $file = "foo.$$";
 my $foo;
 
+# Regression test for Debian bug #287119.
+sub check_perm () {
+    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+	$atime,$mtime,$ctime,$blksize,$blocks)
+	= stat($file);
+    ok(S_IMODE($mode), 0644);
+}
+
 `$^X t/autoclose.plx $file foo`;
 ok(`$^X t/cat.plx $file`, "foo\n");
 `$^X t/autoclose.plx $file bar`;
 ok(`$^X t/cat.plx $file`, "foo\nbar\n");
+check_perm;
 
 unlink $file;
 
@@ -18,6 +28,7 @@
 ok(`$^X t/cat.plx $file`, "foo\n");
 `./pperl t/autoclose.plx $file bar`;
 ok(`$^X t/cat.plx $file`, "foo\nbar\n");
+check_perm;
 
 `./pperl -k t/autoclose.plx`;
 `./pperl -k t/cat.plx`;

Modified: trunk/pperl/t/env.plx
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/pperl/t/env.plx?rev=19734&op=diff
==============================================================================
--- trunk/pperl/t/env.plx (original)
+++ trunk/pperl/t/env.plx Fri May  9 11:53:45 2008
@@ -1,3 +1,3 @@
 #!perl -w
 use strict;
-print map { "'$_' => '$ENV{$_}'\n" } sort keys %ENV;
+print map { "'$_' => '$ENV{$_}'\n" } sort grep { $_ ne 'PPERL_TMP_PATH' } keys %ENV;




More information about the Pkg-perl-cvs-commits mailing list