Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Date: Sun, 11 Nov 2001 01:03:49 -0500 From: Christopher Faylor To: cygwin-apps AT cygwin DOT com Subject: [PATCH] Found a potential setup.exe problem while working on cygcheck Message-ID: <20011111060349.GA23640@redhat.com> Reply-To: cygwin-apps AT cygwin DOT com Mail-Followup-To: cygwin-apps AT cygwin DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23.1i Here's YA reason for a unified library. I found a problem while working on cygcheck. AFAICT, my code was correct but gcc was miscompiling it, ending up with a value of 'p' which was not a pointer. The code below fixes that problem. Does this look ok? It seems to do the right thing in cygcheck. cgf 2001-11-11 Christopher Faylor * choose.cc (parse_filename): Reorganize code to work around gcc optimization problem. Index: choose.cc =================================================================== RCS file: /cvs/uberbaum/winsup/cinstall/choose.cc,v retrieving revision 2.65 diff -u -p -r2.65 choose.cc --- choose.cc 2001/11/09 23:37:22 2.65 +++ choose.cc 2001/11/11 06:00:52 @@ -1340,21 +1340,21 @@ parse_filename (const char *in_fn, filep if (!f.what[0]) { + int n; p = strchr (ver, '\0'); strcpy (f.pkgtar, in_fn); if ((p -= 4) >= ver && strcasecmp (p, "-src") == 0) - { - strcpy (f.what, "src"); - *p = '\0'; - p = f.pkgtar + (p - fn) + 4; - memcpy (p - 4, p, strlen (p)); - } + n = 4; else if ((p -= 2) >= ver && strcasecmp (p, "-patch") == 0) + n = 6; + else + n = 0; + if (n) { - strcpy (f.what, "patch"); + strcpy (f.what, p + 1); *p = '\0'; - p = f.pkgtar + (p - fn) + 6; - memcpy (p - 6, p, strlen (p)); + p = f.pkgtar + (p - fn) + n; + memmove (p - 4, p, strlen (p)); } }