Update to 0.8 snapshot

This commit is contained in:
Dan Williams 2013-05-15 16:48:59 -05:00
parent b3b104c79b
commit a97f60e28b
7 changed files with 95 additions and 252 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@ ModemManager-0.4.git20100720.tar.bz2
/ModemManager-0.4.git20110201.tar.bz2
/ModemManager-0.5.1.96.tar.bz2
/ModemManager-0.5.999.tar.bz2
/ModemManager-0.7.990.git20130515.tar.bz2

View File

@ -1,58 +1,88 @@
%define snapshot %{nil}
%define ppp_version 2.4.5
%global snapshot .git20130515
%global ppp_version 2.4.5
%global glib2_version 2.32
%global systemd_dir %{_prefix}/lib/systemd/system
%global hardened_build 1
Summary: Mobile broadband modem management service
Name: ModemManager
Version: 0.6.0.0
Release: 3%{snapshot}%{?dist}
Version: 0.7.990
Release: 1%{snapshot}%{?dist}
#
# Source from git://anongit.freedesktop.org/ModemManager/ModemManager
# tarball built with:
# ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var
# make distcheck
#
Source: %{name}-%{version}%{snapshot}.tar.xz
Source: %{name}-%{version}%{snapshot}.tar.bz2
License: GPLv2+
Group: System Environment/Base
URL: http://www.gnome.org/projects/NetworkManager/
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: dbus-glib >= 0.86
Requires: glib2 >= 2.18
BuildRequires: glib2-devel >= 2.18
BuildRequires: dbus-glib-devel >= 0.82
Requires: glib2 >= %{glib2_version}
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: libgudev1-devel >= 143
BuildRequires: libqmi-devel >= 1.3
BuildRequires: ppp = %{ppp_version}
BuildRequires: ppp-devel = %{ppp_version}
BuildRequires: automake autoconf intltool libtool
BuildRequires: intltool
# for xsltproc
BuildRequires: libxslt
Patch0: buildsys-hates-openpty.patch
Patch1: rh862341-1-UCS2-conversions.patch
Patch2: rh862341-2-parse_operator.patch
Patch3: rh861620-blacklist-arduino-devices.patch
%description
The ModemManager service provides a consistent API to operate many different
modems, including mobile broadband (3G) devices.
The ModemManager service manages WWAN modems and provides a consistent API for
interacting with these devices to client applications.
%package devel
Summary: Libraries and headers for adding ModemManager support to applications
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: pkgconfig
%description devel
This package contains various headers for accessing some ModemManager functionality
from applications.
%package glib
Summary: Libraries for adding ModemManager support to applications that use glib.
Group: Development/Libraries
Requires: glib2 >= %{glib2_version}
%description glib
This package contains the libraries that make it easier to use some ModemManager
functionality from applications that use glib.
%package glib-devel
Summary: Libraries and headers for adding ModemManager support to applications that use glib.
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
Requires: glib2-devel >= %{glib2_version}
Requires: pkgconfig
%description glib-devel
This package contains various headers for accessing some ModemManager functionality
from glib applications.
%prep
%setup -q
%patch0 -p1 -b .pty
%patch1 -p1 -b .UCS2-conversion
%patch2 -p1 -b .parse-operator
%patch3 -p1 -b .arduino
%build
autoreconf -i
autoreconf -i --force
intltoolize --force
%configure \
--enable-more-warnings=error \
--with-udev-base-dir=/lib/udev \
--with-tests=yes \
--with-docs=yes \
--with-libqmi=yes \
--disable-static \
--with-pppd-plugin-dir=%{_libdir}/pppd/%{ppp_version} \
--with-polkit=no \
@ -66,37 +96,66 @@ make check
%install
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/pppd/2.*/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/pppd/2.*/*.so
rm -f $RPM_BUILD_ROOT%{_includedir}/mm/ModemManager.h
%post
/sbin/ldconfig
touch --no-create %{_datadir}/icons/hicolor >&/dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%systemd_post ModemManager.service
%preun
%systemd_preun ModemManager.service
%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
touch --no-create %{_datadir}/icons/hicolor >&/dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%systemd_postun
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%post glib -p /sbin/ldconfig
%postun glib -p /sbin/ldconfig
%files
%defattr(0644, root, root, 0755)
%doc COPYING README
%{_sysconfdir}/dbus-1/system.d/org.freedesktop.ModemManager.conf
%{_datadir}/dbus-1/system-services/org.freedesktop.ModemManager.service
%attr(0755,root,root) %{_sbindir}/modem-manager
%{_sysconfdir}/dbus-1/system.d/org.freedesktop.ModemManager1.conf
%{_datadir}/dbus-1/system-services/org.freedesktop.ModemManager1.service
%attr(0755,root,root) %{_sbindir}/ModemManager
%attr(0755,root,root) %{_bindir}/mmcli
%dir %{_libdir}/%{name}
%attr(0755,root,root) %{_libdir}/%{name}/*.so*
/lib/udev/rules.d/*
%{_datadir}/dbus-1/interfaces/*.xml
%{systemd_dir}/ModemManager.service
%{_datadir}/icons/hicolor/22x22/apps/*.png
%{_mandir}/man8/*
%files devel
%{_includedir}/ModemManager/*.h
%dir %{_datadir}/gtk-doc/html/%{name}
%{_datadir}/gtk-doc/html/%{name}/*
%{_libdir}/pkgconfig/%{name}.pc
%files glib
%{_libdir}/libmm-glib.so
%files glib-devel
%{_libdir}/libmm-glib.so.*
%{_includedir}/libmm-glib/*.h
%{_libdir}/pkgconfig/mm-glib.pc
%dir %{_datadir}/gtk-doc/html/libmm-glib
%{_datadir}/gtk-doc/html/libmm-glib/*
%changelog
* Wed May 15 2013 Dan Williams <dcbw@redhat.com> - 0.7.990-1.git20130515
- Update to 0.8 snapshot
* Thu Jan 31 2013 Tom Callaway <spot@fedoraproject.org> - 0.6.0.0-3
- blacklist common arduino devices (rh #861620)

View File

@ -2,12 +2,11 @@ diff -up ModemManager-0.4.998/src/tests/Makefile.am.foo ModemManager-0.4.998/src
--- ModemManager-0.4.998/src/tests/Makefile.am.foo 2011-07-06 17:59:53.711343366 -0500
+++ ModemManager-0.4.998/src/tests/Makefile.am 2011-07-06 18:00:08.971152593 -0500
@@ -45,7 +45,6 @@ if WITH_TESTS
check-local: test-modem-helpers
check-local: $(noinst_PROGRAMS)
$(abs_builddir)/test-modem-helpers
$(abs_builddir)/test-charsets
- $(abs_builddir)/test-qcdm-serial-port
$(abs_builddir)/test-sms
endif
$(abs_builddir)/test-sms-part
if WITH_QMI
$(abs_builddir)/test-modem-helpers-qmi

View File

@ -1,18 +0,0 @@
diff -up ModemManager-0.6.0.0/src/77-mm-usb-device-blacklist.rules.arduino ModemManager-0.6.0.0/src/77-mm-usb-device-blacklist.rules
--- ModemManager-0.6.0.0/src/77-mm-usb-device-blacklist.rules.arduino 2013-01-31 07:57:12.321964272 -0500
+++ ModemManager-0.6.0.0/src/77-mm-usb-device-blacklist.rules 2013-01-31 07:59:02.546965926 -0500
@@ -68,5 +68,14 @@ ATTRS{idVendor}=="050d", ATTRS{idProduct
# ATEN Intl UC-232A (Prolific)
ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008", ENV{ID_MM_DEVICE_IGNORE}="1"
+# FT232 USB-Serial (UART) IC (Arduino)
+ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ENV{ID_MM_DEVICE_IGNORE}="1"
+
+# Atmel Corp. LUFA USB to Serial Adapter Project (Arduino)
+ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", ENV{ID_MM_DEVICE_IGNORE}="1"
+
+# Anything with the Arduino Vendor ID
+ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1"
+
LABEL="mm_usb_device_blacklist_end"

View File

@ -1,160 +0,0 @@
commit e07c2162d66ab1a2e938db48744fc00afd29c272
Author: Dan Williams <dcbw@redhat.com>
Date: Tue Sep 11 16:36:16 2012 -0500
core: better handling of non-UCS2 conversions that should be UCS2 (bgo #683817)
Some modems return the +COPS operator name in hex-encoded current
character set (as set with +CSCS). Others return the operator name
in ASCII when set to UCS2, while yet others return the ASCII name
with trash at the end (*cough* Huawei *cough*). Handle that better
by not crashing.
diff --git a/src/mm-charsets.c b/src/mm-charsets.c
index 68bf2d1..65fc33c 100644
--- a/src/mm-charsets.c
+++ b/src/mm-charsets.c
@@ -710,8 +710,7 @@ gsm_pack (const guint8 *src,
* the hex representation of the charset-encoded string, so we need to cope with
* that case. */
gchar *
-mm_charset_take_and_convert_to_utf8 (gchar *str,
- MMModemCharset charset)
+mm_charset_take_and_convert_to_utf8 (gchar *str, MMModemCharset charset)
{
gchar *utf8 = NULL;
@@ -752,6 +751,7 @@ mm_charset_take_and_convert_to_utf8 (gchar *str,
case MM_MODEM_CHARSET_UCS2: {
gsize len;
gboolean possibly_hex = TRUE;
+ gsize bread = 0, bwritten = 0;
/* If the string comes in hex-UCS-2, len needs to be a multiple of 4 */
len = strlen (str);
@@ -765,19 +765,37 @@ mm_charset_take_and_convert_to_utf8 (gchar *str,
possibly_hex = isxdigit (*p++);
}
- /* If we get UCS-2, we expect the HEX representation of the string */
+ /* If hex, then we expect hex-encoded UCS-2 */
if (possibly_hex) {
utf8 = mm_modem_charset_hex_to_utf8 (str, charset);
- if (!utf8) {
- /* If we couldn't convert the string as HEX-UCS-2, try to see if
- * the string is valid UTF-8 itself. */
- utf8 = str;
- } else
+ if (utf8) {
g_free (str);
- } else
- /* If we already know it's not hex, try to use the string as it is */
- utf8 = str;
+ break;
+ }
+ }
+
+ /* If not hex, then it might be raw UCS-2 (very unlikely) or ASCII/UTF-8
+ * (much more likely). Try to convert to UTF-8 and if that fails, use
+ * the partial conversion length to re-convert the part of the string
+ * that is UTF-8, if any.
+ */
+ utf8 = g_convert (str, strlen (str),
+ "UTF-8//TRANSLIT", "UTF-8//TRANSLIT",
+ &bread, &bwritten, NULL);
+ /* Valid conversion, or we didn't get enough valid UTF-8 */
+ if (utf8 || (bwritten <= 2)) {
+ g_free (str);
+ break;
+ }
+
+ /* Last try; chop off the original string at the conversion failure
+ * location and get what we can.
+ */
+ str[bread] = '\0';
+ utf8 = g_convert (str, strlen (str),
+ "UTF-8//TRANSLIT", "UTF-8//TRANSLIT",
+ NULL, NULL, NULL);
break;
}
@@ -791,7 +809,7 @@ mm_charset_take_and_convert_to_utf8 (gchar *str,
/* Validate UTF-8 always before returning. This result will be exposed in DBus
* very likely... */
- if (!g_utf8_validate (utf8, -1, NULL)) {
+ if (utf8 && !g_utf8_validate (utf8, -1, NULL)) {
/* Better return NULL than an invalid UTF-8 string */
g_free (utf8);
utf8 = NULL;
diff --git a/src/mm-charsets.h b/src/mm-charsets.h
index 855387a..96435cc 100644
--- a/src/mm-charsets.h
+++ b/src/mm-charsets.h
@@ -72,7 +72,6 @@ guint8 *gsm_pack (const guint8 *src,
guint8 start_offset, /* in bits */
guint32 *out_packed_len);
-gchar *mm_charset_take_and_convert_to_utf8 (gchar *str,
- MMModemCharset charset);
+gchar *mm_charset_take_and_convert_to_utf8 (gchar *str, MMModemCharset charset);
#endif /* MM_CHARSETS_H */
diff --git a/src/tests/test-charsets.c b/src/tests/test-charsets.c
index f954d93..ced38a6 100644
--- a/src/tests/test-charsets.c
+++ b/src/tests/test-charsets.c
@@ -326,6 +326,41 @@ test_pack_gsm7_7_chars_offset (void *f, gpointer d)
g_free (packed);
}
+static void
+test_take_convert_ucs2_hex_utf8 (void *f, gpointer d)
+{
+ gchar *src, *converted;
+
+ /* Ensure hex-encoded UCS-2 works */
+ src = g_strdup ("0054002d004d006f00620069006c0065");
+ converted = mm_charset_take_and_convert_to_utf8 (src, MM_MODEM_CHARSET_UCS2);
+ g_assert_cmpstr (converted, ==, "T-Mobile");
+ g_free (converted);
+}
+
+static void
+test_take_convert_ucs2_bad_ascii (void *f, gpointer d)
+{
+ gchar *src, *converted;
+
+ /* Test that something mostly ASCII returns most of the original string */
+ src = g_strdup ("Orange\241");
+ converted = mm_charset_take_and_convert_to_utf8 (src, MM_MODEM_CHARSET_UCS2);
+ g_assert_cmpstr (converted, ==, "Orange");
+ g_free (converted);
+}
+
+static void
+test_take_convert_ucs2_bad_ascii2 (void *f, gpointer d)
+{
+ gchar *src, *converted;
+
+ /* Ensure something completely screwed up doesn't crash */
+ src = g_strdup ("\241\255\254\250\244\234");
+ converted = mm_charset_take_and_convert_to_utf8 (src, MM_MODEM_CHARSET_UCS2);
+ g_assert (converted == NULL);
+}
+
#if GLIB_CHECK_VERSION(2,25,12)
typedef GTestFixtureFunc TCFunc;
@@ -360,6 +395,10 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_pack_gsm7_7_chars_offset, NULL));
+ g_test_suite_add (suite, TESTCASE (test_take_convert_ucs2_hex_utf8, NULL));
+ g_test_suite_add (suite, TESTCASE (test_take_convert_ucs2_bad_ascii, NULL));
+ g_test_suite_add (suite, TESTCASE (test_take_convert_ucs2_bad_ascii2, NULL));
+
result = g_test_run ();
return result;

View File

@ -1,38 +0,0 @@
commit 219424a6e2d017491a05ecbed661bccde3f991ef
Author: Aleksander Morgado <aleksander@lanedo.com>
Date: Wed Sep 12 07:34:37 2012 +0200
gsm: skip additional UTF-8 validity check when parsing operator
This is a fix related to the previous e07c2162d.
mm_charset_take_and_convert_to_utf8() already does a UTF-8 validity check
internally before returning the string, so it's pointless to do a new one
on the returned string.
Plus, mm_charset_take_and_convert_to_utf8() may really return NULL, which
would end up in segfaulting as g_utf8_validate() expects always a non-NULL
string.
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 83e4083..60f2ea1 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -3066,13 +3066,14 @@ parse_operator (const char *reply, MMModemCharset cur_charset)
* string of the bytes of the operator name as encoded by the current
* character set.
*/
- if (cur_charset == MM_MODEM_CHARSET_UCS2)
+ if (cur_charset == MM_MODEM_CHARSET_UCS2) {
+ /* In this case we're already checking UTF-8 validity */
operator = mm_charset_take_and_convert_to_utf8 (operator, MM_MODEM_CHARSET_UCS2);
-
+ }
/* Ensure the operator name is valid UTF-8 so that we can send it
* through D-Bus and such.
*/
- if (!g_utf8_validate (operator, -1, NULL)) {
+ else if (!g_utf8_validate (operator, -1, NULL)) {
g_free (operator);
operator = NULL;
}

View File

@ -1 +1 @@
f32640f6672d997ec0887307186e9639 ModemManager-0.6.0.0.tar.xz
efc7e7c378e8f6e84124d4c16a31b3aa ModemManager-0.7.990.git20130515.tar.bz2