Two problems with arla 0.25

Assar Westerlund assar at stacken.kth.se
Wed Jun 23 03:40:07 CEST 1999


Rainer Schoepf <schoepf at uni-mainz.de> writes:
> 1. The build process fails because the name of the xfs module in
> xfs/solaris is the same as the name of the include directory. That's
> easy to solve, I changed the module name in the Makefile to
> xfs_module.

Yes, this is a known problem, which I usually solve by building in a
directory different from the source.

> 2. I see a strange behaviour when a directory is created, populated
> and deleted immediately afterwards. This happened while I was trying
> to build egcs. I boiled it down to the following sequence of commands:
> 
> mkdir tmpcopy
> if [ xlibgcc1.null != x ];                      \
> then (cd tmpcopy; ar x ../libgcc1.null);        \
> else true;                                      \
> fi
> (cd tmpcopy; chmod +w * > /dev/null 2>&1)
> (cd tmpcopy; ar x ../libgcc2.a)
> (cd tmpcopy; ar rc ../tmplibgcc.a *.o)
> rm -rf tmpcopy
> sleep 3
> rm -rf tmpcopy

Thanks for taking the time to isolate this problem.  I have
constructed a test case for this problem and it seems like the
following set of patches solves it.  Can you try if they work for you
too?

/assar

Index: arlad/messages.c
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/arlad/messages.c,v
retrieving revision 1.132
diff -u -w -u -w -r1.132 messages.c
--- messages.c	1999/06/20 03:44:36	1.132
+++ messages.c	1999/06/23 01:06:56
@@ -1360,6 +1360,18 @@
 	     goto out;
 	 }
 	     
+	 ret = dir_remove_name (dir_entry, h->name,
+				&msg.cache_handle,
+				msg.cache_name,
+				sizeof(msg.cache_name));
+	 if (ret) {
+	     fcache_release (dir_entry);
+	     goto out;
+	 }
+
+
+
+#if 0
 	 res = conv_dir (dir_entry, ce, 0,
 			 &msg.cache_handle,
 			 msg.cache_name,
@@ -1369,9 +1381,10 @@
 	     ret = res.error;
 	     goto out;
 	 }
+#endif
 
 	 msg.flag = XFS_INVALID_DNLC;
-	 msg.node.tokens = res.tokens;
+	 msg.node.tokens = res.tokens | XFS_DATA_R;
 
 	 fcacheentry2xfsnode (parent_fid,
 			      &dir_entry->realfid,
Index: arlad/subr.h
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/arlad/subr.h,v
retrieving revision 1.6
diff -u -w -u -w -r1.6 subr.h
--- subr.h	1998/09/08 08:24:39	1.6
+++ subr.h	1999/06/23 00:08:07
@@ -48,6 +48,11 @@
 Result
 conv_dir (FCacheEntry *e, CredCacheEntry *ce, u_int tokens,
 	  xfs_cache_handle *, char *, size_t);
+
+int
+dir_remove_name (FCacheEntry *e, const char *filename,
+		 xfs_cache_handle *cache_handle,
+		 char *cache_name, size_t cache_name_sz);
 
 #endif /* _SUBR_H_ */
 
Index: arlad/solaris-subr.c
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/arlad/solaris-subr.c,v
retrieving revision 1.14
diff -u -w -u -w -r1.14 solaris-subr.c
--- solaris-subr.c	1998/11/10 03:35:18	1.14
+++ solaris-subr.c	1999/06/23 01:18:35
@@ -138,4 +138,54 @@
      if ((res.res = close (args.fd)) != 0)
 	  res.error = errno;
      return res;
+}
+
+/*
+ * remove `filename` from the converted directory for `e'
+ */
+
+int
+dir_remove_name (FCacheEntry *e, const char *filename,
+		 xfs_cache_handle *cache_handle,
+		 char *cache_name, size_t cache_name_sz)
+{
+    int ret;
+    int fd;
+    fbuf fb;
+    struct stat sb;
+    char *buf;
+    char *p;
+    size_t len;
+    struct dirent64 *dp;
+    struct dirent64 *last_dp;
+
+    fcache_extra_file_name (e, cache_name, cache_name_sz);
+    fd = open (cache_name, O_RDWR, 0);
+    if (fd < 0)
+	return errno;
+    fcache_fhget (cache_name, cache_handle);
+    if (fstat (fd, &sb) < 0) {
+	ret = errno;
+	close (fd);
+	return ret;
+    }
+    len = sb.st_size;
+
+    ret = fbuf_create (&fb, fd, len, FBUF_WRITE);
+    if (ret)
+	return ret;
+    last_dp = NULL;
+    for (p = buf = fbuf_buf (&fb); p < buf + len; p += dp->d_reclen) {
+	dp = (struct dirent64 *)p;
+
+	if (strcmp (filename, dp->d_name) == 0) {
+	    last_dp->d_reclen += dp->d_reclen;
+	    dp->d_ino = 0;
+	    fbuf_end (&fb);
+	    return 0;
+	}
+	last_dp = dp;
+    }
+    fbuf_end (&fb);
+    return ENOENT;
 }





More information about the Arla-drinkers mailing list