Mail Archives: cygwin/2002/09/19/14:38:21
On Thu, 19 Sep 2002, Rob Brown wrote:
> I am trying to write a script that checks the % free of local drives using
> df.
>
> $ df -a
> Filesystem 1k-blocks Used Available Use% Mounted on
> C:\cygwin\bin 19936633 5750854 14185779 29% /usr/bin
> c:\cygwin\lib 19936633 5750854 14185779 29% /usr/lib
> \\server1\rob 961282048 850460672 110821376 89% /rob
> c:\cygwin 19936633 5750854 14185779 29% /
> c: 19936633 5750854 14185779 29% /cygdrive/c
> d: 544324 544324 0 100% /cygdrive/d
> u: 961282048 850460672 110821376 89% /cygdrive/u
>
> The problem is that when I run df --local, I only see remotely mounted
> filesystem:
> $ df --local
> Filesystem 1k-blocks Used Available Use% Mounted on
> \\server1\rob 961282048 850460672 110821376 89% /rob
>
> Is this a bug? It seems to be opposite of what you would expect.
>
> Also, is there a way to exclude the CDrom drive from the script, since it
> will always show 100%?
Rob,
Yes, this is a porting bug in the fileutils package. The culprit is this
line (lib/mountlist.h:49):
# define ME_REMOTE(fs_name, fs_type) (strchr (fs_name, ':') != 0)
which has the exact opposite meaning on Cygwin. On Cygwin, paths with ":"
are local, of the form "C:\...", whereas paths without ":", of the form
"\\machine\path" are remote. On Unix systems, local paths have the form
"/dir1/dir2/...", and remote ones are "machine:/dir1/dir2/...".
Hope this helps. If I have enough time in the next few days, I'll figure
out the proper way to fix this and submit a patch. A quick workaround
would be
==================================================================
--- mountlist.h 2002-09-19 14:34:31.000000000 -0400
+++ mountlist.h-orig 2000-06-02 07:20:04.000000000 -0400
@@ -46,9 +46,5 @@ struct mount_entry *read_filesystem_list
#endif
#ifndef ME_REMOTE
-# ifdef __CYGWIN__
-# define ME_REMOTE(fs_name, fs_type) (strchr (fs_name, ':') == 0)
-# else
# define ME_REMOTE(fs_name, fs_type) (strchr (fs_name, ':') != 0)
-# endif
#endif
==================================================================
but this strikes me as a source of potential problems, and probably
shouldn't be used as a final fix. Perhaps the maintainer of filetutils
could look into it?
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -