Still have problems with libfile

Alex Waugh alex at alexwaugh.com
Wed Aug 28 12:17:01 PDT 2002


In message <67b3306d4b.peter at moo.chocky.org>
          Peter Naulls <peter at chocky.org> wrote:

> In message <a06a256d4b.ajw498 at alexwaugh.com>
>           Alex Waugh <alex at alexwaugh.com> wrote:
> 
> > The recent changes did not update the ar frontend, this patch does that,
> > but the two are still not giving identical output.
> 
> I've applied the patch, but it doesn't help.  I may try with libfile
> instead.   The two not giving the same output doesn't sound very
> helpful.  Do you have a minimal case you can put in the bug database?

Actually, the reason they weren't producing identical files is because
the timestamps of the members were different, however ar wasn't working
when libfile was because the x option was not behaving as expected.

When the x option is specified to ar, it should extract all members
listed on the command line, but if no members are specified, it should
extract all members. The latter wasn't implemented, and the former,
along with the corresponding libfile -e, was broken (the destDir string
was never suitably initialised).
Additionally, the libfile -q option was ignored when -x was specified. 

The following patch fixes all of the above, and also includes the patch
I posted earlier.


Index: riscos-aof/libfile/Ar.cc
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/libfile/Ar.cc,v
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.3 Ar.cc
--- riscos-aof/libfile/Ar.cc	26 Jul 2002 11:48:50 -0000	1.1.1.1.2.3
+++ riscos-aof/libfile/Ar.cc	28 Aug 2002 17:55:50 -0000
@@ -62,6 +62,12 @@
   if (m_argParser->getOption ("-V"))
     version ();
 
+#ifdef CROSS_COMPILE
+  destDir = "./";
+#else
+  destDir = "@.";
+#endif
+
   // Delete modules from the archive
   if (m_argParser->getOption ("-d"))
     action = ActionDelete;
@@ -73,7 +79,12 @@
 
   // Extract members from the archive
   if (m_argParser->getOption ("-x"))
-    action = ActionExtract;
+    {
+      if (argList.length() == 0)
+        action = ActionExtractAll;
+      else
+        action = ActionExtract;
+    }
 
   if (m_argParser->getOption ("-c"))
     action = ActionCreate;
@@ -112,8 +123,8 @@
 	};
     case ActionCreate:
       library->addMembers (argList);
-      library->updateOflSymt ();
       library->updateOflTime ();
+      library->updateOflSymt ();
       library->save ();
       break;
 
@@ -122,6 +133,11 @@
       library->extractMembers (argList, destDir);
       break;
 
+    case ActionExtractAll:
+      library->load();
+      library->extractAllMembers(destDir);
+      break;
+
     case ActionExtractDelete:
     case ActionDelete:
       library->load ();
@@ -129,8 +145,8 @@
 	library->extractMembers (argList, destDir);
 
       library->deleteMembers (argList);
-      library->updateOflSymt ();
       library->updateOflTime ();
+      library->updateOflSymt ();
       library->save ();
       break;
 
Index: riscos-aof/libfile/Ar.h
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/libfile/Ar.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Ar.h
--- riscos-aof/libfile/Ar.h	8 Nov 2000 09:38:58 -0000	1.1.1.1
+++ riscos-aof/libfile/Ar.h	28 Aug 2002 17:55:50 -0000
@@ -14,6 +14,7 @@
 	{
 		ActionCreate, ActionInsert,
 		ActionDelete, ActionExtract,
+		ActionExtractAll,
 		ActionExtractDelete,
 		ActionNone
 	};
Index: riscos-aof/libfile/Librarian.cc
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/libfile/Librarian.cc,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 Librarian.cc
--- riscos-aof/libfile/Librarian.cc	18 Aug 2002 18:40:56 -0000	1.2.2.3
+++ riscos-aof/libfile/Librarian.cc	28 Aug 2002 17:55:52 -0000
@@ -37,7 +37,12 @@
  if(m_argParser->getOption("-v", viaFile))
   	m_argParser->addArgsFromFile(viaFile);
 
- m_argParser->getOption("-q", destDir);
+ if(!m_argParser->getOption("-q", destDir))
+#ifdef CROSS_COMPILE
+   destDir = "./";
+#else
+   destDir = "@.";
+#endif
 
  if(m_argParser->getOption("-h"))
  {
@@ -126,13 +131,6 @@
 
 	case ActionExtractAll:
 		library->load();
-#ifdef CROSS_COMPILE
-		if(!m_argParser->getOption("-p"))
-		  destDir = "./";
-#else
-		if(!m_argParser->getOption("-p"))
-		  destDir = "@.";
-#endif
 		library->extractAllMembers(destDir);
 		break;
 
 

-- 
Alex Waugh                                           alex at alexwaugh.com

PHP, Roots, Subversion, WebJames and more from http://www.alexwaugh.com/



More information about the gcc mailing list