/[fuse.before_github]/perl-llin/test/helper.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /perl-llin/test/helper.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (hide annotations)
Thu Nov 15 09:32:08 2007 UTC (16 years, 4 months ago) by dpavlin
File size: 902 byte(s)
patch from Chris Dolan via rt.cpan.org #30631

This patch gets Fuse.pm to half-work on MacOSX with the current release
of MacFuse (v1.1.0).  By half-work, I mean that all of the directory
actions and file read actions work, but anything that involves writing a
file fails.  This appears to be because the latest MacFUSE implements
FUSE 2.6, which prefers to call CREATE instead of MKNOD.  Nonetheless,
recommend that something like this patch be included because it makes
read-only filesystems usable on Darwin systems.  Some of my changes
(like kill() instead of system("kill")) are improvements on any system.
												    I've tested only on my PowerPC G5 iMac running 10.4.

I intend to also try MacFUSE v0.4 via Fink, but that version is                                     
reportedly less stable than the latest MacFUSE.                                                     
1 mszeredi 4 #!/usr/bin/perl
2     package test::helper;
3     use strict;
4     use Exporter;
5 dpavlin 19 use Config;
6 dpavlin 10 use POSIX qw(WEXITSTATUS);
7 mszeredi 4 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
8     @ISA = "Exporter";
9     @EXPORT_OK = qw($_loop $_point $_pidfile $_real);
10 dpavlin 112 my $tmp = -d '/private' ? '/private/tmp' : '/tmp';
11     our($_loop, $_point, $_pidfile, $_real) = ("","$tmp/fusemnt-".$ENV{LOGNAME},"test/s/mounted.pid","$tmp/fusetest-".$ENV{LOGNAME});
12     $_loop = $^O ne 'darwin' && $Config{useithreads} ? "examples/loopback_t.pl" : "examples/loopback.pl";
13 mszeredi 4 if($0 !~ qr|s/u?mount\.t$|) {
14     my ($reject) = 1;
15 dpavlin 112 if(open my $fh, '<', $_pidfile) {
16     my $pid = do {local $/ = undef; <$fh>};
17     close $fh;
18     if(kill 0, $pid) {
19     if(`mount` =~ m{on (?:/private)?$_point }) {
20 mszeredi 4 $reject = 0;
21     } else {
22 dpavlin 112 kill 1, $pid;
23 mszeredi 4 }
24     }
25     }
26 dpavlin 105 system("ls $_point >/dev/null");
27 dpavlin 10 $reject = 1 if (POSIX::WEXITSTATUS($?));
28 mszeredi 4 die "not properly mounted\n" if $reject;
29     }
30     1;

  ViewVC Help
Powered by ViewVC 1.1.26