This is the mail archive of the cygwin-developers@sourceware.cygnus.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]

Re: More setup changes


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.
> [...]
> Corinna, I would be interested in hearing if this version of setup
> works better for you.

Unpacking now works ok, but I have found another problem.
If you try to create the root directory to be the same as the
directory in which setup resides, tar is unable to start gzip
and the unpacking fails completely. I have used strace to find
the reason. It's due to an error in newlib/libc/posix/execvp.c.
In any case a slash is appended to the path before appending
the file name of the executable. This isn't correct if the
path is '/'.

We could fix this by either patching winsup/cinstall/setup.c:

==== ZICK ====
--- setup.c     2000/04/13 06:05:56     1.11
+++ setup.c     2000/04/13 09:02:08
@@ -302,9 +302,9 @@ recurse_dirs (const char *dir, FILE *log
 void
 setpath (const char *element)
 {
-  char *buffer = xmalloc (strlen (element) + 7);
+  char *buffer = xmalloc (strlen (element) + 9);
 
-  sprintf (buffer, "PATH=%s", element);
+  sprintf (buffer, "PATH=%s;.", element);
   putenv (buffer);
 
   xfree (buffer);
==== ZACK ====

or by patching newlib/posix/execvp.c which would be the
better solution, IMHO:

==== SCHNIPP ====
--- execvp.c    2000/02/17 19:39:47     1.1.1.1
+++ execvp.c    2000/04/13 10:10:53
@@ -73,7 +73,7 @@ _DEFUN (execvp, (file, argv),
     {
       strccpy (buf, path, PATH_DELIM);
       /* An empty entry means the current directory.  */
-      if (*buf != 0)
+      if (*buf != 0 && buf[strlen(buf) - 1] != '/')
        strcat (buf, "/");
       strcat (buf, file);
       if (execv (buf, argv) == -1 && errno != ENOENT)
==== SCHNAPP ====

Don't know, why but there are still readonly files remaining
after unpacking. As aforementioned no problem while
unpacking but that is not what you've intended, right?

Corinna

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