delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/10/12:06:06

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dk AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Cc: "'Max Bowsher'" <maxb AT ukf DOT net>
Subject: RE: What to do when setup fails?
Date: Wed, 10 Nov 2004 17:03:18 -0000
MIME-Version: 1.0
In-Reply-To: <Pine.GSO.4.61.0411101107210.4545@slinky.cs.nyu.edu>
Message-ID: <NUTMEGpVr8tYJyc1v3R00000648@NUTMEG.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 10 Nov 2004 17:03:18.0984 (UTC) FILETIME=[2D4CF480:01C4C747]
Note-from-DJ: This may be spam

------=_NextPart_000_0037_01C4C747.2D4A5C70
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

> -----Original Message-----
> From: Igor Pechtchanski [mailto:pechtcha AT cs DOT nyu DOT edu] 
> Sent: 10 November 2004 16:10

> Quoting the patch:
> 
> -    fatal ("mount");
> +  {
> +  char errbuffer[40];
> +    _snprintf (errbuffer, 40, "mount %d", GetLastError ());
> +    fatal (errbuffer);
> +  }
> 
> Umm, isn't this exactly what fatal() does already?
> 
> Quoting dialog.cc:
> 
> void
> fatal (const char *msg)
> {
>   DWORD e = GetLastError ();
>   char *buf;
>   FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | 
> FORMAT_MESSAGE_FROM_SYSTEM,
>                  0, e, 0, (CHAR *) & buf, 0, 0);
>   MessageBox (0, buf, msg, 0);
>   LogSingleton::GetInstance().exit (1);
>   // Keep gcc happy - some sort of bug!
>   exit (1);
> }

  Ah, didn't look closely at that.

  Ok, then according to Luke's original post....

>It fails due to mount, apparently.  A panel titled "Mount" pops up
>after the download stage, saying: "The operation completed
>successfully", and then setup exits.

..which must imply that RegCreateKeyEx returns some value other than
ERROR_SUCCESS, but at the same time GetLastError is returning zero.  Time to
check MSDN:

--------------------<quote usage="fair">--------------------
If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a nonzero error code defined in
Winerror.h. You can use the FormatMessage function with the
FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
--------------------<quote usage="fair">--------------------

...which *implies* that the error code is being returns, not SetLastError'd, and
so we're discarding it early.  Perhaps the following patch would be more like
it:

Index: mount.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/mount.cc,v
retrieving revision 2.16
diff -p -u -r2.16 mount.cc
--- mount.cc	11 Jul 2003 22:48:14 -0000	2.16
+++ mount.cc	10 Nov 2004 17:02:32 -0000
@@ -151,9 +151,14 @@ create_mount (String const posix, String
 	   CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
 
   HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  if (RegCreateKeyEx (kr, buf, 0, (char *)"Cygwin", 0, KEY_ALL_ACCESS,
-		      0, &key, &disposition) != ERROR_SUCCESS)
-    fatal ("mount");
+  LONG retval = RegCreateKeyEx (kr, buf, 0, (char *)"Cygwin", 0, 
+	   KEY_ALL_ACCESS, 0, &key, &disposition);
+  if (retval != ERROR_SUCCESS)
+  {
+  char errbuffer[40];
+    _snprintf (errbuffer, 40, "Mount error %d", retval);
+    fatal (errbuffer);
+  }
 
   RegSetValueEx (key, "native", 0, REG_SZ, (BYTE *) win32.cstr_oneuse (),
 		 win32.size () + 1);



    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

------=_NextPart_000_0037_01C4C747.2D4A5C70
Content-Type: application/octet-stream;
	name="setup-mnt-err-patch.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="setup-mnt-err-patch.diff"

Index: mount.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/mount.cc,v
retrieving revision 2.16
diff -p -u -r2.16 mount.cc
--- mount.cc	11 Jul 2003 22:48:14 -0000	2.16
+++ mount.cc	10 Nov 2004 17:02:32 -0000
@@ -151,9 +151,14 @@ create_mount (String const posix, String
 	   CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
 
   HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  if (RegCreateKeyEx (kr, buf, 0, (char *)"Cygwin", 0, KEY_ALL_ACCESS,
-		      0, &key, &disposition) != ERROR_SUCCESS)
-    fatal ("mount");
+  LONG retval = RegCreateKeyEx (kr, buf, 0, (char *)"Cygwin", 0, 
+	   KEY_ALL_ACCESS, 0, &key, &disposition);
+  if (retval != ERROR_SUCCESS)
+  {
+  char errbuffer[40];
+    _snprintf (errbuffer, 40, "Mount error %d", retval);
+    fatal (errbuffer);
+  }
 
   RegSetValueEx (key, "native", 0, REG_SZ, (BYTE *) win32.cstr_oneuse (),
 		 win32.size () + 1);


------=_NextPart_000_0037_01C4C747.2D4A5C70
Content-Type: text/plain; charset=us-ascii

--
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/
------=_NextPart_000_0037_01C4C747.2D4A5C70--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019