Package: network-manager
Version: 0.9.10.0-7
Severity: normal
Tags: patch

Dear Maintainer,

   * What led up to the situation?

Using 'nmcli d wifi' or its subcommands on a system with more than one
wifi interface leads nmcli to exit by crashing.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

There was an upstream network-manager issue and commit, backported to
the 0.9.10.2 (I think) upstream release.  I added this as a patch and
rebuilt the 0.9.10.0-7 debian package to confirm that it resolves the
issue for me.

https://bugzilla.gnome.org/show_bug.cgi?id=734466

   * What was the outcome of this action?

nmcli no longer crashes with multiple wifi devices

I am not sure if there is any interest to release a bug fix version of
network-manager for jessie in the 0.9.10.x series, since this is fixed
in the newer network-manger release in testing/unstable.

I have taken a quick stab at adding the upstream fix to debian/patches
and the built .deb works for me.

https://github.com/jasonabele/network-manager/commit/97c9a7101bd490ec77906e6fdbda16524dbc830f

Cheers,
Jason
>From 97c9a7101bd490ec77906e6fdbda16524dbc830f Mon Sep 17 00:00:00 2001
From: Jason Abele <ja...@nextthing.co>
Date: Wed, 30 Sep 2015 16:33:29 -0700
Subject: [PATCH 1/2] fix nmcli crash with multiple wifi devices

Apply upstream fix
---
 ...sh-in-nmcli-device-wifi-with-multiple-wif.patch | 110 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 111 insertions(+)
 create mode 100644 debian/patches/0021-cli-fix-crash-in-nmcli-device-wifi-with-multiple-wif.patch

diff --git a/debian/patches/0021-cli-fix-crash-in-nmcli-device-wifi-with-multiple-wif.patch b/debian/patches/0021-cli-fix-crash-in-nmcli-device-wifi-with-multiple-wif.patch
new file mode 100644
index 0000000..17f2d7b
--- /dev/null
+++ b/debian/patches/0021-cli-fix-crash-in-nmcli-device-wifi-with-multiple-wif.patch
@@ -0,0 +1,110 @@
+From: =?utf-8?q?Ji=C5=99=C3=AD_Klime=C5=A1?= <jkli...@redhat.com>
+Date: Mon, 18 Aug 2014 12:41:01 +0200
+Subject: cli: fix crash in `nmcli device wifi` with multiple wifi devices
+ (bgo #734466)
+
+And separate details for particular devices with an empty line.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=734466
+
+Reported-by: Martin Pitt <martinp...@gnome.org>
+
+(cherry picked from commit 45358f51fc0cc29d26cd70dcd16c884fb02d210d)
+---
+ cli/src/devices.c | 27 +++++++++++++++++++++++++--
+ 1 file changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/cli/src/devices.c b/cli/src/devices.c
+index 1749206..5a3ab45 100644
+--- a/cli/src/devices.c
++++ b/cli/src/devices.c
+@@ -1754,6 +1754,8 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
+ 			goto error;
+ 		}
+ 	} else {
++		gboolean empty_line = FALSE;
++
+ 		/* List APs for all devices */
+ 		if (bssid_user) {
+ 			/* Specific AP requested - list only that */
+@@ -1765,6 +1767,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
+ 
+ 				/* Main header name */
+ 				nmc->print_fields.header_name = (char *) construct_header_name (base_hdr, nm_device_get_iface (dev));
++				nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, NULL);
+ 
+ 				arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_MAIN_HEADER_ADD | NMC_OF_FLAG_FIELD_NAMES);
+ 				g_ptr_array_add (nmc->output_data, arr);
+@@ -1790,8 +1793,11 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
+ 					}
+ 					g_free (bssid_up);
+ 				}
++				if (empty_line)
++					printf ("\n"); /* Empty line between devices' APs */
+ 				print_data (nmc);  /* Print all data */
+ 				nmc_empty_output_fields (nmc);
++				empty_line = TRUE;
+ 			}
+ 			if (!ap) {
+ 				g_string_printf (nmc->return_text, _("Error: Access point with bssid '%s' not found."),
+@@ -1806,8 +1812,14 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
+ 				/* Main header name */
+ 				nmc->print_fields.header_name = (char *) construct_header_name (base_hdr,
+ 				                                                                nm_device_get_iface (dev));
+-				if (NM_IS_DEVICE_WIFI (dev))
++				nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, NULL);
++
++				if (NM_IS_DEVICE_WIFI (dev)) {
++					if (empty_line)
++						printf ("\n"); /* Empty line between devices' APs */
+ 					show_acces_point_info (dev, nmc);
++					empty_line = TRUE;
++				}
+ 			}
+ 		}
+ 	}
+@@ -2487,6 +2499,8 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
+ 			goto error;
+ 		}
+ 	} else {
++		gboolean empty_line = FALSE;
++
+ 		/* List NSPs for all devices */
+ 		if (nsp_user) {
+ 			/* Specific NSP requested - list only that */
+@@ -2499,6 +2513,7 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
+ 
+ 				/* Main header name */
+ 				nmc->print_fields.header_name = (char *) construct_header_name (base_hdr, nm_device_get_iface (dev));
++				nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, NULL);
+ 
+ 				arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_MAIN_HEADER_ADD | NMC_OF_FLAG_FIELD_NAMES);
+ 				g_ptr_array_add (nmc->output_data, arr);
+@@ -2516,8 +2531,11 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
+ 					}
+ 					g_free (nsp_up);
+ 				}
++				if (empty_line)
++					printf ("\n"); /* Empty line between devices' NSPs */
+ 				print_data (nmc);  /* Print all data */
+ 				nmc_empty_output_fields (nmc);
++				empty_line = TRUE;
+ 			}
+ 			if (!nsp) {
+ 				g_string_printf (nmc->return_text, _("Error: Access point with nsp '%s' not found."), nsp_user);
+@@ -2531,9 +2549,14 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
+ 				/* Main header name */
+ 				nmc->print_fields.header_name = (char *) construct_header_name (base_hdr,
+ 				                                                                nm_device_get_iface (dev));
++				nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, NULL);
+ 
+-				if (NM_IS_DEVICE_WIMAX (dev))
++				if (NM_IS_DEVICE_WIMAX (dev)) {
++					if (empty_line)
++						printf ("\n"); /* Empty line between devices' NSPs */
+ 					show_nsp_info (dev, nmc);
++					empty_line = TRUE;
++				}
+ 			}
+ 		}
+ 	}
diff --git a/debian/patches/series b/debian/patches/series
index dec2550..f9c4ab0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -18,3 +18,4 @@
 0018-core-do-not-assert-when-a-device-is-enslaved-externa.patch
 0019-Don-t-make-NetworkManager-D-Bus-activatable.patch
 0020-Don-t-block-network.target-on-NetworkManager-wait-on.patch
+0021-cli-fix-crash-in-nmcli-device-wifi-with-multiple-wif.patch
-- 
2.1.4

Reply via email to