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/