Dominique Leuenberger 2016-03-29 07:51:59 +00:00 committed by Git OBS Bridge
commit c0e1b373fb
3 changed files with 113 additions and 1 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Mar 18 05:52:22 UTC 2016 - eich@suse.com
- u_Escape-special-characters-in-paths.patch
Make gets confused by certain special characters in Makefiles.
Escape them. This is a problem particularly with ':' in OBS
paths.
-------------------------------------------------------------------
Sat Aug 17 21:53:12 UTC 2013 - zaitor@opensuse.org

View File

@ -1,7 +1,7 @@
#
# spec file for package makedepend
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -24,6 +24,7 @@ License: MIT
Group: Development/Tools/Building
Url: http://xorg.freedesktop.org/
Source0: http://xorg.freedesktop.org/releases/individual/util/%{name}-%{version}.tar.bz2
Patch1: u_Escape-special-characters-in-paths.patch
BuildRequires: pkg-config
BuildRequires: pkgconfig(xorg-macros) >= 1.8
BuildRequires: pkgconfig(xproto) >= 7.0.17
@ -42,6 +43,7 @@ has changed.
%prep
%setup -q
%patch1 -p1
%build
%configure

View File

@ -0,0 +1,102 @@
From: Egbert Eich <eich@suse.de>
Date: Fri Mar 18 06:42:20 2016 +0100
Subject: [PATCH]Escape special characters in paths.
Patch-mainline: to be upstreamed
Git-repo: git://anongit.freedesktop.org/git/xorg/util/makedepend
Git-commit: 6ba62c8f0236a97eaef4377a1cbca58da2d6a8c0
References:
Signed-off-by: Egbert Eich <eich@suse.com>
Make cannot handle certain special characters in make targets.
Signed-off-by: Egbert Eich <eich@suse.de>
---
pr.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 3 deletions(-)
diff --git a/pr.c b/pr.c
index 04abef9..e3a59e5 100644
--- a/pr.c
+++ b/pr.c
@@ -63,6 +63,56 @@ add_include(struct filepointer *filep, struct inclist *file,
}
}
+/**
+ * Replaces all occurrences of special characters in @p input with
+ * "\<special_character>" using @p outputbuffer (of size @p bufsize)
+ * possibly to hold the result. @p returns the string with quoted colons
+ */
+static const char *quoteSpecial(const char *input, char *outputbuffer, int bufsize)
+{
+#define min(a, b) ((a < b) ? a : b)
+ const char *tmp=input;
+ const char *loc;
+ const char *ret=input;
+#if !defined(WIN32) && !defined(__CYGWIN__)
+ const char special[] = {'$', ':', '#', '|', '?', '*', ' ', '\\', '\0'};
+ const char quotes[] = {'$', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\0'};
+#else
+ const char special[] = {'$', '\0'};
+ const char quotes[] = {'$', '\0'};
+#endif
+ int i;
+
+ for (i = 0; i < strlen(special); i++) {
+ char buf[bufsize];
+ int size=bufsize;
+ char *buf_p = buf;
+ loc = strchr(ret, special[i]);
+ if (loc == NULL)
+ continue;
+ tmp=ret;
+ while (loc != NULL) {
+ if (size > loc-tmp+2 ) {
+ memcpy(buf_p, tmp, loc-tmp);
+ buf_p+=loc-tmp;
+ *(buf_p++)=quotes[i];
+ *(buf_p++)=special[i];
+ size-=loc-tmp+2;
+ tmp=loc+1;
+ loc = strchr(tmp, special[i]);
+ } else {
+ size = min (size, loc - tmp + 1);
+ break;
+ }
+ }
+ strncpy(buf_p, tmp, size);
+ buf_p[size - 1] = '\0';
+ strcpy(outputbuffer, buf);
+ ret = outputbuffer;
+ }
+ return ret;
+}
+
static void
pr(struct inclist *ip, const char *file, const char *base)
{
@@ -70,18 +120,21 @@ pr(struct inclist *ip, const char *file, const char *base)
static int current_len;
register int len, i;
char buf[ BUFSIZ ];
+ char quotebuf[ BUFSIZ ];
+ const char *result;
printed = TRUE;
- len = strlen(ip->i_file)+1;
+ result = quoteSpecial(ip->i_file, quotebuf, sizeof(quotebuf));
+ len = strlen(result)+1;
if (current_len + len > width || file != lastfile) {
lastfile = file;
snprintf(buf, sizeof(buf), "\n%s%s%s: %s",
- objprefix, base, objsuffix, ip->i_file);
+ objprefix, base, objsuffix, result);
len = current_len = strlen(buf);
}
else {
buf[0] = ' ';
- strcpy(buf+1, ip->i_file);
+ strcpy(buf+1, result);
current_len += len;
}
fwrite(buf, len, 1, stdout);