libxkbcommon: Changes to 'debian-unstable'
debian/changelog | 7 +++++++
debian/rules | 6 ------
src/xkbcomp/include.c | 34 +++++++++++++++++++++++++++-------
test/common.c | 41 ++++++++++++++++++++++++++++++++++-------
test/test.h | 2 +-
5 files changed, 69 insertions(+), 21 deletions(-)
New commits:
commit e6338afa2c9348a5420521763d7452245ac0aa79
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Date: Tue Sep 10 01:46:03 2013 +0200
Release to unstable
diff --git a/debian/changelog b/debian/changelog
index f0f6fd7..19f4fa2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,9 @@
-libxkbcommon (0.3.1-2) UNRELEASED; urgency=low
+libxkbcommon (0.3.1-2) unstable; urgency=low
* Cherry-pick ec9a02 from upstream, fixes FTBFS on hurd. Closes: #717723.
* Re-enable the test suite on !linux. Thanks Pino Toscano. Closes: #715560.
- -- Emilio Pozuelo Monfort <pochu@debian.org> Tue, 10 Sep 2013 01:33:21 +0200
+ -- Emilio Pozuelo Monfort <pochu@debian.org> Tue, 10 Sep 2013 01:45:53 +0200
libxkbcommon (0.3.1-1) unstable; urgency=low
commit ddf1d5d8871b3fdf0c99181e07a010e8440f1688
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Date: Tue Sep 10 01:35:41 2013 +0200
Re-enable the test suite on !linux
diff --git a/debian/changelog b/debian/changelog
index e2ff8a1..f0f6fd7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
libxkbcommon (0.3.1-2) UNRELEASED; urgency=low
* Cherry-pick ec9a02 from upstream, fixes FTBFS on hurd. Closes: #717723.
+ * Re-enable the test suite on !linux. Thanks Pino Toscano. Closes: #715560.
-- Emilio Pozuelo Monfort <pochu@debian.org> Tue, 10 Sep 2013 01:33:21 +0200
diff --git a/debian/rules b/debian/rules
index 1614f3c..eb91fca 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,5 @@
#!/usr/bin/make -f
-DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
-
# We need to point to xkb-data's files. The default should be OK but
# let's be cautious:
override_dh_auto_configure:
@@ -15,10 +13,6 @@ override_dh_install:
override_dh_makeshlibs:
dh_makeshlibs -- -c4
-ifneq ($(DEB_HOST_ARCH_OS), linux)
-override_dh_auto_test:
-endif
-
%:
dh $@ --with autoreconf
commit f10695e9ce469242534129017dabb5f291579824
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Date: Tue Sep 10 01:34:25 2013 +0200
Add changelog entry for the cherry-pick
diff --git a/debian/changelog b/debian/changelog
index 3767050..e2ff8a1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libxkbcommon (0.3.1-2) UNRELEASED; urgency=low
+
+ * Cherry-pick ec9a02 from upstream, fixes FTBFS on hurd. Closes: #717723.
+
+ -- Emilio Pozuelo Monfort <pochu@debian.org> Tue, 10 Sep 2013 01:33:21 +0200
+
libxkbcommon (0.3.1-1) unstable; urgency=low
* Team upload.
commit d0c54da6948ddd0d8c56c138b83943e94b0c0436
Author: Pino Toscano <toscano.pino@tiscali.it>
Date: Wed Jul 24 10:05:02 2013 +0200
Get rid of the usage of PATH_MAX
PATH_MAX is optional in POSIX, so avoid its unconditional usage
allocating and freeing buffers as needed.
To avoid too many malloc/free in the for loop in FindFileInXkbPath,
a buffer is grown according to the size needed at each iteration.
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index b4a4014..280bbbd 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -199,17 +199,34 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name,
{
unsigned int i;
FILE *file = NULL;
- char buf[PATH_MAX];
+ char *buf = NULL;
const char *typeDir;
+ size_t buf_size = 0, typeDirLen, name_len;
typeDir = DirectoryForInclude(type);
+ typeDirLen = strlen(typeDir);
+ name_len = strlen(name);
for (i = 0; i < xkb_context_num_include_paths(ctx); i++) {
- int ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
- xkb_context_include_path_get(ctx, i),
- typeDir, name);
- if (ret >= (ssize_t) sizeof(buf)) {
- log_err(ctx, "File name (%s/%s/%s) too long\n",
+ size_t new_buf_size = strlen(xkb_context_include_path_get(ctx, i)) +
+ typeDirLen + name_len + 3;
+ int ret;
+ if (new_buf_size > buf_size) {
+ void *buf_new = realloc(buf, new_buf_size);
+ if (buf_new) {
+ buf_size = new_buf_size;
+ buf = buf_new;
+ } else {
+ log_err(ctx, "Cannot realloc for name (%s/%s/%s)\n",
+ xkb_context_include_path_get(ctx, i), typeDir, name);
+ continue;
+ }
+ }
+ ret = snprintf(buf, buf_size, "%s/%s/%s",
+ xkb_context_include_path_get(ctx, i),
+ typeDir, name);
+ if (ret < 0) {
+ log_err(ctx, "snprintf error (%s/%s/%s)\n",
xkb_context_include_path_get(ctx, i), typeDir, name);
continue;
}
@@ -242,11 +259,14 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name,
xkb_context_failed_include_path_get(ctx, i));
}
+ free(buf);
return NULL;
}
if (pathRtrn)
- *pathRtrn = strdup(buf);
+ *pathRtrn = buf;
+ else
+ free(buf);
return file;
}
diff --git a/test/common.c b/test/common.c
index 7b4ee00..796904e 100644
--- a/test/common.c
+++ b/test/common.c
@@ -138,13 +138,22 @@ test_key_seq(struct xkb_keymap *keymap, ...)
return ret;
}
-const char *
+char *
test_get_path(const char *path_rel)
{
- static char path[PATH_MAX];
+ char *path;
+ size_t path_len;
const char *srcdir = getenv("srcdir");
- snprintf(path, PATH_MAX - 1,
+ path_len = strlen(srcdir ? srcdir : ".") +
+ strlen(path_rel ? path_rel : "") + 12;
+ path = malloc(path_len);
+ if (!path) {
+ fprintf(stderr, "Failed to allocate path (%d chars) for %s\n",
+ (int) path_len, path);
+ return NULL;
+ }
+ snprintf(path, path_len,
"%s/test/data/%s", srcdir ? srcdir : ".",
path_rel ? path_rel : "");
@@ -155,10 +164,15 @@ char *
test_read_file(const char *path_rel)
{
struct stat info;
- char *ret, *tmp;
+ char *ret, *tmp, *path;
int fd, count, remaining;
- fd = open(test_get_path(path_rel), O_RDONLY);
+ path = test_get_path(path_rel);
+ if (!path)
+ return NULL;
+
+ fd = open(path, O_RDONLY);
+ free(path);
if (fd < 0)
return NULL;
@@ -195,6 +209,7 @@ test_get_context(enum test_context_flags test_flags)
{
enum xkb_context_flags ctx_flags;
struct xkb_context *ctx;
+ char *path;
ctx_flags = XKB_CONTEXT_NO_DEFAULT_INCLUDES;
if (test_flags & CONTEXT_ALLOW_ENVIRONMENT_NAMES) {
@@ -212,7 +227,12 @@ test_get_context(enum test_context_flags test_flags)
if (!ctx)
return NULL;
- xkb_context_include_path_append(ctx, test_get_path(""));
+ path = test_get_path("");
+ if (!path)
+ return NULL;
+
+ xkb_context_include_path_append(ctx, path);
+ free(path);
return ctx;
}
@@ -222,11 +242,16 @@ test_compile_file(struct xkb_context *context, const char *path_rel)
{
struct xkb_keymap *keymap;
FILE *file;
- const char *path = test_get_path(path_rel);
+ char *path;
+
+ path = test_get_path(path_rel);
+ if (!path)
+ return NULL;
file = fopen(path, "r");
if (!file) {
fprintf(stderr, "Failed to open path: %s\n", path);
+ free(path);
return NULL;
}
assert(file != NULL);
@@ -237,10 +262,12 @@ test_compile_file(struct xkb_context *context, const char *path_rel)
if (!keymap) {
fprintf(stderr, "Failed to compile path: %s\n", path);
+ free(path);
return NULL;
}
fprintf(stderr, "Successfully compiled path: %s\n", path);
+ free(path);
return keymap;
}
diff --git a/test/test.h b/test/test.h
index 804606e..95afbea 100644
--- a/test/test.h
+++ b/test/test.h
@@ -49,7 +49,7 @@ test_key_seq(struct xkb_keymap *keymap, ...);
int
test_key_seq_va(struct xkb_keymap *keymap, va_list args);
-const char *
+char *
test_get_path(const char *path_rel);
char *
Reply to: