Bug 32397

Summary: df -l doesn't work
Product: Base System Reporter: setantae <setantae>
Component: binAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-STABLE   
Hardware: Any   
OS: Any   

Description setantae 2001-11-30 14:00:02 UTC
	df(1)'s -l option is supposed to report information only about
	local filesystems.  Instead, it reports nothing.

Fix: 

No idea.
How-To-Repeat: 
	setantae@rhadamanth setantae$ mount
	/dev/ad4s2a on / (ufs, local)
	mfs:30 on /tmp (mfs, asynchronous, local, noatime, nosuid)
	/dev/ad4s2e on /home (ufs, local, soft-updates)
	/dev/ad4s2g on /usr (ufs, local, soft-updates)
	/dev/ad4s2h on /usr/src (ufs, local, soft-updates)
	/dev/ad4s2d on /usr/ports (ufs, local, soft-updates)
	/dev/ad6s2f on /usr/obj (ufs, local, soft-updates)
	/dev/ad4s2f on /var (ufs, local, soft-updates)
	/dev/ad6s5 on /data (msdos, local)
	/dev/ad6s2e on /data/audio/all (ufs, local, soft-updates)
	procfs on /proc (procfs, local)
	/dev/acd1a on /cdr (cd9660, local, read-only)
	setantae@rhadamanth setantae$ df -l
	setantae@rhadamanth setantae$
Comment 1 alex.neyman 2001-11-30 14:56:14 UTC
Hi, there!

Try the following:
--- /usr/src/bin/df/df.c        Tue Oct 30 16:29:03 2001
+++ /usr/src/bin/df/df.c        Fri Nov 30 20:53:20 2001
@@ -552,7 +552,8 @@
 	}
 
 	*str = 'n'; *(str+1) = 'o';
-	for (i = 0,strptr=str+2; i < cnt; i++,strptr++) {
+	strptr=str+2+!cnt;
+	for (i = 0; i < cnt; i++,strptr++) {
 		strncpy (strptr, listptr[i], 32);
 		strptr+=strlen(listptr[i]);
 		*strptr=',';

Regards,
Alexey.

-- 
<------------------------->
 ) May the Sun and Water (   Regards, Alexey V. Neyman
 ) always fall upon you! (   mailto:alex.neyman@auriga.ru
<------------------------->
Comment 2 alex.neyman 2001-11-30 14:56:48 UTC
Hi, there!

Try the following:
--- /usr/src/bin/df/df.c        Tue Oct 30 16:29:03 2001
+++ /usr/src/bin/df/df.c        Fri Nov 30 20:53:20 2001
@@ -552,7 +552,8 @@
 	}
 
 	*str = 'n'; *(str+1) = 'o';
-	for (i = 0,strptr=str+2; i < cnt; i++,strptr++) {
+	strptr=str+2+!cnt;
+	for (i = 0; i < cnt; i++,strptr++) {
 		strncpy (strptr, listptr[i], 32);
 		strptr+=strlen(listptr[i]);
 		*strptr=',';

Regards,
Alexey.

-- 
<------------------------->
 ) May the Sun and Water (   Regards, Alexey V. Neyman
 ) always fall upon you! (   mailto:alex.neyman@auriga.ru
<------------------------->


-- 
<------------------------->
 ) May the Sun and Water (   Regards, Alexey V. Neyman
 ) always fall upon you! (   mailto:alex.neyman@auriga.ru
<------------------------->
Comment 3 setantae 2001-11-30 15:09:11 UTC
That patch fixes the issue, thanks!

Ceri

-- 
keep a mild groove on
Comment 4 dwmalone freebsd_committer freebsd_triage 2001-11-30 16:50:49 UTC
State Changed
From-To: open->closed
Comment 5 dwmalone freebsd_committer freebsd_triage 2001-11-30 16:51:44 UTC
State Changed
From-To: closed->open

Closed by mistake.
Comment 6 ru freebsd_committer freebsd_triage 2001-12-19 08:48:24 UTC
State Changed
From-To: open->closed

Fixed in df.c, rev. 1.34 (5.0-CURRENT) and rev. 1.23.2.5 (4.4-STABLE). 


Comment 7 ru freebsd_committer freebsd_triage 2001-12-19 08:48:24 UTC
Responsible Changed
From-To: freebsd-bugs->ru
Comment 8 mikko 2001-12-19 19:34:20 UTC
Just a data point for anyone trying to reproduce the problem:

The bug is triggered by not having any network file systems loaded.
They don't have to be mounted, just loaded.  E.g. if "nfs" shows up
with "lsvfs", "df -l " will work, if not, it won't.

Thus:

  gw% lsvfs
  Filesystem                        Refs Flags
  -------------------------------- ----- ---------------
  ufs                                  5
  procfs                               1 synthetic
  gw% df -l
  gw%
  gw% su -m
  Password:
  gw# kldload nfs
  gw# ^D
  gw% lsvfs
  Filesystem                        Refs Flags
  -------------------------------- ----- ---------------
  ufs                                  5
  procfs                               1 synthetic
  nfs                                  0 network
  gw% df -l
  Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
  /dev/ad0s1a    254063    45332   188406    19%    /
  /dev/ad0s1g  34487716  1482012 30246688     5%    /home
  /dev/ad0s1e   2032623   519974  1350040    28%    /usr
  /dev/ad0s1f   2032623     2901  1867113     0%    /var
  procfs              4        4        0   100%    /proc
  /dev/vn0c      130020        4   119616     0%    /tmp

And, yes, the patch works.

         /Mikko

 Mikko Ty=F6l=E4j=E4rvi_______________________________________mikko@rsase=
curity.com
 RSA Security