This is the mail archive of the cygwin-apps 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]
Other format: [Raw text]

[PATCH] setup: installed xz packages (was: cygcheck: xz packages)


On 2013-09-16 12:40, Christopher Faylor wrote:
On Fri, Sep 13, 2013 at 02:06:19PM -0400, Christopher Faylor wrote:
On Fri, Sep 13, 2013 at 12:10:47PM -0500, Yaakov (Cygwin/X) wrote:
cygcheck needs fixing wrt .tar.xz packages; patch attached.

Thanks for noticing this but I think I'd like to see a more general
fix.  In upset, I just completely relaxed the checking of .gz/.bz2/.xz
in favor of just checking for .tar.  So, instead, something like the
below.

I just confirmed: It doesn't work.  I did, however, check in a modified
version that has the salutary effect of not segv'ing.  It seems to work
but, now that I think of it, I haven't downloaded any new packages with
.xz extensions.  It is general enough that, if it works for .tar.bz2, it
should also work for .tar.xz.

While setup installed .tar.xz packages fine, it turns out they're not being seen as installed the next time setup is run. Patch attached in your name, since the code is literally a copy of your rewritten winsup/cygwin/dump_setup.cc:find_tar_ext().


Yaakov

2013-09-17  Christopher Faylor <me.cygwin2013@...>

	* filemanip.cc (find_tar_ext): Generalize search for .tar extension,
	avoiding looking for specific compression types.

Index: filemanip.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/filemanip.cc,v
retrieving revision 2.36
diff -u -p -r2.36 filemanip.cc
--- filemanip.cc	30 Aug 2012 22:32:14 -0000	2.36
+++ filemanip.cc	17 Sep 2013 19:59:43 -0000
@@ -70,18 +70,13 @@ base (const std::string& aString)
 int
 find_tar_ext (const char *path)
 {
-  char *end = strchr (path, '\0');
-  /* check in longest first order */
-  const char *ext;
-  if ((ext = trail (path, ".tar.bz2")) && (end - ext) == 8)
-    return ext - path;
-  if ((ext = trail (path, ".tar.gz")) && (end - ext) == 7)
-    return ext - path;
-  if ((ext = trail (path, ".tar")) && (end - ext) == 4)
-    return ext - path;
-  if ((ext = trail (path, ".tar.lzma")) && (end - ext) == 9)
-    return ext - path;
-  return 0;
+  char *p = strchr (path, '\0') - 9;
+  if (p <= path)
+    return 0;
+  if ((p = strstr (p, ".tar")) != NULL)
+    return p - path;
+  else
+    return 0;
 }
 
 /* Parse a filename into package, version, and extension components. */

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