delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/04/13/09:23:43

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
X-Authentication-Warning: abomination.cygnus.com: mdejong owned process doing -bs
Date: Thu, 13 Apr 2000 07:23:48 -0700 (PDT)
From: Mo DeJong <mdejong AT cygnus DOT com>
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: More setup changes
In-Reply-To: <20000413012229.A11346@cygnus.com>
Message-ID: <Pine.LNX.4.10.10004130706200.27135-100000@abomination.cygnus.com>
MIME-Version: 1.0

On Thu, 13 Apr 2000, Chris Faylor wrote:

> I have modified setup to always try to set the write bit on the files that
> it extracts.  To do this, I had to monitor tar's output so I took the
> opportunity to build a list of files on the fly rather than reading this
> from a file.
> 
> I also start up cygpath in the background so that it can be used as a
> "filename translation engine".  cygpath can now accept filenames on
> its stdin, spitting out translated filenames to stdout.
> 
> The end result is that I think that setup is quite a bit faster now.
> The creation of the uninstall bat file is fast enough that it doesn't
> make sense to track its progress.
> 
> setup's log file is now serves no function other than to monitor the
> files that have been extracted.  If there are error messages, I write
> them to both the log file and to stderr.
> 
> Corinna, I would be interested in hearing if this version of setup
> works better for you.
> 
> cgf


Chris, there is now a problem with the generated uninstall
script (I don't know if it was caused by your changes).

When I ran the uninstall script from the Windows menu a
dos window showed up. It contained the following message.

All files in directory will be deleted!
Are you sure (Y/N)?

That is a little scary, would it really delete ALL files?

This message is being printed by the Win 95 del
command when it is passed a directory instead
of a file. The cause of this problem is deep
down in setup.c.

A directory like usr/bin/ in the tar file was
getting converted to C:\Cygwin\usr\bin, so
setup.c thought it is was a file not a directory.
When setup.c goes to write out the command to
delete a file or directory, it checks to see
if the name ends with a \ char.

I do not know if this ever worked, but it is
broken now so I whipped up a patch for the
problem. This patch will append a \ char on
the end of a filename that setup.c is processing.

This also changes the directory where the uninstaller
will cd to internally and turns the install.bat
file into a windows style name so it can be deleted.

This patch also adds /usr/local/bin to the default
PATH set in cygwin.bat. Users that install programs
with autoconf will be installing into /usr/local
by default so it should be on the PATH.

Oh yeah, this patch also fixes a little compiler warning
(the void ** bit).

Mo Dejong
Red Hat Inc.

Index: winsup/cinstall/setup.c
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/setup.c,v
retrieving revision 1.11
diff -u -r1.11 setup.c
--- setup.c	2000/04/13 06:05:56	1.11
+++ setup.c	2000/04/13 14:04:38
@@ -72,7 +72,7 @@
       sl->lpVtbl->SetArguments (sl, args);
       xfree (path);
 
-      hres = sl->lpVtbl->QueryInterface (sl, &IID_IPersistFile, &pf);
+      hres = sl->lpVtbl->QueryInterface (sl, &IID_IPersistFile, (void **)
&pf);
 
       if (SUCCEEDED (hres))
 	{
@@ -184,6 +184,7 @@
   while (fgets (buffer, sizeof (buffer0), fp))
     {
       char *s = strchr (buffer, '\n');
+      int isDir;
 
       if (s)
 	*s = '\0';
@@ -201,8 +202,21 @@
 	  s = buffer;
 	  if (*s != '/')
 	    *--s = '/';
-	  s = files.array[files.index] = utodpath (s);
+	  isDir = (s[strlen(s) - 1] == '/');
+	  s = utodpath(s);
 	  (void) chmod (s, 0777);
+
+	  if (isDir) { /* append a \ so we know it's a dir */
+	    strcpy(buffer,s);
+	    buffer[strlen(s)+1] = '\0';
+	    buffer[strlen(s)] = '\\';
+	    xfree(s);
+	    s = xmalloc(strlen(buffer) + 1);
+	    strcpy(s, buffer);
+	  }
+
+	  files.array[files.index] = s;
+	  /*fprintf (stdout, "post utodpath \"%s\", isDir %d\n", s,
isDir); */
 	}
 
       fprintf (logfp, "%s\n", s);
@@ -753,7 +767,7 @@
 
 	  getcwd (cwd, sizeof (cwd));
 	  fprintf (uninst,
-		   "@echo off\n" "%c:\n" "cd \"%s\"\n", *cwd, cwd);
+		   "@echo off\n" "%c:\n" "cd \\\n", *cwd);
 	  for (n = 0; n < files.count; ++n)
 	    {
 	      char *dpath;
@@ -763,8 +777,11 @@
 
 	      dpath = files.array[n];
 
-	      if (files.array[n][strlen (files.array[n]) - 1] == '\\')
-		fprintf (uninst, "rmdir \"%s\"\n", dpath);
+	      if (dpath[strlen (dpath) - 1] == '\\')
+	        {
+		  dpath[strlen (dpath) - 1] = '\0'; /* rmdir foo\" is bad
*/
+		  fprintf (uninst, "rmdir \"%s\"\n", dpath);
+	        }
 	      else
 		{
 		  if (access (dpath, 6) != 0)
@@ -776,8 +793,8 @@
 		   "del \"%s\"\n"
 		   "del \"%s\"\n"
 		   "rmdir \"%s\"\n"
-		   "del bin\\uninst.bat\n", shortcut, shellscut,
-		   folder);
+		   "del \"%s\\bin\\uninst.bat\"\n", shortcut, shellscut,
+		   folder, cwd);
 	  fclose (uninst);
 
 	  uninstfile = pathcat (cwd, "bin\\uninst.bat");
@@ -819,7 +836,7 @@
 	  fprintf (batch,
 		   "@echo off\n"
 		   "SET MAKE_MODE=unix\n"
-		   "SET PATH=%s\\bin;%%PATH%%\n"
+		   "SET PATH=%s\\bin;%s\\usr\\local\\bin;%%PATH%%\n"
 		   "bash\n", root, root);
 	  fclose (batch);

- Raw text -


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