public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* nfs-server-2.3-2 Cygwin bug with patch
@ 2005-08-05 22:15 Linus Hicks
  0 siblings, 0 replies; only message in thread
From: Linus Hicks @ 2005-08-05 22:15 UTC (permalink / raw)
  To: cygwin

I tried sending a message to the email address given in the BUGS file in the nfs 
-server sources, but it bounced so I submit it here.

I was having a problem with doing an nfs mount on a Linux system and from what I 
found in the code, it's because I am exporting a shared drive on my Windows 
Cygwin machine. From reading the documentation, it is possible to do this, but I 
couldn't get it to work so I started looking at the code. What I did was first 
in Cygwin, mount the shared drive on an existing directory I created for it, 
then put that path in my exports file.

I found two problems. First was that when the directory wasn't found because of 
the other error, the code in libnfs/fhandle.c function fh_buildpath failed to 
set the path correctly when it goes shallower. This results in "Cannot stat 
<file>" error messages.

The second problem was also in libnfs/fhandle.c function path_psi. I noticed in 
the fh_buildpath function that there was conditionally compiled code for Cygwin 
that had to do with changing how the pseudo inode is generated. There was no 
similar code in path_psi.

My patch follows, please be aware my email program is wrapping a couple of 
lines, and I'm hoping the tab characters don't get replaced with spaces:

--------------------------------------------------------------------------------
diff -Naur nfs-server-2.3-2-orig/libnfs/fhandle.c nfs-server-2.3-2/libnfs/fhandle.c
--- nfs-server-2.3-2-orig/libnfs/fhandle.c	2005-04-29 14:06:14.001000000 -0400
+++ nfs-server-2.3-2/libnfs/fhandle.c	2005-08-05 15:38:15.052254000 -0400
@@ -620,11 +620,15 @@
  		char dpath[PATH_MAX + NAME_MAX + 1];
  		char* dpath_name = NULL;
  		struct stat dstat;
+#endif /* __CYGWIN__ */
+
+	      backtrack:
+
+#ifdef __CYGWIN__
  		strcpy(dpath, pathbuf);
  		dpath_name = dpath + strlen(dpath);
  #endif /* __CYGWIN__ */

-	      backtrack:
  		if (stat(pathbuf, &sbuf) >= 0
  		    && (dir = opendir(pathbuf)) != NULL) {
  			pathlen = strlen(pathbuf);
@@ -828,6 +832,14 @@
  {
  	struct stat sbuf;

+#ifdef __CYGWIN__
+	char dpath[PATH_MAX + NAME_MAX + 1];
+	char* dpath_name = NULL;
+	struct stat dstat;
+
+	strcpy(dpath, path);
+#endif /* __CYGWIN__ */
+
  	if (sbp == NULL)
  		sbp = &sbuf;
  	if (!svalid && lstat(path, sbp) < 0) {
@@ -898,6 +910,14 @@
  				} while (strcmp(fname, dp->d_name) != 0);
  				sbp->st_dev = ddbuf.st_dev;
  				sbp->st_ino = dp->d_ino;
+#ifdef __CYGWIN__
+				if (lstat(dpath, &dstat) < 0) {
+					dbg_printf(__FILE__, __LINE__, L_ERROR, "Cannot stat %s\n", dpath);
+					return NULL;
+				}
+				sbp->st_dev = dstat.st_dev;
+				sbp->st_ino = dstat.st_ino;
+#endif /* __CYGWIN__ */
  				closedir(dirp);
  			}
  		}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-05 22:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-05 22:15 nfs-server-2.3-2 Cygwin bug with patch Linus Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).