Skip Menu |
 

This queue is for tickets about the Filesys-DiskSpace CPAN distribution.

Report information
The Basics
Id: 13144
Status: open
Priority: 0/
Queue: Filesys-DiskSpace

People
Owner: Nobody in particular
Requestors: at [...] altlinux.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
perl-Filesys-DiskSpace-0.05-alt-filesystems.patch
perl-Filesys-DiskSpace-0.05-df.patch



Subject: Support for modern filesystems
Download (untitled) / with headers
text/plain 549b
Hello, Filesys::DiskSpace does not recognize any modern filesystem (e.g. ReiserFS and Ext3 on Linux), since "known FS type" list has not been updated since 1999 and heavily outdated. I added more filesystem types from my statfs(2) linux manpage, and made a change to t/linux-ext2.t so that it can also recognize ext3, reiserfs, and xfs (arguably the most popular linux filesystems nowadays). Please see the attached patch. BTW, I think I am interested in taking maintainership over Filesys::DiskSpace on CPAN. -- Alexey Tourbin ALT Linux Team
--- ./t/linux-ext2.t- 1999-09-06 02:41:41 +0400 +++ ./t/linux-ext2.t 2003-10-24 19:44:27 +0400 @@ -16,11 +16,11 @@ my $bindf = '/bin/df'; my $mnttab = '/etc/mtab'; -my ($data, $dirs); +my $data; my $dirs = []; open (MOUNT, $mnttab) || die "Error: $!\n"; while (defined (my $d = <MOUNT>)) { my @tab = split /\s+/, $d; - push @$dirs, $tab[1] if $tab[2] eq 'ext2'; + push @$dirs, $tab[1] if $tab[2] =~ /^(ext[23]|reiserfs|xfs)$/; } close MOUNT; open (DF, "$bindf -k @$dirs |") || die "Error: $!\n"; @@ -44,7 +44,7 @@ for my $part (keys %$data) { my ($fs_type, $fs_desc, $used, $avail, $fused, $favail) = df $part; - my $res = $fs_type == 61267 && + my $res = # $fs_type == 61267 && $$data{$part}{'used'} == $used && $$data{$part}{'avail'} == $avail && $$data{$part}{'fused'} == $fused && --- ./lib/Filesys/DiskSpace.pm- 1999-09-06 02:41:22 +0400 +++ ./lib/Filesys/DiskSpace.pm 2003-10-24 19:43:10 +0400 @@ -39,6 +39,52 @@ 19920822 => "SYSV2_SUPER_MAGIC", # 0x012FF7B6 19920823 => "COH_SUPER_MAGIC", # 0x012FF7B7 4187351113 => "HPFS_SUPER_MAGIC", # 0xF995E849 + +# updated by Alexey Tourbin <at@altlinux.org> according to statfs(2) on Fri Oct 24 2003 + 0xadf5, "ADFS_SUPER_MAGIC", + 0xADFF, "AFFS_SUPER_MAGIC", + 0x42465331, "BEFS_SUPER_MAGIC", + 0x1BADFACE, "BFS_MAGIC", + 0xFF534D42, "CIFS_MAGIC_NUMBER", + 0x73757245, "CODA_SUPER_MAGIC", + 0x012FF7B7, "COH_SUPER_MAGIC", + 0x28cd3d45, "CRAMFS_MAGIC", + 0x1373, "DEVFS_SUPER_MAGIC", + 0x00414A53, "EFS_SUPER_MAGIC", + 0x137D, "EXT_SUPER_MAGIC", + 0xEF51, "EXT2_OLD_SUPER_MAGIC", + 0xEF53, "EXT2_SUPER_MAGIC", + 0xEF53, "EXT3_SUPER_MAGIC", + 0x4244, "HFS_SUPER_MAGIC", + 0xF995E849, "HPFS_SUPER_MAGIC", + 0x958458f6, "HUGETLBFS_MAGIC", + 0x9660, "ISOFS_SUPER_MAGIC", + 0x72b6, "JFFS2_SUPER_MAGIC", + 0x3153464a, "JFS_SUPER_MAGIC", + 0x137F, "MINIX_SUPER_MAGIC", # /* orig. minix */ + 0x138F, "MINIX_SUPER_MAGIC2", # /* 30 char minix */ + 0x2468, "MINIX2_SUPER_MAGIC", # /* minix V2 */ + 0x2478, "MINIX2_SUPER_MAGIC2", # /* minix V2, 30 char names */ + 0x4d44, "MSDOS_SUPER_MAGIC", + 0x564c, "NCP_SUPER_MAGIC", + 0x6969, "NFS_SUPER_MAGIC", + 0x5346544e, "NTFS_SB_MAGIC", + 0x9fa1, "OPENPROM_SUPER_MAGIC", + 0x9fa0, "PROC_SUPER_MAGIC", + 0x002f, "QNX4_SUPER_MAGIC", + 0x52654973, "REISERFS_SUPER_MAGIC", + 0x7275, "ROMFS_MAGIC", + 0x517B, "SMB_SUPER_MAGIC", + 0x012FF7B6, "SYSV2_SUPER_MAGIC", + 0x012FF7B5, "SYSV4_SUPER_MAGIC", + 0x01021994, "TMPFS_MAGIC", + 0x15013346, "UDF_SUPER_MAGIC", + 0x00011954, "UFS_MAGIC", + 0x9fa2, "USBDEVICE_SUPER_MAGIC", + 0xa501FCF5, "VXFS_SUPER_MAGIC", + 0x012FF7B4, "XENIX_SUPER_MAGIC", + 0x58465342, "XFS_SUPER_MAGIC", + 0x012FD16D, "_XIAFS_SUPER_MAGIC", ); sub df ($) {
From: tim [...] tim-landscheidt.de
Download (untitled) / with headers
text/plain 218b
Just for those who stumble upon this: As I was on a system with a non- English locale, I needed to patch the call to df and parse of its output as well. (In the end though, switching to Filesys::Df is probably easier.)
Subject: perl-Filesys-DiskSpace-0.05-df.patch
--- t/linux-ext2.t~ 2011-05-06 18:31:58.310584985 +0000 +++ t/linux-ext2.t 2011-05-06 18:42:34.845587143 +0000 @@ -23,18 +23,18 @@ push @$dirs, $tab[1] if $tab[2] =~ /^(ext[23]|reiserfs|xfs)$/; } close MOUNT; -open (DF, "$bindf -k @$dirs |") || die "Error: $!\n"; +open (DF, "$bindf -kP @$dirs |") || die "Error: $!\n"; +my $header = <DF>; while (defined (my $d = <DF>)) { my @tab = split /\s+/, $d; - next if $tab[0] eq 'Filesystem'; $$data{$tab[5]}{'used'} = $tab[2]; $$data{$tab[5]}{'avail'} = $tab[3]; } close DF; -open (DF, "$bindf -i @$dirs |") || die "Error: $!\n"; +open (DF, "$bindf -iP @$dirs |") || die "Error: $!\n"; +$header = <DF>; while (defined (my $d = <DF>)) { my @tab = split /\s+/, $d; - next if $tab[0] eq 'Filesystem'; $$data{$tab[5]}{'fused'} = $tab[2]; $$data{$tab[5]}{'favail'} = $tab[3]; }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.