* [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name
@ 2017-05-02 1:29 Matt Weber
2017-05-04 15:13 ` Thomas Petazzoni
2017-05-04 19:39 ` Thomas Petazzoni
0 siblings, 2 replies; 3+ messages in thread
From: Matt Weber @ 2017-05-02 1:29 UTC (permalink / raw)
To: buildroot
Adds an inline equivalent of canonicalize_file_name
using realpath().
Bug report (origin of this patch):
https://bugs.freedesktop.org/show_bug.cgi?id=99944
Resolves:
http://autobuild.buildroot.net/results/afa/afa4b97e012586585b11be1e70ed3c63a7c48a4d/
CCLD test-generated
CCLD test-utils
CCLD test-message
../../../src/libqmi-glib/.libs/libqmi-glib.so: undefined reference to `canonicalize_file_name'
collect2: error: ld returned 1 exit status
Makefile:440: recipe for target 'test-generated' failed
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
.../0001-musl-compat-canonicalize_file_name.patch | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 package/libqmi/0001-musl-compat-canonicalize_file_name.patch
diff --git a/package/libqmi/0001-musl-compat-canonicalize_file_name.patch b/package/libqmi/0001-musl-compat-canonicalize_file_name.patch
new file mode 100644
index 0000000..5656d55
--- /dev/null
+++ b/package/libqmi/0001-musl-compat-canonicalize_file_name.patch
@@ -0,0 +1,48 @@
+From 2f44edc9fbcbf2202174aec723e8a8d191c13d2f Mon Sep 17 00:00:00 2001
+From: Matt Weber <matthew.weber@rockwellcollins.com>
+Date: Mon, 1 May 2017 19:55:07 -0500
+Subject: [PATCH] musl compat canonicalize_file_name()
+
+Adds an inline equivalent of canonicalize_file_name
+using realpath().
+
+Bug report (origin of this patch):
+https://bugs.freedesktop.org/show_bug.cgi?id=99944
+
+Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
+---
+ src/libqmi-glib/qmi-utils.h | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/src/libqmi-glib/qmi-utils.h b/src/libqmi-glib/qmi-utils.h
+index 4fd5199..4869da5 100644
+--- a/src/libqmi-glib/qmi-utils.h
++++ b/src/libqmi-glib/qmi-utils.h
+@@ -29,6 +29,24 @@
+ #error "Only <libqmi-glib.h> can be included directly."
+ #endif
+
++#ifndef HAVE_CANONICALIZE_FILE_NAME
++#include <limits.h>
++#include <string.h>
++#include <stdlib.h>
++#include <stdio.h>
++static char * canonicalize_file_name(const char *path)
++{
++ char buf[PATH_MAX] = { };
++
++ snprintf(buf, sizeof(buf) - 1, "%s", path);
++
++ if (!realpath(path, buf))
++ return NULL;
++
++ return strdup(buf);
++}
++#endif
++
+ #include <glib.h>
+
+ G_BEGIN_DECLS
+--
+1.9.1
+
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name
2017-05-02 1:29 [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name Matt Weber
@ 2017-05-04 15:13 ` Thomas Petazzoni
2017-05-04 19:39 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2017-05-04 15:13 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 1 May 2017 20:29:06 -0500, Matt Weber wrote:
> Adds an inline equivalent of canonicalize_file_name
> using realpath().
>
> Bug report (origin of this patch):
> https://bugs.freedesktop.org/show_bug.cgi?id=99944
>
> Resolves:
> http://autobuild.buildroot.net/results/afa/afa4b97e012586585b11be1e70ed3c63a7c48a4d/
>
> CCLD test-generated
> CCLD test-utils
> CCLD test-message
> ../../../src/libqmi-glib/.libs/libqmi-glib.so: undefined reference to `canonicalize_file_name'
> collect2: error: ld returned 1 exit status
> Makefile:440: recipe for target 'test-generated' failed
>
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
> .../0001-musl-compat-canonicalize_file_name.patch | 48 ++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
> create mode 100644 package/libqmi/0001-musl-compat-canonicalize_file_name.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name
2017-05-02 1:29 [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name Matt Weber
2017-05-04 15:13 ` Thomas Petazzoni
@ 2017-05-04 19:39 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2017-05-04 19:39 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 1 May 2017 20:29:06 -0500, Matt Weber wrote:
> ++#ifndef HAVE_CANONICALIZE_FILE_NAME
> ++#include <limits.h>
> ++#include <string.h>
> ++#include <stdlib.h>
> ++#include <stdio.h>
> ++static char * canonicalize_file_name(const char *path)
> ++{
> ++ char buf[PATH_MAX] = { };
> ++
> ++ snprintf(buf, sizeof(buf) - 1, "%s", path);
> ++
> ++ if (!realpath(path, buf))
> ++ return NULL;
> ++
> ++ return strdup(buf);
> ++}
> ++#endif
This has been insufficiently tested: while it fixes the build with
musl, it breaks the build with glibc and uclibc. Indeed, those C
libraries already provide canonicalize_file_name(), causing a
redefinition error.
You forgot to add an AC_CHECK_FUNCS() check in configure.ac. I've
committed a fix that adds it.
Please try to test more carefully the fixes.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-04 19:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-02 1:29 [Buildroot] [PATCH 1/1] libqmi: musl compat canonicalize_file_name Matt Weber
2017-05-04 15:13 ` Thomas Petazzoni
2017-05-04 19:39 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox