Bug 99944

Summary: [PATCH] Fix building under musl-libc with canonicalize_file_name()
Product: libqmi Reporter: Stuart Cardall <developer>
Component: libqmiAssignee: Dan Williams <dcbw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: developer
Version: unspecifiedKeywords: patch
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Musl libc compat for canonicalize_file_name()
Musl libc compat for canonicalize_file_name()
patch including static func in impl instead of as a inline in header

Description Stuart Cardall 2017-02-24 14:56:24 UTC

    
Comment 1 Stuart Cardall 2017-02-24 15:02:04 UTC
Created attachment 129898 [details] [review]
Musl libc compat for canonicalize_file_name()
Comment 2 Stuart Cardall 2017-03-23 02:41:19 UTC
Created attachment 130392 [details] [review]
Musl libc compat for canonicalize_file_name()

while building libqmi 1.18.0 I noticed warnings from gcc to include <stdio.h> in src/libqmi-glib/qmi-utils.h

this is a revised patch with the extra include for musl libc
Comment 3 Matt 2017-05-15 01:51:02 UTC
The suggested patch creates an issue with packages like modem-manager since the header is used as a interface definition to the libqmi library.  Instead, suggesting the new attached patch.
Comment 4 Matt 2017-05-15 01:53:40 UTC
Created attachment 131359 [details] [review]
patch including static func in impl instead of as a inline in header
Comment 5 Aleksander Morgado 2017-06-11 21:21:23 UTC
(In reply to Matt from comment #4)
> Created attachment 131359 [details] [review] [review]
> patch including static func in impl instead of as a inline in header

It's just used once, so why not just...

         tmp = g_strdup_printf ("/sys/class/%s/%s/device/driver", subsystems[i], device_basename);

#if defined HAVE_CANONICALIZE_FILE_NAME
         path = canonicalize_file_name (tmp);
#else
         path = realpath (tmp, NULL);
#endif
         g_free (tmp);
Comment 6 Aleksander Morgado 2017-06-11 21:29:19 UTC
For reference, that's basically what I had in this patch I carry for the openwrt libqmi builds:

https://bitbucket.org/aleksander0m/modemmanager-openwrt/src/d694c4c6f92d870885e9f78c6a443d7f74c8254c/libqmi/patches/0002-build-musl-compatibility.patch?at=master&fileviewer=file-view-default
Comment 7 Aleksander Morgado 2017-09-11 07:56:44 UTC
Just defaulted it to use realpath() instead of adding more complexity. None of the realpath() limitations really affect us.

https://cgit.freedesktop.org/libqmi/commit/?id=6097ad583b89ad692e1d629088185a6728e34e5f

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.