This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setup.exe: Unhandled Exception if local copy of package haswrong md5sum but right filesize


On Sun, 12 Sep 2004, huafbauer wrote:

> Hello,
> I got the a error message by installing from a local package directory.
> This error looks with version 2.427 like:
>
> 	Microsoft Visual C++ Runtime Library
>
> 	(X)  Runtime Error!
> 	Program: G:\transfer\private\cygwin-inst\test-cygwin\setup.exe
> 	This application has requested the Runtime to terminate it in unusual way.
> 	Please contact the application's support team for more information.
>
> (like in message http://www.cygwin.com/ml/cygwin/2002-08/msg00002.html)
>
> or with version 2.431
>
> 	setup-2.431.exe
> 	setup-2.431.exe has encountered a problem and needs to
> 	close. We are sorry for the inconvenience.
> 	...
>
> with this patch (against cvs 20040912) a fatal messagebox opens instead:

Next time, please attach the patch instead of including it inline, because
of the line wrapping in your mail client.

Also, some of the patch was gratuitous formatting and whitespace changes.
The relevant (IMO) snippet is included below (haven't tested whether it
applies, though).
	Igor

diff U3 C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup.org\cygwin-setup\setup\download.cc C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup\setup\download.cc
--- C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup.org\cygwin-setup\setup\download.cc Sun Sep 12 21:53:24 2004
+++ C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup\setup\download.cc Sun Sep 12 21:29:26 2004
@@ -123,32 +123,30 @@
   String prefix = String ("file://") + local_dir +  "/";
   DWORD size;
   if ((size = get_file_size (prefix + pkgsource.Canonical ())) > 0)
-    if (size == pkgsource.size)
+    if (size == pkgsource.size && validateCachedPackage (prefix + pkgsource.Canonical (), pkgsource))
       {
-	if (validateCachedPackage (prefix + pkgsource.Canonical (), pkgsource))
-	  pkgsource.set_cached (prefix + pkgsource.Canonical ());
+	pkgsource.set_cached (prefix + pkgsource.Canonical ());
+	return 1;
+      }
 	else
 	  throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Package validation failure for ") + prefix + pkgsource.Canonical (), APPERR_CORRUPT_PACKAGE);
-	return 1;
-      }

   /*
      2) is there a version from one of the selected mirror sites available ?
    */
   for (packagesource::sitestype::const_iterator n = pkgsource.sites.begin();
        n != pkgsource.sites.end(); ++n)
     {
       String fullname = prefix + rfc1738_escape_part (n->key) + "/" +
 	pkgsource.Canonical ();
     if ((size = get_file_size (fullname)) > 0)
-      if (size == pkgsource.size)
+      if (size == pkgsource.size && validateCachedPackage (fullname, pkgsource))
 	{
-	  if (validateCachedPackage (fullname, pkgsource))
-	    pkgsource.set_cached (fullname );
-	  else
-	    throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Package validation failure for ") + fullname, APPERR_CORRUPT_PACKAGE);
+	  pkgsource.set_cached (fullname );
 	  return 1;
 	}
+      else
+	throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Package validation failure for ") + fullname, APPERR_CORRUPT_PACKAGE);
   return 0;
 }

diff U3 C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup.org\cygwin-setup\setup\package_meta.cc C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup\setup\package_meta.cc
--- C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup.org\cygwin-setup\setup\package_meta.cc Sun Apr 25 10:00:13 2004
+++ C:\Documents and Settings\BUEBELACKER\source\cygwin-setup\cygwin-setup\setup\package_meta.cc Sun Sep 12 21:31:26 2004
@@ -43,7 +43,10 @@
 #include "package_db.h"

 #include <algorithm>
-#include "Generic.h"
+#include "Generic.h"
+
+#include "Exception.h"
+#include "resource.h"

 using namespace std;

@@ -654,8 +657,16 @@
       for (set<packageversion>::iterator i = pkg.versions.begin ();
     i != pkg.versions.end (); ++i)
   {
-       /* scan doesn't alter operator == for packageversions */
-      const_cast<packageversion &>(*i).scan();
+        try {
+          /* scan doesn't alter operator == for packageversions */
+          const_cast<packageversion &>(*i).scan();
+        }
+        catch (Exception *e) {
+          if (e->errNo() == APPERR_CORRUPT_PACKAGE) {
+		        fatal(NULL, IDS_CORRUPT_PACKAGE,
+                  ( i->Name() + "-" + i->Canonical_version() ).cstr_oneuse() );
+          }
+        }
      packageversion foo = *i;
    packageversion pkgsrcver = foo.sourcePackage();
     pkgsrcver.scan();

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]