On Tue May 30 19:08 2000 +0200, Jim Meyering wrote:
> "Mark D. Roth" <[EMAIL PROTECTED]> writes:
> 
> | On Mon May 29 17:39 2000 +0200, Jim Meyering wrote:
> | > Thanks for the patch.
> | > Could there be a method for checking this in one of AIX's header files?
> | > If not, I'll do as you suggest -- but I'd rather use strstr than strtok.
> | > Here's a bit of code that should be functionally equivalent to yours,
> | > assuming the fields are guaranteed to be comma-separated, with no white
> | > space.  Would you please test it?
> |
> | Looks good under AIX 4.2.1.  I'll test it under 4.3.3 when I have a
> | chance.
> 
> Thanks.

Actually, I may have spoken too soon.  Upon closer examination of the
code, I realized that it should actually be setting the me_dummy flag
instead of ignoring the entry alltogether.  If this isn't done, the
automount entries don't show up in the output of "df -a".  (This is
actually a problem with my original patch, not with your reworked
version.)

In addition, I noticed a small problem in dealing with the automounter
under IRIX 6.5.  The code was correctly ignoring the autofs entries in
the mtab file when the remote filesystem was not mounted, but it was
incorrectly displaying an extra entry when the filesystem was mounted,
like so:

roth@creepygirl:~> df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/root              4307148   1819536   2487612  42% /
/proc                   257108     86008    171100  33% /proc
/etc/auto_direct       8705496   4983544   3634904  58% /projects
tower.cso.uiuc.edu:/projects
                       8705496   4983544   3634904  58% /projects

Since both of these problems are related to how the me_dummy field is
set, it might not be a bad idea to generalize the ME_DUMMY macro such
that it can be used in all cases.  Currently, in addition to the AIX
issue, there is also an exception for the HAVE_GETMNTENT2 code used by
Solaris, which uses hasmntopt().  This also raises the question of why
hasmntopt() isn't used unless HAVE_GETMNTENT2 is defined, even on
systems that support it.

In any event, in leiu of a more generalized solution, I've attached a
new patch relative to fileutils-4.0s which fixes the problems under
both AIX and IRIX.  I've tested it under AIX 4.2.1, HP-UX 10.20, IRIX
6.5, RedHat Linux 6.1, and Solaris 7.

Please let me know if you have any questions or problems.

-- 
Mark D. Roth <[EMAIL PROTECTED]>
System Administrator, CCSO Production Systems Group
http://www.uiuc.edu/ph/www/roth
diff -urN fileutils-4.0s/lib/mountlist.c fileutils-4.0s-new/lib/mountlist.c
--- fileutils-4.0s/lib/mountlist.c      Mon May  1 03:03:23 2000
+++ fileutils-4.0s-new/lib/mountlist.c  Tue May 30 14:03:13 2000
@@ -725,6 +725,8 @@
     for (thisent = entries; thisent < entries + bufsize;
         thisent += vmp->vmt_length)
       {
+       char *options, *ignore;
+
        vmp = (struct vmount *) thisent;
        me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
        if (vmp->vmt_flags & MNT_REMOTE)
@@ -748,7 +750,11 @@
          }
        me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
        me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
-       me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+       options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
+       me->me_dummy = ((ignore = strstr (options, "ignore")) &&
+                        (ignore == options || ignore[-1] == ',') &&
+                        (ignore[sizeof "ignore" - 1] == ','
+                         || ignore[sizeof "ignore" - 1] == '\0'));
        me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want.  */
 
        /* Add to the linked list. */
diff -urN fileutils-4.0s/lib/mountlist.h fileutils-4.0s-new/lib/mountlist.h
--- fileutils-4.0s/lib/mountlist.h      Tue Jul 28 22:58:55 1998
+++ fileutils-4.0s-new/lib/mountlist.h  Tue May 30 11:38:02 2000
@@ -39,7 +39,7 @@
 
 #ifndef ME_DUMMY
 # define ME_DUMMY(fs_name, fs_type) \
-    (!strcmp (fs_type, "auto") || !strcmp (fs_type, "ignore"))
+    (!strcmp (fs_type, "auto") || !strcmp(fs_type, "autofs") || !strcmp (fs_type, 
+"ignore"))
 #endif
 
 #ifndef ME_REMOTE

Reply via email to