Subject: | Filesys::Type::Plugin::Unix::fstype on Solaris 10 |
Date: | Fri, 5 Sep 2008 10:16:55 -0400 |
To: | bug-Filesys-Type [...] rt.cpan.org |
From: | Ethan Mallove <ethan.mallove [...] sun.com> |
Hello,
I'm getting stuck using this module on Solaris 10.
Shouldn't fstype be returning something here?
$ perl -I. -e 'use Filesys::Type qw(fstype); print fstype("/tmp");'
$ perl -I. -e 'use Filesys::Type qw(fstype); print fstype("/home");'
$ perl -I. -e 'use Filesys::Type qw(fstype); print fstype("/workspace");'
$ perl -I. -e 'use Filesys::Type qw(fstype); print fstype("/ws");'
$ df /tmp /home /workspace/ /ws
/tmp (swap ):29694896 blocks 2396843 files
/home (auto.home ): 0 blocks 0 files
/workspace (auto.workspace ): 0 blocks 0 files
/ws (auto.ws ): 0 blocks 0 files
--------------------------------------------------------------------------
Filesys-Type-0.02
$ uname -a
SunOS ... 5.10 Generic_127111-07 sun4v sparc SUNW,Sun-Fire-T200
$ perl -v
This is perl, v5.8.4 built for sun4-solaris-64int
(with 28 registered patches, see perl -V for more detail)
It seems like there's a messed up redirect on the df and mount commands.
Here's a patch:
--- ./Filesys/Type/Plugin/Unix.pm Thu Sep 4 14:52:53 2008
+++ /tmp/Filesys-Type-0.02/lib/Filesys/Type/Plugin/Unix.pm Fri Jul 8 09:07:52 2005
@@ -1,6 +1,5 @@
package Filesys::Type::Plugin::Unix;
use strict;
our $VERSION = 0.02;
our ($df,$mounted,$err);
@@ -18,11 +17,10 @@
my ($self,$path) = @_;
$err = '';
- $df = `df $path 2>1 /dev/null`;
+ $df = `df $path 2>/dev/null`;
$err = 'df command failed' unless $df;
- $mounted = `mount 2>1 /dev/null`; # Does not need root
+ $mounted = `mount 2>/dev/null`; # Does not need root
$err = 'mount command failed' unless $df;
-
return undef if $err;
my ($mounted_fs) = $df =~ /\d\%\s(\S+)/;
$mounted_fs never gets set properly, because apparently FileSys::Type can't
this "df" output:
$ df /home
/home (auto.home ): 0 blocks 0 files
$ df /home/emallove
/home/emallove (ubur-home2.east:/export/home2/08/emallove):270258724 blocks 29811479 files
-Ethan