Re: copy_file_file() fails on cygwin when the source is on externel FS (extfs)



Hi, Pavel!

> Please, take a look a the following link:
> http://www.cygwin.com/ml/cygwin/2002-07/msg00786.html

Looks like a bug in Cygwin that need to be fixed.

> The problem is that the temporary file (/tmp/extfsXXXXXX), representing a
> file in the external FS, is  opened with O_RDONLY and O_APPEND.
> 
> I was curious what is the purpose of O_LINEAR if we're opening the file for
> reading.

There is an explanation in vfs.h.  O_LINEAR is used as a kludge to inform
VFS that the file will be read without seeks.  However, VFS should not 
pass this kludge to the real open().

This bug has been fixed.  The new snapshot is waiting for you.  Thanks!
You can simply apply this patch (in vfs directory):

==========================
--- ChangeLog
+++ ChangeLog
@@ -1 +1,9 @@
+2002-07-10  Pavel Roskin  <proski gnu org>
+
+	* direntry.c (vfs_s_open): Don't pass O_LINEAR to open() -
+	this flag is for VFS only, and causes side effects in Cygwin.
+	* extfs.c (extfs_open): Likewise.
+	* sfs.c (sfs_open): Likewise.
+	Reported by Pavel Tsekov <ptsekov gmx net>
+
 2002-07-03  Pavel Roskin  <proski gnu org>
--- direntry.c
+++ direntry.c
@@ -800,7 +800,7 @@ vfs_s_open (vfs *me, char *file, int fla
 	}
 
     if (fh->ino->localname){
-	fh->handle = open (fh->ino->localname, flags, mode);
+	fh->handle = open (fh->ino->localname, NO_LINEAR(flags), mode);
 	if (fh->handle == -1){
 	    g_free(fh);
 	    ERRNOR (errno, NULL);
--- extfs.c
+++ extfs.c
@@ -657,7 +657,8 @@ static void *extfs_open (vfs *me, char *
         g_free (cmd);
     }
     
-    local_handle = open (entry->inode->local_filename, flags, mode);
+    local_handle = open (entry->inode->local_filename, NO_LINEAR(flags),
+			 mode);
     if (local_handle == -1) ERRNOR (EIO, NULL);
     
     extfs_info = g_new (struct pseudofile, 1);
--- sfs.c
+++ sfs.c
@@ -157,7 +157,7 @@ sfs_open (vfs *me, char *path, int flags
     int fd;
 
     path = redirect (me, path);
-    fd = open (path, flags, mode);
+    fd = open (path, NO_LINEAR(flags), mode);
     if (fd == -1)
 	return 0;
 
==========================

-- 
Regards,
Pavel Roskin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]