? fink/t/basepath/fink
Index: fink/lockwait.in
===================================================================
RCS file: /cvsroot/fink/fink/lockwait.in,v
retrieving revision 1.5
diff -u -r1.5 lockwait.in
--- fink/lockwait.in	18 Oct 2005 23:09:15 -0000	1.5
+++ fink/lockwait.in	21 Feb 2006 10:50:40 -0000
@@ -30,7 +30,9 @@
 	#       short   l_whence;   /* type of l_start */
 	#   };
 	my $struct_flock = pack("lllliss", (0, 0), (0, 0), 0, F_WRLCK, SEEK_SET);
-	unless (fcntl(LOCK, F_SETLK, $struct_flock)) {
+	my $lock_ok = fcntl(LOCK, F_SETLK, $struct_flock);
+	# XXX: Do nothing if flock is not supported on the filesystem.
+	unless ($lock_ok || $! == EOPNOTSUPP || $! == ENOLCK) {
 		die "lockwait: Can't get lock: $!" unless $! == EAGAIN || $! == EACCES;
 		
 		my $msg = $timeout ? "up to $timeout seconds " : "";
@@ -50,7 +52,8 @@
 		}
 		print STDERR "done.\n";
 	}
-	print STDERR "Got the lock\n" if $debug;
+	print STDERR "Got the lock\n" if $debug && $lock_ok;
+	print STDERR "No lock is available on this filesystem\n" if $debug && !$lock_ok;
 	
 	print STDERR "Clear close-on-exec, so exec'ed process gets the lock\n"
 		if $debug;
Index: fink/perlmod/Fink/Engine.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v
retrieving revision 1.349
diff -u -r1.349 Engine.pm
--- fink/perlmod/Fink/Engine.pm	9 Feb 2006 00:35:13 -0000	1.349
+++ fink/perlmod/Fink/Engine.pm	21 Feb 2006 10:50:42 -0000
@@ -614,7 +614,7 @@
 		
 		my %pkgs;
 		my $dbpath = "$dbpath/override.db";
-		my $db = -f $dbpath ? Storable::lock_retrieve($dbpath) : { };
+		my $db = -f $dbpath ? Storable::retrieve($dbpath) : { };
 		
 		for my $tree (@trees) {
 			if (exists $db->{$tree}) {		# Use the cached debs
Index: fink/perlmod/Fink/Package.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Package.pm,v
retrieving revision 1.166
diff -u -r1.166 Package.pm
--- fink/perlmod/Fink/Package.pm	3 Jan 2006 20:14:46 -0000	1.166
+++ fink/perlmod/Fink/Package.pm	21 Feb 2006 10:50:42 -0000
@@ -997,7 +997,7 @@
 		$valid_since = (stat($class->db_proxies))[9];
 		eval {
 			local $SIG{INT} = 'IGNORE'; # No user interrupts
-			$packages = Storable::lock_retrieve($class->db_proxies);
+			$packages = Storable::retrieve($class->db_proxies);
 		};
 		if ($@ || !defined $packages) {
 			die "It appears that part of Fink's package database is corrupted. "
@@ -1013,7 +1013,7 @@
 		if ($idx_ok) {
 			eval {
 				local $SIG{INT} = 'IGNORE'; # No user interrupts
-				$idx = Storable::lock_retrieve($class->db_index);
+				$idx = Storable::retrieve($class->db_index);
 			};
 			if ($@ || !defined $idx) {
 				close $lock if $lock;
Index: fink/perlmod/Fink/Services.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Services.pm,v
retrieving revision 1.197
diff -u -r1.197 Services.pm
--- fink/perlmod/Fink/Services.pm	1 Feb 2006 04:56:42 -0000	1.197
+++ fink/perlmod/Fink/Services.pm	21 Feb 2006 10:50:43 -0000
@@ -28,7 +28,7 @@
 use Fink::Command	qw(&rm_f);
 use Fink::CLI		qw(&word_wrap &get_term_width &print_breaking_stderr);
 
-use POSIX qw(uname tmpnam);
+use POSIX qw(:errno_h uname tmpnam);
 use Fcntl qw(:flock);
 use Getopt::Long;
 use Data::Dumper;
@@ -1683,6 +1683,9 @@
 	if (flock $lockfile_FH, $mode | LOCK_NB) {
 		return wantarray ? ($lockfile_FH, 0) : $lockfile_FH;
 	} else {
+		# XXX: Do nothing if flock is not supported on the filesystem.
+		return (wantarray ? ($lockfile_FH, 0) : 0)
+			if ($! == EOPNOTSUPP || $! == ENOLCK);
 		return (wantarray ? (0, 0) : 0) if $no_block;
 		
 		# Couldn't get lock, meaning process has it
@@ -1785,7 +1788,21 @@
 	my $tmp = "${file}.tmp";
 	
 	return 0 unless eval { require Storable };
-	if (Storable::lock_store($ref, $tmp)) {
+	unless (open(TMP_FILE, ">>$tmp")) {
+		print_breaking_stderr("Error: could not write temporary file $tmp: $!");
+		return 0;
+	}
+	unless (flock(TMP_FILE, LOCK_EX)) {
+		unless ($! == EOPNOTSUPP || $! == ENOLCK) {
+			print_breaking_stderr("Error: could not lock temporary file $tmp: $!");
+			close(TMP_FILE);
+			return 0;
+		}
+		# XXX: Do nothing if flock is not supported on the filesystem.
+	}
+	my $store_ok = Storable::store($ref, $tmp);
+	close(TMP_FILE);
+	if ($store_ok) {
 		unless (rename $tmp, $file) {
 			print_breaking_stderr("Error: could not activate temporary file $tmp: $!");
 			return 0;
