rpms/bazaar/devel bazaar-neon-escape.patch, NONE, 1.1 bazaar.spec, 1.11, 1.12

Shahms King (shahms) fedora-extras-commits at redhat.com
Fri Feb 10 22:30:49 UTC 2006


Author: shahms

Update of /cvs/extras/rpms/bazaar/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21229

Modified Files:
	bazaar.spec 
Added Files:
	bazaar-neon-escape.patch 
Log Message:
Add a patch to work around libneon changes


bazaar-neon-escape.patch:

--- NEW FILE bazaar-neon-escape.patch ---
--- thelove at canonical.com---dists--bazaar--1.4/src/baz/libarch/pfs.c.orig	2006-02-10 13:35:55.000000000 -0800
+++ thelove at canonical.com---dists--bazaar--1.4/src/baz/libarch/pfs.c	2006-02-10 13:34:10.000000000 -0800
@@ -520,6 +520,44 @@
     parsed_uri->host = str_replace (parsed_uri->host, str_save (0, at_pos + 1));
 }
 
+/* RFC2396 spake:
+ * "Data must be escaped if it does not have a representation 
+ * using an unreserved character".
+ */
+
+/* Lookup table: character classes from 2396. (This is overkill) */
+
+#define SP 0   /* space    = <US-ASCII coded character 20 hexadecimal>                 */
+#define CO 0   /* control  = <US-ASCII coded characters 00-1F and 7F hexadecimal>      */
+#define DE 0   /* delims   = "<" | ">" | "#" | "%" | <">                               */
+#define UW 0   /* unwise   = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"             */
+#define MA 1   /* mark     = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"       */
+#define AN 2   /* alphanum = alpha | digit                                             */
+#define RE 2   /* reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," */
+
+static const char uri_chars[128] = {
+/*                +2      +4      +6      +8     +10     +12     +14     */
+/*   0 */ CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO,
+/*  16 */ CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO,
+/*  32 */ SP, MA, DE, DE, RE, DE, RE, MA, MA, MA, MA, RE, RE, MA, MA, RE,
+/*  48 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, RE, RE, DE, RE, DE, RE,
+/*  64 */ RE, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN,
+/*  80 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, UW, UW, UW, UW, MA,
+/*  96 */ UW, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN,
+/* 112 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, UW, UW, UW, MA, CO 
+};
+
+#define ESCAPE(ch) (((const signed char)(ch) < 0 || \
+		uri_chars[(unsigned int)(ch)] == 0))
+
+#undef SP
+#undef CO
+#undef DE
+#undef UW
+#undef MA
+#undef AN
+#undef RE
+
 /**
  * \brief escape a location
  *
@@ -528,9 +566,36 @@
 t_uchar *
 escape_location (t_uchar const *location)
 {
-    return ne_path_escape(location);
+    const char *pnt;
+    char *ret, *retpos;
+    int count = 0;
+    for (pnt = location; *pnt != '\0'; pnt++) {
+	if (ESCAPE(*pnt)) {
+	    count++;
+	}
+    }
+    if (count == 0) {
+	return ne_strdup(location);
+    }
+    /* An escaped character is "%xx", i.e., two MORE
+     * characters than the original string */
+    retpos = ret = ne_malloc(strlen(location) + 2*count + 1);
+    for (pnt = location; *pnt != '\0'; pnt++) {
+	if (ESCAPE(*pnt)) {
+	    /* Escape it - %<hex><hex> */
+	    sprintf(retpos, "%%%02x", (unsigned char) *pnt);
+	    retpos += 3;
+	} else {
+	    /* It's cool */
+	    *retpos++ = *pnt;
+	}
+    }
+    *retpos = '\0';
+    return ret;
 }
 
+#undef ESCAPE
+
 /**
  * \brief unescape a location
  *
@@ -539,7 +604,25 @@
 t_uchar *
 unescape_location (t_uchar const *location)
 {
-    return ne_path_unescape(location);
+    const char *pnt;
+    char *ret, *retpos, buf[5] = { "0x00\0" };
+    retpos = ret = ne_malloc(strlen(location) + 1);
+    for (pnt = location; *pnt != '\0'; pnt++) {
+	if (*pnt == '%') {
+	    if (!isxdigit((unsigned char) pnt[1]) || 
+		!isxdigit((unsigned char) pnt[2])) {
+		/* Invalid URI */
+                free(ret);
+		return NULL;
+	    }
+	    buf[2] = *++pnt; buf[3] = *++pnt; /* bit faster than memcpy */
+	    *retpos++ = (char)strtol(buf, NULL, 16);
+	} else {
+	    *retpos++ = *pnt;
+	}
+    }
+    *retpos = '\0';
+    return ret;
 }
 
 /* tag: Tom Lord Thu Jun  5 15:12:22 2003 (pfs.c)


Index: bazaar.spec
===================================================================
RCS file: /cvs/extras/rpms/bazaar/devel/bazaar.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- bazaar.spec	1 Feb 2006 17:13:21 -0000	1.11
+++ bazaar.spec	10 Feb 2006 22:30:48 -0000	1.12
@@ -1,11 +1,12 @@
 Name:       bazaar
 Version:    1.4.2
 Summary:    A distributed revision control system
-Release:    4%{?dist}
+Release:    5%{?dist}
 License:    GPL
 Group:      Development/Tools
 Source:     http://bazaar.canonical.com/releases/src/%{name}_%{version}.tar.gz
 Source1:    http://bazaar.canonical.com/releases/src/bazaar-doc_1.4.tar.gz
+Patch0:     bazaar-neon-escape.patch
 URL:        http://bazaar.canonical.com/
 
 BuildRequires: neon-devel which gettext gpgme-devel python-docutils tetex-latex
@@ -25,6 +26,7 @@
 %prep
 # unpack the source
 %setup -q -n thelove at canonical.com---dists--bazaar--1.4
+%patch0 -p1
 # unpack the documentation
 %setup -q -n thelove at canonical.com---dists--bazaar--1.4 -D -T -a 1
 
@@ -82,6 +84,9 @@
 %{_mandir}/*/*
 
 %changelog
+* Fri Feb 10 2006 Shahms E. King <shahms at shahms.com> 1.4.2-5
+- Fix for changes in ne_path_escape
+
 * Wed Feb 01 2006 Shahms E. King <shahms at shahms.com> 1.4.2-4
 - Rebuild against new neon
 




More information about the fedora-extras-commits mailing list