bug #1283: autofs'mount'ed drives ignored (e.g. "A:" on /vol/a via autofs master.vol)

Guido Draheim guidod-2003- at gmx.de
Sun Feb 16 20:58:24 CST 2003


The following text is a shortened description of
the bug - a long description, screenshots and patches
can be found at

      http://freespace.sf.net/guidod/wine-vol-a/

further (lengthy) comments can be found in the bugzilla
logs where Tony Lambregts was kindly reviewing and
accepting the patch:

      http://bugs.winehq.com/show_bug.cgi?id=1283

The problem:
    If there is no medium in a autofs mounted floppy
    drive at startup of wine, then files on the floppy
    are inaccessible even when a medium is inserted later.

The diagnosis:
    The DRIVE_Init will throw away any mount-point that
    does not exist at startup time - it does not make
    it to the internal drive. It will not check later
    whether the mount-point came into existance somewhen
    in between - you need to restart

The real way:
    There is no need to keep this behaviour, the wine's
    drive access method can handle it that a mount-point
    is removed somewhere in between: it prints warning
    messages and continues to work properly. This is
    partly the windowish way: just say the drive is
    inaccessible as warning during runtime, do not
    kill it beforehand.

The patch:
    A .wine/config boolean option "AutoMount" is introduced
    that will default to the old behavior. When being
    enabled then a warning-message logged but the drive
    is kept in the internal drivelist and can be seen in
    the file-open dialog-box.

At the moment, applications work properly with wine cvs
but we still need to patch the sources like that to make
it useable for us.

cheers, guido                   counter.li.org #81555

-------------- next part --------------
Index: files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.84
diff -u -r1.84 drive.c
--- files/drive.c	24 Jan 2003 00:54:58 -0000	1.84
+++ files/drive.c	17 Feb 2003 02:49:51 -0000
@@ -204,6 +204,7 @@
     static const WCHAR ReadVolInfoW[] = {'R','e','a','d','V','o','l','I','n','f','o',0};
     static const WCHAR FailReadOnlyW[] = {'F','a','i','l','R','e','a','d','O','n','l','y',0};
     static const WCHAR driveC_labelW[] = {'D','r','i','v','e',' ','C',' ',' ',' ',' ',0};
+    static const WCHAR AutoMountW[] = {'A','u','t','o','M','o','u','n','t',0};
 
     for (i = 0, drive = DOSDrives; i < MAX_DOS_DRIVES; i++, name[6]++, drive++)
     {
@@ -235,15 +236,24 @@
                 WideCharToMultiByte(drive->codepage, 0, path, -1, drive->root + strlen(drive->root), len, NULL, NULL);
             }
 
-            if (stat( drive->root, &drive_stat_buffer ))
+            if (stat( drive->root, &drive_stat_buffer )) 
             {
-                MESSAGE("Could not stat %s (%s), ignoring drive %c:\n",
-                        drive->root, strerror(errno), 'A' + i);
-                HeapFree( GetProcessHeap(), 0, drive->root );
-                drive->root = NULL;
-                continue;
+                if (PROFILE_GetWineIniBool (name, AutoMountW, 0))
+                {
+                    MESSAGE("Could not stat %s (%s), keeping automount drive %c:\n",
+                            drive->root, strerror(errno), 'A' + i);
+                    /* never match in DRIVE_FindDriveRoot */
+                    drive_stat_buffer.st_dev = 0;
+                    drive_stat_buffer.st_ino = 0;
+                }else{
+                    MESSAGE("Could not stat %s (%s), ignoring drive %c:\n",
+                            drive->root, strerror(errno), 'A' + i);
+                    HeapFree( GetProcessHeap(), 0, drive->root );
+                    drive->root = NULL;
+                    continue;
+                }
             }
-            if (!S_ISDIR(drive_stat_buffer.st_mode))
+            else if (!S_ISDIR(drive_stat_buffer.st_mode))
             {
                 MESSAGE("%s is not a directory, ignoring drive %c:\n",
                         drive->root, 'A' + i );
Index: documentation/configuring.sgml
===================================================================
RCS file: /home/wine/wine/documentation/configuring.sgml,v
retrieving revision 1.22
diff -u -r1.22 configuring.sgml
--- documentation/configuring.sgml	24 Dec 2002 00:56:33 -0000	1.22
+++ documentation/configuring.sgml	17 Feb 2003 02:49:56 -0000
@@ -226,6 +226,16 @@
             (The |'s mean "Type = '&lt;one of the options&gt;'".)
 	    Usually, you choose "hd" for a drive ("hd" is default anyway).
           </para>
+	  <para>
+	    <programlisting>"Automount" = "1"</programlisting>
+	    This option is useful with some automounters (e.g. 
+	    "autofs" in Linux). These will only create the path 
+	    when the target is accessible, e.g. a medium is 
+	    inserted ("Type" = "cdrom|floppy") or the network share 
+	    reachable. If this option is present and non-zero then 
+	    the drive X is accepted with the given path/type/device 
+	    even when the "Path" is not existant during startup.
+	  </para>
           <para>
             <programlisting>"Label" = "blah"</programlisting>
 	    Defines the drive label. Generally only needed
Index: documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.39
diff -u -r1.39 config
--- documentation/samples/config	12 Feb 2003 01:12:18 -0000	1.39
+++ documentation/samples/config	17 Feb 2003 02:49:57 -0000
@@ -21,6 +21,7 @@
 ;;   - "msdos" for FAT16 (ugly, upgrading to VFAT driver strongly recommended)
 ;;   DON'T use "unix" unless you intend to port programs using Winelib !
 ;; "Device"="/dev/xx" (only if you want to allow raw device access)
+;; "Automount"="x" "1"= Drive is Automounted by native file system
 ;;
 [Drive A]
 "Path" = "/mnt/fd0"
@@ -29,6 +30,7 @@
 "Filesystem" = "win95"
 "Serial" = "87654321"
 "Device" = "/dev/fd0"
+;"Automount" = "1"
 
 [Drive C]
 "Path" = "/c"


More information about the wine-patches mailing list