Summary: | sys-apps/coreutils - df shows negative numbers for cifs mounted dirs | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Toralf Förster <toralf> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 65644, 105368 | ||
Bug Blocks: |
Description
Toralf Förster
2005-08-31 00:48:58 UTC
df works for me with smbfs/cifs ... you didnt say what the filesizes are *supposed* to report ... also, what version of coreutils do you have exactly ? windows says: "1.685.674.000.384 bytes free" (1,5 TB ) cygwin under windows reports with df -m: $ df -m /cygdrive/g/ Filesystem 1M-blocks Used Available Use% Mounted on g: 645248 -18014398508519648 1607584 101% /cygdrive/g this has come up before ... i'll see if i can make a patch for you to test Please, don't reassign bugs back to bug-wranglers. >this has come up before ... i'll see if i can make a patch for you to test
Hi,
anything ready for testing ?
Got this from Paul Eggert <eggert@cs.ucla.edu> today regarding wrong numbers from df showing disk usage of a cifs mounted dir under kernel 2.6.15-gentoo-r1: Toralf F Got this from Paul Eggert <eggert@cs.ucla.edu> today regarding wrong numbers from df showing disk usage of a cifs mounted dir under kernel 2.6.15-gentoo-r1: Toralf Förster <toralf.foerster@gmx.de> writes: > $ strace df -m /mnt/GSA/ > ... > statfs64("/mnt/GSA", 84, {f_type=0xff534d42, f_bsize=1024, > f_blocks=2245328896, f_bfree=2737373184, f_bavail=2737373184, f_files=0, > f_ffree=0, f_fsid={0, 0}, f_namelen=4096, f_frsize=1024}) = 0 > ... > Filesystem 1M-blocks Used Available Use% Mounted on > //ehngsa.ibm.com/ 2192704 -18014398509001472 2673216 101% /mnt/GSA Thanks for reporting that. statfs64 is claiming that your file system has more available than total blocks. Clearly this is a bug in your file system or kernel or something like that, but 'df' should output more-useful information even when there's a bug elsewhere. I think the output should look like this: Filesystem 1M-blocks Used Available Use% Mounted on //ehngsa.ibm.com/ 2192704 -480512 2673216 - /mnt/GSA I've installed the following patch to CVS coreutils, so that it generates this output. 2006-01-24 Paul Eggert <eggert@cs.ucla.edu> * src/df.c (show_dev): If the file system claims to have more available than total blocks, report the number of used blocks as being total - available (a negative number) rather than as garbage. Problem reported by Toralf Foerster. --- src/df.c.~1.171.~ 2005-12-28 02:22:41.000000000 -0800 +++ src/df.c 2006-01-24 15:22:59.000000000 -0800 @@ -1,5 +1,5 @@ /* df - summarize free disk space - Copyright (C) 91, 1995-2005 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -231,15 +231,15 @@ excluded_fstype (const char *fstype) /* Like human_readable (N, BUF, human_output_opts, INPUT_UNITS, OUTPUT_UNITS), except: - - Return "-" if N is -1, - - If NEGATIVE is 1 then N represents a negative number, - expressed in two's complement. */ + - If NEGATIVE, then N represents a negative number, + expressed in two's complement. + - Otherwise, return "-" if N is UINTMAX_MAX. */ static char const * df_readable (bool negative, uintmax_t n, char *buf, uintmax_t input_units, uintmax_t output_units) { - if (n == UINTMAX_MAX) + if (n == UINTMAX_MAX && !negative) return "-"; else { @@ -357,20 +357,17 @@ show_dev (char const *disk, char const * output_units = output_block_size; total = fsu.fsu_blocks; available = fsu.fsu_bavail; - negate_available = fsu.fsu_bavail_top_bit_set; + negate_available = (fsu.fsu_bavail_top_bit_set + & (available != UINTMAX_MAX)); available_to_root = fsu.fsu_bfree; } - used = -1; + used = UINTMAX_MAX; negate_used = false; if (total != UINTMAX_MAX && available_to_root != UINTMAX_MAX) { used = total - available_to_root; - if (total < available_to_root) - { - negate_used = true; - used = - used; - } + negate_used = (total < available_to_root); } printf (" %*s %*s %*s ", then i'm gonna consider this fixed as the issue will be in the next release of coreutils thanks for doing the hard work and making me look like a slacker :) |