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

Guido Draheim guidod-2003- at gmx.de
Mon Jul 28 18:08:58 CDT 2003


as usual, patch regenerated due to changs in cvs.
again, please apply, it's needed! bcc sent. --guido

Guido Draheim wrote:
> patch regenerated due to changes in cvs.
> please bla bla bla, whatever.
> 
> bcc sent to selected wine rpm makers, if you are not yet
> on my bcc list, please contact me, thank you, -- guidod
> 
> Guido Draheim schrieb:
> 
>> Patch regenerated - there's been a two line offset
>> in documentation/configuring.sgml - three files affected:
>>
>> $ patch -p0 < ../wine-vol-a/wine-20030420-autofs.patch
>> patching file documentation/configuring.sgml
>> patching file documentation/samples/config
>> patching file files/drive.c
>>
>> It's the six month anniversary of this patch and also
>> two months after   Tony Lambregts   did kindly help me
>> to clean this patch up ready for acceptance. -- guido
>>
>> Guido Draheim schrieb:
>>
>>> 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: documentation/configuring.sgml
===================================================================
RCS file: /home/wine/wine/documentation/configuring.sgml,v
retrieving revision 1.32
diff -u -r1.32 configuring.sgml
--- documentation/configuring.sgml	21 Jul 2003 22:42:50 -0000	1.32
+++ documentation/configuring.sgml	28 Jul 2003 22:59:41 -0000
@@ -470,6 +470,16 @@
 	    linkend="config-drive-main">Wine file system layer
 	    configuration section</link>.
           </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>"GraphicsDriver" = "x11drv|ttydrv"</programlisting>
   	    Sets the graphics driver to use for Wine output.
Index: documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.47
diff -u -r1.47 config
--- documentation/samples/config	24 Jul 2003 00:05:04 -0000	1.47
+++ documentation/samples/config	28 Jul 2003 22:59:42 -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"
Index: files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.91
diff -u -r1.91 drive.c
--- files/drive.c	21 Jul 2003 20:02:23 -0000	1.91
+++ files/drive.c	28 Jul 2003 22:59:46 -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 );


More information about the wine-patches mailing list