r5772 - in /packages/libapache-session-perl/trunk: ./ Session/Generate/ Session/Lock/ Session/Store/ debian/ t/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sat Jul 14 19:34:01 UTC 2007


Author: gregoa-guest
Date: Sat Jul 14 19:34:01 2007
New Revision: 5772

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=5772
Log:
* New upstream release.

Added:
    packages/libapache-session-perl/trunk/Contributing.txt
      - copied unchanged from r5771, packages/libapache-session-perl/branches/upstream/current/Contributing.txt
Modified:
    packages/libapache-session-perl/trunk/CHANGES
    packages/libapache-session-perl/trunk/MANIFEST
    packages/libapache-session-perl/trunk/META.yml
    packages/libapache-session-perl/trunk/Makefile.PL
    packages/libapache-session-perl/trunk/Session.pm
    packages/libapache-session-perl/trunk/Session/Generate/ModUniqueId.pm
    packages/libapache-session-perl/trunk/Session/Generate/ModUsertrack.pm
    packages/libapache-session-perl/trunk/Session/Lock/File.pm
    packages/libapache-session-perl/trunk/Session/Lock/Semaphore.pm
    packages/libapache-session-perl/trunk/Session/Store/DB_File.pm
    packages/libapache-session-perl/trunk/Session/Store/File.pm
    packages/libapache-session-perl/trunk/debian/changelog
    packages/libapache-session-perl/trunk/t/99dbfile.t
    packages/libapache-session-perl/trunk/t/99dbfilestore.t
    packages/libapache-session-perl/trunk/t/99filelock.t
    packages/libapache-session-perl/trunk/t/99flex.t
    packages/libapache-session-perl/trunk/t/99nulllock.t
    packages/libapache-session-perl/trunk/t/99semaphore.t

