setup.exe: Unhandled Exception if local copy of package has wrong md5sum but right filesize

David A. Cobb Superbiskit@cox.net
Tue Sep 14 20:11:00 GMT 2004


This looks like a very plausible candidate for the bug reported by 
Kenneth Shaffer on/about 08/28, and possibly the one I griped about 
around the same day.  Wow, a patch!  Fantastic.  Can we get a snapshot 
build with this sometime RSN??  Right now I'm not real confident in my 
own build environment.

Igor Pechtchanski wrote:

>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 != p  kgsource.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();
>
>  
>

-- 
David A. Cobb, Software Engineer, Public Access Advocate
"By God's Grace, I am a Christian man; by my actions a great sinner." -- The Way of a Pilgrim: R.French, Tr.
Life is too short to tolerate crappy software!



-------------- next part --------------
A non-text attachment was scrubbed...
Name: Superbiskit.vcf
Type: text/x-vcard
Size: 260 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20040914/6793cbc6/attachment.vcf>


More information about the Cygwin-apps mailing list