update ModemManager to 1.18.12

This commit is contained in:
eaglegai 2022-11-18 02:55:45 +00:00
parent 260a26c4c9
commit 3e87cd7311
8 changed files with 36 additions and 482 deletions

Binary file not shown.

BIN
ModemManager-1.18.12.tar.xz Normal file

Binary file not shown.

View File

@ -4,18 +4,14 @@
Name: ModemManager
Version: 1.14.8
Release: 2
Version: 1.18.12
Release: 1
Summary: Mobile broadband modem manager
License: GPLv2+
URL: https://www.freedesktop.org/wiki/Software/ModemManager/
Source: https://www.freedesktop.org/software/ModemManager/%{name}-%{version}.tar.xz
Patch0: backport-mtk-fix-task-completion-when-loading-supported-modes.patch
Patch1: backport-sms-prevent-crash-if-date-is-out-of-range.patch
Patch2: backport-core-port-GRegex-GMatchInfo-to-use-autoptr.patch
Patch3: backport-serial-parsers-fix-invalid-EXZ-error-parser.patch
Patch4: backport-test-modem-helpers-add-EOL-to-strings-matched-with-G_REGEX_NEWLINE_CRLF.patch
Patch5: backport-modem-helpers-rework-CGCONTRDP-response-parser.patch
Patch6: backport-modem-helpers-cinterion-rework-CNMI-test-response-parser.patch
Patch7: backport-modem-helpers-ublox-rework-UIPADDR-response-parser.patch
@ -23,8 +19,8 @@ Patch8: backport-modem-helpers-rework-the-CGEV-indication-parser.patch
BuildRequires: automake autoconf dbus gtk-doc libtool vala-tools vala-devel
BuildRequires: gettext-devel glib2-devel gobject-introspection-devel libgudev-devel
BuildRequires: libqmi-devel libmbim-devel systemd-devel
BuildRequires: autoconf-archive
BuildRequires: libqmi-devel >= 1.30.8 libmbim-devel >= 1.26.0 systemd-devel
BuildRequires: autoconf-archive python3-gobject python3-dbus
Requires: libmbim-utils libqmi-utils glib2 >= %{glib2_version}
Requires: libmbim >= %{mbim_version} libqmi >= %{qmi_version}
@ -148,6 +144,12 @@ make check
%{_datadir}/dbus-1/interfaces/*.xml
%changelog
* Fri Nov 18 2022 gaihuiying <eaglegai@163.com> - 1.18.12-1
- Type:requirements
- ID:NA
- SUG:NA
- DESC: update ModemManager to 1.18.12
* Sat Nov 12 2022 gaihuiying <eaglegai@163.com> - 1.14.8-2
- Type:bugfix
- ID:NA

View File

@ -9,7 +9,6 @@ other cases it exposed some change in how it behaves on certain
matches that is not extremely clear whether it's ok or not.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2729
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/621
@ -73,7 +72,7 @@ index d23bc1462..b2ef69511 100644
+ g_autoptr(GMatchInfo) match_info = NULL;
if (G_UNLIKELY (!self->priv->sequence_regex))
self->priv->sequence_regex = g_regex_new ("\\$GPGSV,(\\d),(\\d).*",
self->priv->sequence_regex = g_regex_new ("\\$..(?:ALM|GSV|RTE|SFI),(\\d),(\\d).*",
@@ -69,11 +67,11 @@ check_append_or_replace (MMLocationGpsNmea *self,
/* If we don't have the first element of a sequence, append */
@ -978,7 +977,7 @@ index 3ded62379..67bb7089b 100644
/* ^CVOICE: <0=supported,1=unsupported>,<hz>,<bits>,<unknown> */
r = g_regex_new ("\\^CVOICE:\\s*(\\d)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)$", 0, 0, NULL);
@@ -1442,35 +1421,29 @@ mm_huawei_parse_cvoice_response (const gchar *response,
@@ -1442,37 +1421,31 @@ mm_huawei_parse_cvoice_response (const gchar *response,
MM_CORE_ERROR_FAILED,
"Couldn't match ^CVOICE reply");
}
@ -1036,6 +1035,8 @@ index 3ded62379..67bb7089b 100644
+ "Failed to parse ^CVOICE reply");
+ return FALSE;
}
/*****************************************************************************/
diff --git a/plugins/icera/mm-broadband-modem-icera.c b/plugins/icera/mm-broadband-modem-icera.c
index 897d25626..759985e00 100644
--- a/plugins/icera/mm-broadband-modem-icera.c
@ -1462,6 +1463,14 @@ index 1cc88e906..46bf438a2 100644
/* Sample reply: 2013.3.27.15.47.19.2.-5 */
r = g_regex_new ("(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)\\.([\\-\\+\\d]+)$", 0, 0, NULL);
@@ -1429,7 +1427,6 @@ parse_nwltime_reply (const char *response,
mm_get_uint_from_match_info (match_info, 5, &minute) &&
mm_get_uint_from_match_info (match_info, 6, &second) &&
mm_get_int_from_match_info (match_info, 8, &utc_offset)) {
-
result = mm_new_iso8601_time (year, month, day, hour, minute, second,
TRUE, utc_offset * 60, error);
if (out_tz) {
@@ -1447,12 +1444,8 @@ parse_nwltime_reply (const char *response,
}
@ -1563,23 +1572,24 @@ diff --git a/plugins/quectel/mm-shared-quectel.c b/plugins/quectel/mm-shared-que
index ab079436d..c383dc05a 100644
--- a/plugins/quectel/mm-shared-quectel.c
+++ b/plugins/quectel/mm-shared-quectel.c
@@ -440,7 +440,7 @@ mm_shared_quectel_setup_sim_hot_swap (MMIfaceModem *self,
MMPortSerialAt *port_primary;
MMPortSerialAt *port_secondary;
GTask *task;
- GRegex *pattern;
@@ -440,8 +440,8 @@ mm_shared_quectel_setup_sim_hot_swap (MMIfaceModem *self,
Private *priv;
MMPortSerialAt *ports[2];
GTask *task;
- GRegex *pattern;
guint i;
+ g_autoptr(GRegex) pattern = NULL;
task = g_task_new (self, NULL, callback, user_data);
priv = get_private (MM_SHARED_QUECTEL (self));
@@ -464,7 +464,6 @@ mm_shared_quectel_setup_sim_hot_swap (MMIfaceModem *self,
self,
NULL);
NULL);
}
- g_regex_unref (pattern);
mm_obj_dbg (self, "+QUSIM detection set up");
g_task_return_boolean (task, TRUE);
g_object_unref (task);
/* Now, if available, setup parent logic */
diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index 3ac20808f..bae8e3449 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
@ -2971,7 +2981,7 @@ index 5e58ba9dd..58207bb15 100644
g_propagate_error (error, inner_error);
@@ -982,21 +975,21 @@ mm_3gpp_parse_ws46_test_response (const gchar *response,
mm_3gpp_parse_ws46_test_response (const gchar *response,
gpointer log_object,
GError **error)
{
- GArray *modes = NULL;
@ -3055,7 +3065,7 @@ index 5e58ba9dd..58207bb15 100644
}
@@ -1337,14 +1323,14 @@ mm_3gpp_parse_cops_read_response (const gchar *response,
MMModemAccessTechnology *out_act,
gpointer log_object,
GError **error)
{
- GRegex *r;

View File

@ -1,52 +0,0 @@
From ff7e062e94fb779cae18be33d8d81f888033c98a Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksandermj@chromium.org>
Date: Wed, 24 Aug 2022 13:51:12 +0000
Subject: [PATCH] mtk: fix task completion when loading supported modes
---
plugins/mtk/mm-broadband-modem-mtk.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/plugins/mtk/mm-broadband-modem-mtk.c b/plugins/mtk/mm-broadband-modem-mtk.c
index 131f8daa4..0ceca795f 100644
--- a/plugins/mtk/mm-broadband-modem-mtk.c
+++ b/plugins/mtk/mm-broadband-modem-mtk.c
@@ -199,14 +199,12 @@ get_supported_modes_ready (MMBaseModem *self,
g_assert (r != NULL);
if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &match_error)) {
- if (match_error) {
- g_propagate_error (&error, match_error);
- } else {
- g_set_error (&error,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Failed to match EGMR response: %s", response);
- }
+ if (match_error)
+ g_task_return_error (task, error);
+ else
+ g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Failed to match EGMR response: %s", response);
+ g_object_unref (task);
g_match_info_free (match_info);
g_regex_unref (r);
@@ -214,11 +212,10 @@ get_supported_modes_ready (MMBaseModem *self,
}
if (!mm_get_int_from_match_info (match_info, 1, &device_type)) {
- g_set_error (&error,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Failed to parse the allowed mode response: '%s'",
- response);
+ g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Failed to parse the allowed mode response: '%s'",
+ response);
+ g_object_unref (task);
g_regex_unref (r);
g_match_info_free (match_info);
--
GitLab

View File

@ -1,33 +0,0 @@
From 79a5a4eed2189ea87d25cbe00bc824a2572cad66 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksandermj@chromium.org>
Date: Thu, 1 Sep 2022 15:00:03 +0200
Subject: [PATCH] serial-parsers: fix invalid EXZ error parser
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Passed undetected when glib2 was using pcre1, it triggers an error now
with pcre2.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2729#note_1542038
Reported and fix suggested by: Marco Trevisan (Trevi帽o) <mail@3v1n0.net>
---
src/mm-serial-parsers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mm-serial-parsers.c b/src/mm-serial-parsers.c
index 0b60d607d..fd01537d7 100644
--- a/src/mm-serial-parsers.c
+++ b/src/mm-serial-parsers.c
@@ -115,7 +115,7 @@ mm_serial_parser_v1_new (void)
parser->regex_cms_error = g_regex_new ("\\r\\n\\+CMS ERROR:\\s*(\\d+)\\r\\n$", flags, 0, NULL);
parser->regex_cme_error_str = g_regex_new ("\\r\\n\\+CME ERROR:\\s*([^\\n\\r]+)\\r\\n$", flags, 0, NULL);
parser->regex_cms_error_str = g_regex_new ("\\r\\n\\+CMS ERROR:\\s*([^\\n\\r]+)\\r\\n$", flags, 0, NULL);
- parser->regex_ezx_error = g_regex_new ("\\r\\n\\MODEM ERROR:\\s*(\\d+)\\r\\n$", flags, 0, NULL);
+ parser->regex_ezx_error = g_regex_new ("\\r\\nMODEM ERROR:\\s*(\\d+)\\r\\n$", flags, 0, NULL);
parser->regex_unknown_error = g_regex_new ("\\r\\n(ERROR)|(COMMAND NOT SUPPORT)\\r\\n$", flags, 0, NULL);
parser->regex_connect_failed = g_regex_new ("\\r\\n(NO CARRIER)|(BUSY)|(NO ANSWER)|(NO DIALTONE)\\r\\n$", flags, 0, NULL);
/* Samsung Z810 may reply "NA" to report a not-available error */
--
GitLab

View File

@ -1,309 +0,0 @@
From ac243f94676695d88e861d225e98ec5bb3c2861e Mon Sep 17 00:00:00 2001
From: Carlo Lobrano <c.lobrano@gmail.com>
Date: Fri, 8 Apr 2022 11:46:11 +0200
Subject: [PATCH] sms: prevent crash if date is out of range
g_date_time_new, and g_date_time_new_utc return NULL if inputs are out
of range, and currently mm_new_iso8601_time passes the GDateTime created
by those two functions to date_time_format_iso8601 without checking for
NULL values, causing a g_date_time_format_iso8601 crash if PDU data is
corrupted with wrong date.
To prevent this, mm_new_iso8601_time now can return NULL and set a new
GError if GDateTime created by g_date_time_new is NULL.
Fixes #546
---
.../cinterion/mm-modem-helpers-cinterion.c | 7 +++--
plugins/huawei/mm-modem-helpers-huawei.c | 19 ++++++++----
plugins/icera/mm-broadband-modem-icera.c | 7 +++--
plugins/novatel/mm-broadband-modem-novatel.c | 4 +--
plugins/sierra/mm-broadband-modem-sierra.c | 2 +-
src/mm-modem-helpers.c | 8 +++--
src/mm-sms-part-3gpp.c | 30 ++++++++++++++-----
7 files changed, 91 insertions(+), 26 deletions(-)
diff --git a/src/mm-common-helpers.c b/src/mm-common-helpers.c
index b7883b265..085177b7b 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1769,7 +1769,8 @@ mm_new_iso8601_time (guint year,
guint minute,
guint second,
gboolean have_offset,
- gint offset_minutes)
+ gint offset_minutes,
+ GError **error)
{
GString *str;
diff --git a/libmm-glib/mm-common-helpers.h b/libmm-glib/mm-common-helpers.h
index d444012c0..490f882da 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -216,7 +216,8 @@ gchar *mm_new_iso8601_time (guint year,
guint minute,
guint second,
gboolean have_offset,
- gint offset_minutes);
+ gint offset_minutes,
+ GError **error);
GArray *mm_filter_supported_modes (const GArray *all,
const GArray *supported_combinations,
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c
index f8cec8258..a75eb5304 100644
--- a/plugins/cinterion/mm-modem-helpers-cinterion.c
+++ b/plugins/cinterion/mm-modem-helpers-cinterion.c
@@ -1201,6 +1201,7 @@ mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info,
MMNetworkTimezone **tzp,
GError **error)
{
+ gboolean ret = TRUE;
guint year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0, dst = 0;
gint tz = 0;
@@ -1229,7 +1230,9 @@ mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info,
/* Return ISO-8601 format date/time string */
*iso8601p = mm_new_iso8601_time (year, month, day, hour,
minute, second,
- TRUE, tz * 15);
+ TRUE, tz * 15,
+ error);
+ ret = (*iso8601p != NULL);
}
if (tzp) {
@@ -1245,7 +1248,7 @@ mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info,
if (tzp && mm_get_uint_from_match_info (match_info, 8, &dst))
mm_network_timezone_set_dst_offset (*tzp, dst * 60);
- return TRUE;
+ return ret;
}
/*****************************************************************************/
diff --git a/plugins/huawei/mm-modem-helpers-huawei.c b/plugins/huawei/mm-modem-helpers-huawei.c
index b85484183..3ded62379 100644
--- a/plugins/huawei/mm-modem-helpers-huawei.c
+++ b/plugins/huawei/mm-modem-helpers-huawei.c
@@ -1228,6 +1228,9 @@ gboolean mm_huawei_parse_nwtime_response (const gchar *response,
mm_get_uint_from_match_info (match_info, 6, &second) &&
mm_get_int_from_match_info (match_info, 7, &tz) &&
mm_get_uint_from_match_info (match_info, 8, &dt)) {
+
+ ret = TRUE;
+
/* adjust year */
if (year < 100)
year += 2000;
@@ -1240,7 +1243,9 @@ gboolean mm_huawei_parse_nwtime_response (const gchar *response,
/* Return ISO-8601 format date/time string */
*iso8601p = mm_new_iso8601_time (year, month, day, hour,
minute, second,
- TRUE, (tz * 15) + (dt * 60));
+ TRUE, (tz * 15) + (dt * 60),
+ error);
+ ret = (*iso8601p != NULL);
}
if (tzp) {
*tzp = mm_network_timezone_new ();
@@ -1248,7 +1253,6 @@ gboolean mm_huawei_parse_nwtime_response (const gchar *response,
mm_network_timezone_set_dst_offset (*tzp, dt * 60);
}
- ret = TRUE;
} else {
g_set_error_literal (error,
MM_CORE_ERROR,
@@ -1312,14 +1316,19 @@ gboolean mm_huawei_parse_time_response (const gchar *response,
mm_get_uint_from_match_info (match_info, 4, &hour) &&
mm_get_uint_from_match_info (match_info, 5, &minute) &&
mm_get_uint_from_match_info (match_info, 6, &second)) {
+ ret = TRUE;
+
/* adjust year */
if (year < 100)
year += 2000;
+
/* Return ISO-8601 format date/time string */
- if (iso8601p)
+ if (iso8601p) {
*iso8601p = mm_new_iso8601_time (year, month, day, hour,
- minute, second, FALSE, 0);
- ret = TRUE;
+ minute, second, FALSE, 0,
+ error);
+ ret = (*iso8601p != NULL);
+ }
} else {
g_set_error_literal (error,
MM_CORE_ERROR,
diff --git a/plugins/icera/mm-broadband-modem-icera.c b/plugins/icera/mm-broadband-modem-icera.c
index 26016c4c4..96cb45fa4 100644
--- a/plugins/icera/mm-broadband-modem-icera.c
+++ b/plugins/icera/mm-broadband-modem-icera.c
@@ -1569,6 +1569,7 @@ parse_tlts_query_reply (const gchar *response,
MMNetworkTimezone **tz,
GError **error)
{
+ gboolean ret = TRUE;
gint year;
gint month;
gint day;
@@ -1649,11 +1650,13 @@ parse_tlts_query_reply (const gchar *response,
g_date_time_get_minute (adjusted),
g_date_time_get_second (adjusted),
TRUE,
- offset);
+ offset,
+ error);
+ ret = (*iso8601 != NULL);
}
g_date_time_unref (adjusted);
- return TRUE;
+ return ret;
}
static MMNetworkTimezone *
diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c
index 4eba0e168..1cc88e906 100644
--- a/plugins/novatel/mm-broadband-modem-novatel.c
+++ b/plugins/novatel/mm-broadband-modem-novatel.c
@@ -1431,13 +1431,13 @@ parse_nwltime_reply (const char *response,
mm_get_int_from_match_info (match_info, 8, &utc_offset)) {
result = mm_new_iso8601_time (year, month, day, hour, minute, second,
- TRUE, utc_offset * 60);
+ TRUE, utc_offset * 60, error);
if (out_tz) {
*out_tz = mm_network_timezone_new ();
mm_network_timezone_set_offset (*out_tz, utc_offset * 60);
}
- success = TRUE;
+ success = (result != NULL);
} else {
g_set_error_literal (error,
MM_CORE_ERROR,
diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index 518f8adbc..3ac20808f 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -1656,7 +1656,7 @@ parse_time (const gchar *response,
mm_get_uint_from_match_info (match_info, 4, &hour) &&
mm_get_uint_from_match_info (match_info, 5, &minute) &&
mm_get_uint_from_match_info (match_info, 6, &second)) {
- result = mm_new_iso8601_time (year, month, day, hour, minute, second, FALSE, 0);
+ result = mm_new_iso8601_time (year, month, day, hour, minute, second, FALSE, 0, error);
} else {
g_set_error (error,
MM_CORE_ERROR,
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 72714ab9a..5e58ba9dd 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -5112,15 +5112,17 @@ mm_parse_cclk_response (const char *response,
mm_network_timezone_set_offset (*tzp, tz * 15);
}
+ ret = TRUE;
+
if (iso8601p) {
/* Return ISO-8601 format date/time string */
*iso8601p = mm_new_iso8601_time (year, month, day, hour,
minute, second,
- TRUE, (tz * 15));
+ TRUE, (tz * 15),
+ error);
+ ret = (*iso8601p != NULL);
}
- ret = TRUE;
-
out:
g_match_info_free (match_info);
g_regex_unref (r);
diff --git a/src/mm-sms-part-3gpp.c b/src/mm-sms-part-3gpp.c
index bfae03a84..aeb9decb0 100644
--- a/src/mm-sms-part-3gpp.c
+++ b/src/mm-sms-part-3gpp.c
@@ -161,7 +161,8 @@ sms_decode_address (const guint8 *address,
}
static gchar *
-sms_decode_timestamp (const guint8 *timestamp)
+sms_decode_timestamp (const guint8 *timestamp,
+ GError **error)
{
/* ISO8601 format: YYYY-MM-DDTHH:MM:SS+HHMM */
guint year, month, day, hour, minute, second;
@@ -179,7 +180,7 @@ sms_decode_timestamp (const guint8 *timestamp)
offset_minutes = -1 * offset_minutes;
return mm_new_iso8601_time (year, month, day, hour,
- minute, second, TRUE, offset_minutes);
+ minute, second, TRUE, offset_minutes, error);
}
static MMSmsEncoding
@@ -509,6 +510,7 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
/* Get timestamps and indexes for TP-PID, TP-DCS and TP-UDL/TP-UD */
if (pdu_type == SMS_TP_MTI_SMS_DELIVER) {
+ gchar *str = NULL;
PDU_SIZE_CHECK (offset + 9,
"cannot read PID/DCS/Timestamp"); /* 1+1+7=9 */
@@ -519,8 +521,13 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
tp_dcs_offset = offset++;
/* ------ Timestamp (7 bytes) ------ */
+ str = sms_decode_timestamp (&pdu[offset], error);
+ if (!str) {
+ mm_sms_part_free (sms_part);
+ return NULL;
+ }
mm_sms_part_take_timestamp (sms_part,
- sms_decode_timestamp (&pdu[offset]));
+ str);
offset += 7;
tp_user_data_len_offset = offset;
@@ -564,6 +571,7 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
tp_user_data_len_offset = offset;
}
else if (pdu_type == SMS_TP_MTI_SMS_STATUS_REPORT) {
+ gchar *str = NULL;
/* We have 2 timestamps in status report PDUs:
* first, the timestamp for when the PDU was received in the SMSC
* second, the timestamp for when the PDU was forwarded by the SMSC
@@ -571,13 +579,21 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
PDU_SIZE_CHECK (offset + 15, "cannot read Timestamps/TP-STATUS"); /* 7+7+1=15 */
/* ------ Timestamp (7 bytes) ------ */
- mm_sms_part_take_timestamp (sms_part,
- sms_decode_timestamp (&pdu[offset]));
+ str = sms_decode_timestamp (&pdu[offset], error);
+ if (!str) {
+ mm_sms_part_free (sms_part);
+ return NULL;
+ }
+ mm_sms_part_take_timestamp (sms_part, str);
offset += 7;
/* ------ Discharge Timestamp (7 bytes) ------ */
- mm_sms_part_take_discharge_timestamp (sms_part,
- sms_decode_timestamp (&pdu[offset]));
+ str = sms_decode_timestamp (&pdu[offset], error);
+ if (!str) {
+ mm_sms_part_free (sms_part);
+ return NULL;
+ }
+ mm_sms_part_take_discharge_timestamp (sms_part, str);
offset += 7;
/* ----- TP-STATUS (1 byte) ------ */
--
GitLab

View File

@ -1,64 +0,0 @@
From 68af7f28c0d3bb1088dc58b9e6408d9941c9614c Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksandermj@chromium.org>
Date: Fri, 2 Sep 2022 17:13:29 +0200
Subject: [PATCH] test-modem-helpers: add EOL to strings matched with
G_REGEX_NEWLINE_CRLF
Looks like pcre2 (used since glib 2.73.2) requires EOLs to match if
G_REGEX_NEWLINE_CRLF is explicitly used. The tests are updated
accordingly, because the modem responses will anyway have the EOLs
as well.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2729#note_1544130
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
(cherry picked from commit 51a333cd9a6707de7c623fd4c94cb6032477572f)
---
src/tests/test-modem-helpers.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index dc22fbde7..d8cef0816 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -4228,8 +4228,8 @@ typedef struct {
} TestCcwa;
static TestCcwa test_ccwa[] = {
- { "+CCWA: 0,255", FALSE, FALSE }, /* all disabled */
- { "+CCWA: 1,255", TRUE, FALSE }, /* all enabled */
+ { "+CCWA: 0,255\r\n", FALSE, FALSE }, /* all disabled */
+ { "+CCWA: 1,255\r\n", TRUE, FALSE }, /* all enabled */
{ "+CCWA: 0,1\r\n"
"+CCWA: 0,4\r\n", FALSE, FALSE }, /* voice and fax disabled */
{ "+CCWA: 1,1\r\n"
@@ -4304,7 +4304,7 @@ common_test_clcc_response (const gchar *str,
static void
test_clcc_response_empty (void)
{
- const gchar *response = "";
+ const gchar *response = "\r\n";
common_test_clcc_response (response, NULL, 0);
}
@@ -4317,7 +4317,7 @@ test_clcc_response_single (void)
};
const gchar *response =
- "+CLCC: 1,1,0,0,0,\"123456789\",161";
+ "+CLCC: 1,1,0,0,0,\"123456789\",161\r\n";
common_test_clcc_response (response, expected_call_info_list, G_N_ELEMENTS (expected_call_info_list));
}
@@ -4331,7 +4331,7 @@ test_clcc_response_single_long (void)
/* NOTE: priority field is EMPTY */
const gchar *response =
- "+CLCC: 1,1,4,0,0,\"123456789\",129,\"\",,0";
+ "+CLCC: 1,1,4,0,0,\"123456789\",129,\"\",,0\r\n";
common_test_clcc_response (response, expected_call_info_list, G_N_ELEMENTS (expected_call_info_list));
}
--
GitLab