Modified: packages/libapache-session-perl/trunk/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/CHANGES?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/CHANGES (original)
+++ packages/libapache-session-perl/trunk/CHANGES Sat Jul 14 19:34:01 2007
@@ -1,13 +1,51 @@
-1.82   2007-02-21 by Alexandr Ciornii (alexchorny AT gmail.com)
+1.83=1.82_05  2007-05-25
+1.82_05   2007-05-14 by Alexandr Ciornii (alexchorny AT gmail.com)
+  - skipping part of 99flex.t on NetBSD
+
+1.82_04   2007-04-27 by Alexandr Ciornii (alexchorny AT gmail.com)
+  - More diagnostics in Apache::Session::Lock::Semaphore::acquire_write_lock,
+    acquire_read_lock
+  - Did not increment modules versions in previous versions of distribution
+  - Apache::Session::Lock::Semaphore can work with private semaphore
+  - 99flex.t will use private semaphore
+  - 99dbfile.t, 99dbfilestore.t - added undef (for RT#6216)
+
+1.82_03   2007-03-12 by Alexandr Ciornii (alexchorny AT gmail.com)
+  - Apache::Session::Lock::File checks flock success (RT#6936)
+  - Apache::Session::Lock::File will not change to shared lock if write
+    lock is in effect and read lock is requested (RT#7072)
+  - 99dbfile.t, 99dbfilestore.t - added untie (for RT#6216)
+  - Apache::Session::Lock::Semaphore will check for $Config{d_semget} and
+    cygserver
+
+1.82_02   2007-03-11 by Alexandr Ciornii
+  - 99semaphore.t, 99flex.t will be skipped if $Config{d_semget}==undef,
+    patch by Slaven Rezic
+  - Removed redundant code in 99filelock.t
+  - Removed unnecessary skip in 99nulllock.t
+  - Added file 'Contributing.txt'
+  - Apache::Session - mention CGI::Session
+  - Request in Makefile.PL
+
+1.82_01   2007-03-10 by Alexandr Ciornii
+  - Applied part of patch of SREZIC (Slaven Rezic), RT#3670,
+    more diagnostics on failing file operations (Apache::Session::Lock::File,
+    Apache::Session::Store::DB_File, Apache::Session::Store::File)
+  - RT#1251, ModUniqueId.pm, ModUsertrack.pm - small error in Carp usage,
+    by Slaven Rezic
+  - 99flex.t will be skipped on perls earlier than 5.8 (RT#16539)
+  - Requires Storable (core from 5.7.3), as it is almost useless without it
+
+1.82   2007-02-21 by Alexandr Ciornii
   - Slightly faster test skip
   - 99semaphore.t and 99flex.t check for cygserver on Cygwin
   - 99flex.t skips less tests in some cases
   - 99flex.t checks for Digest::MD5, MIME::Base64
-  - Warning in Apache::Session::Lock::Semaphore about cygserver
-  - Makefile.PL requires File::Temp
-  - changed order of use/chdir in tests (RT#16539, from Andrew Benham)
+  - Warning in doc of Apache::Session::Lock::Semaphore about cygserver
+  - Requires File::Temp (core from 5.6.1), needed for tests and work
+  - Changed order of use/chdir in tests (RT#16539, from Andrew Benham)
 
-1.81_01    2007-02-12 by Alexandr Ciornii
+1.81_01   2007-02-12 by Alexandr Ciornii
   - My patch for Win32 and Cygwin (RT#18795)
   - More information in Makefile.PL
   - 99flex.t checks for Storable (RT#101)
@@ -22,7 +60,7 @@
 
   - Bug fix to stop death in Apache::Session::Lock::Semaphore.
 
-1.70_01    2004-09-01
+1.70_01   2004-09-01
 
   - Casey West takes the pumpkin.
   - Complete rewrite of test suite to use Test::* modules.
@@ -35,18 +73,18 @@
 Fixed file age test for clean().  The previous test was never true.
 
 Applied patch to add TableName option to the DBI/MySQL store.  
-From Corris Randall <corris at line6.net>.  Tests added by jwb.
+From Corris Randall <corris AT line6.net>.  Tests added by jwb.
 
-Applied patch from Oliver Maul <oliver.maul at ixos.de> for better Sybase support,
+Applied patch from Oliver Maul <oliver.maul AT ixos.de> for better Sybase support,
 without tests.
 
-Informix support from Mike Langen <mike.langen at tamedia.ch>.  Unfortunately no
+Informix support from Mike Langen <mike.langen AT tamedia.ch>.  Unfortunately no
 tests were included.
 
 Changes in 1.54 (2001-10-11):
 
 Added mod_uniqueid and mod_usertrack generators from 
-Tatsuhiko Miyagawa <miyagawa at bulknews.net>
+Tatsuhiko Miyagawa <miyagawa AT bulknews.net>
 
 Fixed validate function in Flex.
 
@@ -56,26 +94,26 @@
 
 ?
 
-Changes in 1.52:
+Changes in 1.52 (2000-07-23):
 
-Chris Winters <cwinters at intes.net> added the Sybase backing store and 
+Chris Winters <cwinters AT intes.net> added the Sybase backing store and 
 related modules.  
 
-Michael Schout <mschout at gkg.net> fixed a commit policy bug in 1.51.
+Michael Schout <mschout AT gkg.net> fixed a commit policy bug in 1.51.
 
-Edward Lopez <zed at apricot.com> fixed a thinko in the POD.
+Edward Lopez <zed AT apricot.com> fixed a thinko in the POD.
 
-Peter Baker <Peter at eBluegrass.com> fixed a typo in the POD.
+Peter Baker <Peter AT eBluegrass.com> fixed a typo in the POD.
 
-Andrew Wild <andrew at eservers.com.au> fixed a typo in the POD.
+Andrew Wild <andrew AT eservers.com.au> fixed a typo in the POD.
 
-Alan Sparks <asparks at cpd.harris.com> fixed a type in the POD.
+Alan Sparks <asparks AT cpd.harris.com> fixed a type in the POD.
 
-Jay Lawrence <jlawrenc at infonium.com> changed the interface so that an undefined
+Jay Lawrence <jlawrenc AT infonium.com> changed the interface so that an undefined
 or false variable indicates a fresh session.  Previously, only undefined was
 considered new.
 
-Lupe Christoph <lupe at lupe-christoph.de> noticed that there was a buffer
+Lupe Christoph <lupe AT lupe-christoph.de> noticed that there was a buffer
 race condition in the file store, which is now fixed.
 
 

Modified: packages/libapache-session-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/MANIFEST?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/MANIFEST (original)
+++ packages/libapache-session-perl/trunk/MANIFEST Sat Jul 14 19:34:01 2007
@@ -1,3 +1,4 @@
+Contributing.txt
 b/dbi.b
 b/dbinew.b
 b/dbipop.b

Modified: packages/libapache-session-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/META.yml?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/META.yml (original)
+++ packages/libapache-session-perl/trunk/META.yml Sat Jul 14 19:34:01 2007
@@ -1,12 +1,13 @@
 --- #YAML:1.0
 name:                Apache-Session
-version:             1.82
+version:             1.83
 abstract:            A persistence framework for session data
 license:             perl
-generated_by:        ExtUtils::MakeMaker version 6.31
+generated_by:        ExtUtils::MakeMaker version 6.32
 distribution_type:   module
 requires:     
     File::Temp:                    0
+    Storable:                      0.6
     Test::Deep:                    0.082
     Test::Exception:               0.15
     Test::More:                    0.47

Modified: packages/libapache-session-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Makefile.PL?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Makefile.PL (original)
+++ packages/libapache-session-perl/trunk/Makefile.PL Sat Jul 14 19:34:01 2007
@@ -1,4 +1,13 @@
+use 5.002; #Symbol.pm
 use ExtUtils::MakeMaker;
+
+print << 'EOT';
+
+*** REQUEST ***
+Please use Test::Reporter to report test results - it's the only way to measure
+popularity of distribution.
+
+EOT
 
 WriteMakefile(
     NAME         => "Apache::Session",
@@ -10,6 +19,10 @@
                      'Test::Deep'      => '0.082',
                      'Test::Exception' => '0.15',
                      'File::Temp'      => 0, #core from 5.6.1
+                     'Storable'        => '0.6', #Will be raised later
+#                     'MIME::Base64'    => 0, #test
+#                     'DB_File'         => 0, #test
+#                     'Digest::MD5'     => 0, #test
                     },
     AUTHOR          => 'Casey West <casey[at]geeknest.com>',
     ABSTRACT        => 'A persistence framework for session data',

Modified: packages/libapache-session-perl/trunk/Session.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session.pm (original)
+++ packages/libapache-session-perl/trunk/Session.pm Sat Jul 14 19:34:01 2007
@@ -249,6 +249,9 @@
 The O Reilly book "Apache Modules in Perl and C", by Doug MacEachern and
 Lincoln Stein, has a chapter on keeping state.
 
+CGI::Session uses OO interface to do same thing. It is better maintained,
+but less possibilies.
+
 =head1 AUTHORS
 
 Jeffrey Baker <jwbaker at acm.org> is the author of 
@@ -312,7 +315,8 @@
 use strict;
 use vars qw($VERSION);
 
-$VERSION = '1.82';
+$VERSION = '1.83';
+$VERSION = eval $VERSION;
 
 #State constants
 #
@@ -497,7 +501,7 @@
     &{$self->{unserialize}}($self);
     
     $self->{status} &= ($self->{status} ^ MODIFIED);
-    $self->{status} |= SYNCED
+    $self->{status} |= SYNCED;
 }
 
 sub save {

Modified: packages/libapache-session-perl/trunk/Session/Generate/ModUniqueId.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Generate/ModUniqueId.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Generate/ModUniqueId.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Generate/ModUniqueId.pm Sat Jul 14 19:34:01 2007
@@ -2,13 +2,13 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.01';
+$VERSION = '0.02';
 
 sub generate {
     my $session = shift;
     unless (exists $ENV{UNIQUE_ID}) {
 	require Carp;
-	Carp::croak 'Can\'t get UNIQUE_ID env variable. Make sure mod_unique_id is enabled.';
+	Carp::croak('Can\'t get UNIQUE_ID env variable. Make sure mod_unique_id is enabled.');
     }
     $session->{data}->{_session_id} = $ENV{UNIQUE_ID};
 }

Modified: packages/libapache-session-perl/trunk/Session/Generate/ModUsertrack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Generate/ModUsertrack.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Generate/ModUsertrack.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Generate/ModUsertrack.pm Sat Jul 14 19:34:01 2007
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.01';
+$VERSION = '0.02';
 
 use CGI::Cookie;
 use constant MOD_PERL => exists $ENV{MOD_PERL};
@@ -23,7 +23,7 @@
     unless ($cookies{$name}) {
 	# still bad luck
 	require Carp;
-	Carp::croak 'no cookie found. Make sure mod_usertrack is enabled.';
+	Carp::croak('no cookie found. Make sure mod_usertrack is enabled.');
     }
     $session->{data}->{_session_id} = $cookies{$name}->value;
 }

Modified: packages/libapache-session-perl/trunk/Session/Lock/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Lock/File.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Lock/File.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Lock/File.pm Sat Jul 14 19:34:01 2007
@@ -15,7 +15,7 @@
 use Symbol;
 use vars qw($VERSION);
 
-$VERSION = '1.03';
+$VERSION = '1.04';
 
 $Apache::Session::Lock::File::LockDirectory = '/tmp';
 
@@ -52,7 +52,11 @@
         $self->{opened} = 1;
     }
         
-    flock($self->{fh}, LOCK_SH);
+    if (!$self->{write}) {
+     #acquiring read lock, when write lock is in effect will clear write lock
+     flock($self->{fh}, LOCK_SH) || die "Cannot lock: $!";
+    }
+
     $self->{read} = 1;
 }
 
@@ -74,7 +78,7 @@
         $self->{opened} = 1;
     }
     
-    flock($self->{fh}, LOCK_EX);    
+    flock($self->{fh}, LOCK_EX) || die "Cannot lock: $!";
     $self->{write} = 1;
 }
 
@@ -85,11 +89,11 @@
     my $self    = shift;
     my $session = shift;
     
-    die unless $self->{read};
+    die "No read lock to release in release_read_lock" unless $self->{read};
     
     if (!$self->{write}) {
-        flock($self->{fh}, LOCK_UN);
-        close $self->{fh} || die $!;
+        flock($self->{fh}, LOCK_UN) || die "Cannot unlock: $!";
+        close $self->{fh} || die "Could no close file: $!";
         $self->{opened} = 0;
     }
     
@@ -100,14 +104,14 @@
     my $self    = shift;
     my $session = shift;
     
-    die unless $self->{write};
+    die "No write lock acquired" unless $self->{write};
     
     if ($self->{read}) {
-        flock($self->{fh}, LOCK_SH);
+        flock($self->{fh}, LOCK_SH) || die "Cannot lock: $!";
     }
     else {
-        flock($self->{fh}, LOCK_UN);
-        close $self->{fh} || die $!;
+        flock($self->{fh}, LOCK_UN) || die "Cannot unlock: $!";
+        close $self->{fh} || die "Could not close file: $!";
         $self->{opened} = 0;
     }
     
@@ -119,8 +123,8 @@
     my $session = shift;
 
     if ($self->{opened}) {
-        flock($self->{fh}, LOCK_UN);
-        close $self->{fh} || die $!;
+        flock($self->{fh}, LOCK_UN) || die "Cannot unlock: $!";
+        close $self->{fh} || die "Could not close file: $!";
     }
     
     $self->{opened} = 0;
@@ -141,13 +145,13 @@
 
     my $now = time();
     
-    opendir(DIR, $dir) || die $!;
+    opendir(DIR, $dir) || die "Could not open directory $dir: $!";
     my @files = readdir(DIR);
     foreach my $file (@files) {
         if ($file =~ /^Apache-Session.*\.lock$/) {
             if ($now - (stat($dir.'/'.$file))[8] >= $time) {
               if ($^O eq 'MSWin32') {
-                #Windows cannot unlink opened file
+                #Windows cannot unlink open file
                 unlink($dir.'/'.$file) || next;
               } else {
                 open(FH, "+>$dir/".$file) || next;
@@ -158,7 +162,8 @@
               }
             }
         }
-    }       
+    }
+    closedir(DIR);
 }
 
 1;
@@ -202,6 +207,8 @@
 
 =head1 NOTES
 
+=head2 clean
+
 This module does not unlink temporary files, because it interferes with proper
 locking.  This can cause problems on certain systems (Linux) whose file systems
 (ext2) do not perform well with lots of files in one directory.  To prevent this
@@ -214,6 +221,14 @@
  my $l = new Apache::Session::Lock::File;
  $l->clean('/var/lock/sessions', 3600) #remove files older than 1 hour
 
+=head2 acquire_read_lock
+
+Will do nothing if write lock is in effect, only set readlock flag to true.
+
+=head2 release_read_lock
+
+Will do nothing if write lock is in effect, only set readlock flag to false.
+
 =head2 Win32 and Cygwin
 
 Windows cannot escalate lock, so all locks will be exclusive.

Modified: packages/libapache-session-perl/trunk/Session/Lock/Semaphore.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Lock/Semaphore.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Lock/Semaphore.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Lock/Semaphore.pm Sat Jul 14 19:34:01 2007
@@ -11,13 +11,13 @@
 
 use strict;
 use Config;
-use IPC::SysV qw(IPC_CREAT S_IRWXU SEM_UNDO);
+use IPC::SysV qw(IPC_PRIVATE IPC_CREAT S_IRWXU SEM_UNDO);
 use IPC::Semaphore;
 use vars qw($VERSION);
 
-$VERSION = '1.01';
-
-sub BEGIN {
+$VERSION = '1.02';
+
+BEGIN {
 
     if ($Config{'osname'} eq 'linux') {
         #More semaphores on Linux means less lock contention
@@ -31,13 +31,23 @@
 }
 
 sub new {
+    return undef unless $Config{d_semget};
+    return undef 
+     if $^O eq 'cygwin' && (!exists $ENV{'CYGWIN'} || $ENV{'CYGWIN'} !~ /server/i);
+    #Modified by Alexandr Ciornii, 2007-03-12
+
     my $class   = shift;
     my $session = shift;
     
     my $nsems = $session->{args}->{NSems} ||
         $Apache::Session::Lock::Semaphore::nsems;
     
-    my $sem_key = $session->{args}->{SemaphoreKey} ||
+#    die "You shouldn't set session argument SemaphoreKey to undef"
+#     if exists($session->{args}->{SemaphoreKey}) && 
+#        !defined ($session->{args}->{SemaphoreKey});
+
+    my $sem_key = #exists ($session->{args}->{SemaphoreKey})?
+        $session->{args}->{SemaphoreKey} || 
         $Apache::Session::Lock::Semaphore::sem_key;
 
     return bless {read => 0, write => 0, sem => undef, nsems => $nsems, 
@@ -52,14 +62,15 @@
     return if $self->{write};
 
     if (!$self->{sem}) {    
-        $self->{sem} = new IPC::Semaphore($self->{sem_key}, $self->{nsems},
-            IPC_CREAT | S_IRWXU) || die $!;
+        $self->{sem} = new IPC::Semaphore(
+            defined($self->{sem_key})?$self->{sem_key}:IPC_PRIVATE, $self->{nsems},
+            IPC_CREAT | S_IRWXU) || die "Cannot create semaphore with key $self->{sem_key}: $!";
     }
     
     if (!defined $self->{read_sem}) {
         #The number of semaphores (2^2-2^4, typically) is much less than
-        #the potential number of session ids (2^128, typically), we need 
-        #to hash the session id to choose a sempahore.  This hash routine
+        #the potential number of session ids (2^128, typically), we need
+        #to hash the session id to choose a semaphore.  This hash routine
         #was stolen from Kernighan's The Practice of Programming.
 
         my $read_sem = 0;
@@ -71,8 +82,8 @@
         $self->{read_sem} = $read_sem;
     }    
     
-    #The sempahore block is divided into two halves.  The lower half
-    #holds the read sempahores, and the upper half holds the write
+    #The semaphore block is divided into two halves.  The lower half
+    #holds the read semaphores, and the upper half holds the write
     #semaphores.  Thus we can do atomic upgrade of a read lock to a
     #write lock.
     
@@ -89,14 +100,15 @@
     return if($self->{write});
 
     if (!$self->{sem}) {
-        $self->{sem} = new IPC::Semaphore($self->{sem_key}, $self->{nsems}, 
-            IPC_CREAT | S_IRWXU) || die $!;
+        $self->{sem} = new IPC::Semaphore(
+            defined($self->{sem_key})?$self->{sem_key}:IPC_PRIVATE, $self->{nsems},
+            IPC_CREAT | S_IRWXU) || die "Cannot create semaphore with key $self->{sem_key}: $!";
     }
     
     if (!defined $self->{read_sem}) {
         #The number of semaphores (2^2-2^4, typically) is much less than
         #the potential number of session ids (2^128, typically), we need 
-        #to hash the session id to choose a sempahore.  This hash routine
+        #to hash the session id to choose a semaphore.  This hash routine
         #was stolen from Kernighan's The Practice of Programming.
 
         my $read_sem = 0;
@@ -170,13 +182,14 @@
 
 =head1 NAME
 
-Apache::Session::Lock::Semaphore - Provides mutual exclusion through sempahores
+Apache::Session::Lock::Semaphore - Provides mutual exclusion through semaphores
 
 =head1 SYNOPSIS
 
  use Apache::Session::Lock::Semaphore;
  
  my $locker = new Apache::Session::Lock::Semaphore;
+ die "no semaphores" unless $locker;
  
  $locker->acquire_read_lock($ref);
  $locker->acquire_write_lock($ref);
@@ -186,27 +199,27 @@
 
 =head1 DESCRIPTION
 
-Apache::Session::Lock::Sempahore fulfills the locking interface of 
+Apache::Session::Lock::semaphore fulfills the locking interface of 
 Apache::Session.  Mutual exclusion is achieved through system semaphores and
 the IPC::Semaphore module.
 
 =head1 CONFIGURATION
 
 The module must know how many semaphores to use, and what semaphore key to
-use.  The number of semaphores has an impact on performance.  More semaphores
-meansless lock contention.  You should use the maximum number of sempahores
-that your platform will allow.  On stock NetBSD, OpenBSD, and Solaris systems,
-this is probably 16.  On Linux 2.2, this is 32.  This module tries to guess
+use. The number of semaphores has an impact on performance.  More semaphores
+means less lock contention. You should use the maximum number of semaphores
+that your platform will allow. On stock NetBSD, OpenBSD, and Solaris systems,
+this is probably 16. On Linux 2.2, this is 32. This module tries to guess
 the number based on your operating system, but it is safer to configure it
 yourself.
 
 To set the number of semaphores, you need to pass an argument in the usual
-Apache::Session style.  The name of the argument is NSems, and the value is
-an integer power of 2.  For example:
+Apache::Session style. The name of the argument is NSems, and the value is
+an integer power of 2. For example:
 
  tie %s, 'Apache::Session::Blah', $id, {NSems => 16};
 
-You may also need to configure the semaphore key that this package uses.  By
+You may also need to configure the semaphore key that this package uses. By
 default, it uses key 31818.  You can change this using the argument
 SemaphoreKey:
 
@@ -220,8 +233,8 @@
 If you get an invalid argument message, that usually means that the system
 is unhappy with the number of semaphores that you requested.  Try decreasing
 the number of semaphores.  The semaphore blocks that this package creates
-are persistent until the system is rebooted, so if you request 8 sempahores
-one time and 16 sempahores the next, it won't work.  Use the system
+are persistent until the system is rebooted, so if you request 8 semaphores
+one time and 16 semaphores the next, it won't work.  Use the system
 commands ipcs and ipcrm to inspect and remove unwanted semphore blocks.
 
 =head2 Cygwin
@@ -231,6 +244,17 @@
 
 Read /usr/share/doc/Cygwin/cygserver.README for more information.
 
+=head2 Darwin/MacOS X
+
+Darwin and MacOS X may not have semaphores, see
+L<http://sysnet.ucsd.edu/~bellardo/darwin/sysvsem.html>
+
+=head2 *BSD
+
+Error "No space left on device" means that maximum number of semaphores is reached.
+See L<http://www.postgresql.org/docs/7.3/static/kernel-resources.html> for
+more information.
+
 =head1 AUTHOR
 
 This module was written by Jeffrey William Baker <jwbaker at acm.org>.

Modified: packages/libapache-session-perl/trunk/Session/Store/DB_File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Store/DB_File.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Store/DB_File.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Store/DB_File.pm Sat Jul 14 19:34:01 2007
@@ -13,7 +13,7 @@
 use vars qw($VERSION);
 use DB_File;
 
-$VERSION = '1.00';
+$VERSION = '1.01';
 
 sub new {
     my $class = shift;
@@ -29,7 +29,7 @@
         my $rv = tie %{$self->{dbm}}, 'DB_File', $session->{args}->{FileName};
 
         if (!$rv) {
-            die "Could not open dbm file: $!";
+            die "Could not open dbm file $session->{args}->{FileName}: $!";
         }
     }
     
@@ -44,11 +44,11 @@
     my $self = shift;
     my $session = shift;
     
-        if (!tied %{$self->{dbm}}) {
+    if (!tied %{$self->{dbm}}) {
         my $rv = tie %{$self->{dbm}}, 'DB_File', $session->{args}->{FileName};
 
         if (!$rv) {
-            die "Could not open dbm file: $!";
+            die "Could not open dbm file $session->{args}->{FileName}: $!";
         }
     }
     
@@ -63,7 +63,7 @@
         my $rv = tie %{$self->{dbm}}, 'DB_File', $session->{args}->{FileName};
 
         if (!$rv) {
-            die "Could not open dbm file: $!";
+            die "Could not open dbm file $session->{args}->{FileName}: $!";
         }
     }
     
@@ -82,7 +82,7 @@
         my $rv = tie %{$self->{dbm}}, 'DB_File', $session->{args}->{FileName};
 
         if (!$rv) {
-            die "Could not open dbm file: $!";
+            die "Could not open dbm file $session->{args}->{FileName}: $!";
         }
     }
     

Modified: packages/libapache-session-perl/trunk/Session/Store/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/Session/Store/File.pm?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/Session/Store/File.pm (original)
+++ packages/libapache-session-perl/trunk/Session/Store/File.pm Sat Jul 14 19:34:01 2007
@@ -14,7 +14,7 @@
 use Fcntl;
 use vars qw($VERSION);
 
-$VERSION = '1.02';
+$VERSION = '1.03';
 
 $Apache::Session::Store::File::Directory = '/tmp';
 
@@ -38,8 +38,9 @@
         die "Object already exists in the data store";
     }
     
-    sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) ||
-        die "Could not open file ".$directory.'/'.$session->{data}->{_session_id}.": $!";
+    my $file = $directory.'/'.$session->{data}->{_session_id};
+    sysopen ($self->{fh}, $file, O_RDWR|O_CREAT) ||
+        die "Could not open file $file: $!";
 
     $self->{opened} = 1;
     
@@ -53,9 +54,10 @@
     my $directory = $session->{args}->{Directory} || $Apache::Session::Store::File::Directory;
 
     if (!$self->{opened}) {
-        sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) ||
-            die "Could not open file: $!";
-        
+        my $file = $directory.'/'.$session->{data}->{_session_id};
+        sysopen ($self->{fh}, $file, O_RDWR|O_CREAT) ||
+            die "Could not open file $file: $!";
+
         $self->{opened} = 1;
     }
     
@@ -70,10 +72,11 @@
     
     my $directory = $session->{args}->{Directory} || $Apache::Session::Store::File::Directory;
     
-    if (-e $directory.'/'.$session->{data}->{_session_id}) {
+    my $file = $directory.'/'.$session->{data}->{_session_id};
+    if (-e $file) {
         if (!$self->{opened}) {
-            sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) ||
-                die "Could not open file: $!";
+            sysopen ($self->{fh}, $file, O_RDWR|O_CREAT) ||
+                die "Could not open file $file: $!";
 
             $self->{opened} = 1;
         }
@@ -102,9 +105,10 @@
         $self->{opened} = 0;
     }
 
-    if (-e $directory.'/'.$session->{data}->{_session_id}) {
-        unlink ($directory.'/'.$session->{data}->{_session_id}) ||
-            die "Could not remove file: $!";
+    my $file = $directory.'/'.$session->{data}->{_session_id};
+    if (-e $file) {
+        unlink ($file) ||
+            die "Could not remove file $file: $!";
     }
     else {
         die "Object does not exist in the data store";

Modified: packages/libapache-session-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/debian/changelog?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/debian/changelog (original)
+++ packages/libapache-session-perl/trunk/debian/changelog Sat Jul 14 19:34:01 2007
@@ -1,3 +1,9 @@
+libapache-session-perl (1.83-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Sat, 14 Jul 2007 21:32:16 +0200
+
 libapache-session-perl (1.82-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/libapache-session-perl/trunk/t/99dbfile.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99dbfile.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99dbfile.t (original)
+++ packages/libapache-session-perl/trunk/t/99dbfile.t Sat Jul 14 19:34:01 2007
@@ -52,5 +52,7 @@
 cmp_deeply $session{baz}, $baz, "Baz matches";
 
 tied(%session)->delete;
+untie %session;
+undef %session;
 
 chdir( $origdir );

Modified: packages/libapache-session-perl/trunk/t/99dbfilestore.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99dbfilestore.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99dbfilestore.t (original)
+++ packages/libapache-session-perl/trunk/t/99dbfilestore.t Sat Jul 14 19:34:01 2007
@@ -74,5 +74,7 @@
 } "Can't materialize removed session";
 
 undef $store;
+untie %hash;
+undef %hash;
 
 chdir( $origdir );

Modified: packages/libapache-session-perl/trunk/t/99filelock.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99filelock.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99filelock.t (original)
+++ packages/libapache-session-perl/trunk/t/99filelock.t Sat Jul 14 19:34:01 2007
@@ -3,12 +3,6 @@
 use Test::Exception;
 use File::Temp qw[tempdir];
 use Cwd qw[getcwd];
-
-eval {require Fcntl;};
-if ($@) {
-    print "1..0\n";
-    exit;
-}
 
 plan skip_all => "Optional module (Fcntl) not installed"
   unless eval {

Modified: packages/libapache-session-perl/trunk/t/99flex.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99flex.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99flex.t (original)
+++ packages/libapache-session-perl/trunk/t/99flex.t Sat Jul 14 19:34:01 2007
@@ -3,7 +3,14 @@
 use Test::Exception;
 use File::Temp qw[tempdir];
 use Cwd qw[getcwd];
+use strict;
+use Config;
 
+plan skip_all => "Only for perl 5.8.0 or later"
+  unless eval {
+   require 5.8.0;
+   #perl 5.6 don't like this test. See RT#16539.
+  };
 #use Module::Mask;my $mask = new Module::Mask ('Storable');
 plan skip_all => "Optional modules (Fcntl, DB_File, Digest::MD5, Storable) not installed"
   unless eval {
@@ -18,8 +25,9 @@
 my $package = 'Apache::Session::Flex';
 use_ok $package;
 
+#$Apache::Session::Lock::File::LockDirectory=$tempdir;
+my $tempdir = tempdir( DIR => '.', CLEANUP => 1 );
 my $origdir = getcwd;
-my $tempdir = tempdir( DIR => '.', CLEANUP => 1 );
 chdir( $tempdir );
 
 {
@@ -28,6 +36,8 @@
         Lock      => 'File',
         Generate  => 'MD5',
         Serialize => 'Storable',
+#        Directory     => $tempdir,
+#        LockDirectory => $tempdir,
     };
     isa_ok $session->{object_store}, 'Apache::Session::Store::File';
     isa_ok $session->{lock_manager}, 'Apache::Session::Lock::File';
@@ -36,9 +46,12 @@
     is ref($session->{unserialize}), 'CODE', 'unserialize is CODE';
 }
 
-SKIP: {
+SKIP: { #Flex that uses IPC
+    skip "semget not implemented",5 unless $Config{d_semget};
     skip "Cygserver is not running",5 
      if $^O eq 'cygwin' && (!exists $ENV{'CYGWIN'} || $ENV{'CYGWIN'} !~ /server/i);
+    skip "NetBSD does not like anonymous semaphores",5 
+     if $^O =~ /netbsd/i;
     skip "Optional modules (IPC::Semaphore, IPC::SysV, MIME::Base64) not installed",5
      unless eval {
                require IPC::Semaphore;
@@ -46,12 +59,18 @@
                require MIME::Base64;
               };
 
+    require Apache::Session::Lock::Semaphore;
+    $Apache::Session::Lock::Semaphore::sem_key=undef;
+    $Apache::Session::Lock::Semaphore::sem_key=$Apache::Session::Lock::Semaphore::sem_key;
     my $session = tie my %session, $package, undef, {
         Store     => 'DB_File',
         Lock      => 'Semaphore',
         Generate  => 'MD5',
         Serialize => 'Base64',
-    };
+#        SemaphoreKey => undef,
+#        SemaphoreKey => 31817,
+    }; #Apache::Session::save in TIEHASH does acquire_write_lock
+
     isa_ok $session->{object_store}, 'Apache::Session::Store::DB_File';
     isa_ok $session->{lock_manager}, 'Apache::Session::Lock::Semaphore';
     is ref($session->{generate}),    'CODE', 'generate is CODE';

Modified: packages/libapache-session-perl/trunk/t/99nulllock.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99nulllock.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99nulllock.t (original)
+++ packages/libapache-session-perl/trunk/t/99nulllock.t Sat Jul 14 19:34:01 2007
@@ -3,11 +3,6 @@
 use Test::Exception;
 use File::Temp qw[tempdir];
 use Cwd qw[getcwd];
-
-plan skip_all => "Optional module (Fcntl) not installed"
-  unless eval {
-               require Fcntl;
-              };
 
 #my $origdir = getcwd;
 #my $tempdir = tempdir( DIR => '.', CLEANUP => 1 );

Modified: packages/libapache-session-perl/trunk/t/99semaphore.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libapache-session-perl/trunk/t/99semaphore.t?rev=5772&op=diff
==============================================================================
--- packages/libapache-session-perl/trunk/t/99semaphore.t (original)
+++ packages/libapache-session-perl/trunk/t/99semaphore.t Sat Jul 14 19:34:01 2007
@@ -3,8 +3,12 @@
 use Test::Exception;
 use File::Temp qw[tempdir];
 use Cwd qw[getcwd];
+use Config;
 
 BEGIN {
+ plan skip_all => "semget not implemented" unless $Config{d_semget};
+ #Darwin may not have semaphores, see
+ #http://sysnet.ucsd.edu/~bellardo/darwin/sysvsem.html
  plan skip_all => "Optional modules (IPC::SysV, IPC::Semaphore) not installed"
   unless eval {
                require IPC::SysV;




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