From a2dc41cf3db58e44362adb9e989d9aeeee3cc53d Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Mon, 13 Dec 2010 10:04:47 -0600 Subject: network/NetworkManager: patched to ignore temporary files This fixes some ugly stuff in the logs http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=0376f6b1ceda64e279e64bfb37ab67f0c36478b6 Signed-off-by: Robby Workman --- network/NetworkManager/NetworkManager.SlackBuild | 7 +- .../fix_crash_in_glib_with_time.patch | 23 --- .../patches/fix_crash_in_glib_with_time.patch | 23 +++ .../NetworkManager/patches/ignore_temp_files.patch | 208 +++++++++++++++++++++ 4 files changed, 236 insertions(+), 25 deletions(-) delete mode 100644 network/NetworkManager/fix_crash_in_glib_with_time.patch create mode 100644 network/NetworkManager/patches/fix_crash_in_glib_with_time.patch create mode 100644 network/NetworkManager/patches/ignore_temp_files.patch (limited to 'network') diff --git a/network/NetworkManager/NetworkManager.SlackBuild b/network/NetworkManager/NetworkManager.SlackBuild index fbfee0c9fc..21d749096f 100644 --- a/network/NetworkManager/NetworkManager.SlackBuild +++ b/network/NetworkManager/NetworkManager.SlackBuild @@ -24,7 +24,7 @@ PRGNAM=NetworkManager VERSION=${VERSION:-0.8.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -69,7 +69,10 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; -patch -p1 < $CWD/fix_crash_in_glib_with_time.patch +patch -p1 < $CWD/patches/fix_crash_in_glib_with_time.patch +patch -p1 < $CWD/patches/ignore_temp_files.patch + +autoreconf CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ diff --git a/network/NetworkManager/fix_crash_in_glib_with_time.patch b/network/NetworkManager/fix_crash_in_glib_with_time.patch deleted file mode 100644 index 7a2f8782f5..0000000000 --- a/network/NetworkManager/fix_crash_in_glib_with_time.patch +++ /dev/null @@ -1,23 +0,0 @@ -From b8ff25eb43c9fa5eb534495a501c73169649d0a6 Mon Sep 17 00:00:00 2001 -From: Jiří Klimeš -Date: Tue, 23 Nov 2010 18:06:58 +0000 -Subject: core: correct TIMESTAMP type; fixes potential crash when time() is 32bit - -The Crash appeared on some platforms in glib while processing variable -arguments. ---- -diff --git a/src/system-settings/nm-default-wired-connection.c b/src/system-settings/nm-default-wired-connection.c -index 1cda3d9..0d19dea 100644 ---- a/src/system-settings/nm-default-wired-connection.c -+++ b/src/system-settings/nm-default-wired-connection.c -@@ -163,7 +163,7 @@ constructor (GType type, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_READ_ONLY, priv->read_only, -- NM_SETTING_CONNECTION_TIMESTAMP, time (NULL), -+ NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), - NULL); - - g_free (id); --- -cgit v0.8.3-6-g21f6 diff --git a/network/NetworkManager/patches/fix_crash_in_glib_with_time.patch b/network/NetworkManager/patches/fix_crash_in_glib_with_time.patch new file mode 100644 index 0000000000..7a2f8782f5 --- /dev/null +++ b/network/NetworkManager/patches/fix_crash_in_glib_with_time.patch @@ -0,0 +1,23 @@ +From b8ff25eb43c9fa5eb534495a501c73169649d0a6 Mon Sep 17 00:00:00 2001 +From: Jiří Klimeš +Date: Tue, 23 Nov 2010 18:06:58 +0000 +Subject: core: correct TIMESTAMP type; fixes potential crash when time() is 32bit + +The Crash appeared on some platforms in glib while processing variable +arguments. +--- +diff --git a/src/system-settings/nm-default-wired-connection.c b/src/system-settings/nm-default-wired-connection.c +index 1cda3d9..0d19dea 100644 +--- a/src/system-settings/nm-default-wired-connection.c ++++ b/src/system-settings/nm-default-wired-connection.c +@@ -163,7 +163,7 @@ constructor (GType type, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_READ_ONLY, priv->read_only, +- NM_SETTING_CONNECTION_TIMESTAMP, time (NULL), ++ NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), + NULL); + + g_free (id); +-- +cgit v0.8.3-6-g21f6 diff --git a/network/NetworkManager/patches/ignore_temp_files.patch b/network/NetworkManager/patches/ignore_temp_files.patch new file mode 100644 index 0000000000..c3bc95d11d --- /dev/null +++ b/network/NetworkManager/patches/ignore_temp_files.patch @@ -0,0 +1,208 @@ +From 0376f6b1ceda64e279e64bfb37ab67f0c36478b6 Mon Sep 17 00:00:00 2001 +From: Jiří Klimeš +Date: Wed, 10 Nov 2010 15:21:25 +0000 +Subject: keyfile: ignore temporary files (bgo #602868) + +Ignore temporary files created by vim editor and temporary files created +internally by g_file_set_contents() (mkstemp()) when writing connections. +--- +diff --git a/system-settings/plugins/keyfile/Makefile.am b/system-settings/plugins/keyfile/Makefile.am +index c519adc..128775e 100644 +--- a/system-settings/plugins/keyfile/Makefile.am ++++ b/system-settings/plugins/keyfile/Makefile.am +@@ -16,6 +16,8 @@ libkeyfile_io_la_SOURCES = \ + writer.c \ + writer.h \ + errors.c \ ++ utils.c \ ++ utils.h \ + common.h + + libkeyfile_io_la_CPPFLAGS = \ +diff --git a/system-settings/plugins/keyfile/common.h b/system-settings/plugins/keyfile/common.h +index 7d94a70..6c8f9ce 100644 +--- a/system-settings/plugins/keyfile/common.h ++++ b/system-settings/plugins/keyfile/common.h +@@ -23,6 +23,9 @@ + + #include + ++#define SWP_TAG ".swp" ++#define SWPX_TAG ".swpx" ++ + #define KEYFILE_PLUGIN_NAME "keyfile" + #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." + +diff --git a/system-settings/plugins/keyfile/plugin.c b/system-settings/plugins/keyfile/plugin.c +index f57a4b6..5a927ce 100644 +--- a/system-settings/plugins/keyfile/plugin.c ++++ b/system-settings/plugins/keyfile/plugin.c +@@ -39,6 +39,7 @@ + #include "nm-keyfile-connection.h" + #include "writer.h" + #include "common.h" ++#include "utils.h" + + #define CONF_FILE SYSCONFDIR "/NetworkManager/NetworkManager.conf" + #define OLD_CONF_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf" +@@ -89,6 +90,9 @@ read_connections (NMSystemConfigInterface *config) + NMKeyfileConnection *connection; + char *full_path; + ++ if (utils_should_ignore_file (item)) ++ continue; ++ + full_path = g_build_filename (KEYFILE_DIR, item, NULL); + PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "parsing %s ... ", item); + connection = nm_keyfile_connection_new (full_path, &error); +@@ -192,6 +196,11 @@ dir_changed (GFileMonitor *monitor, + GError *error = NULL; + + name = g_file_get_path (file); ++ if (utils_should_ignore_file (name)) { ++ g_free (name); ++ return; ++ } ++ + connection = g_hash_table_lookup (priv->hash, name); + + switch (event_type) { +diff --git a/system-settings/plugins/keyfile/utils.c b/system-settings/plugins/keyfile/utils.c +new file mode 100644 +index 0000000..de64f79 +--- a/dev/null ++++ b/system-settings/plugins/keyfile/utils.c +@@ -0,0 +1,97 @@ ++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ ++/* NetworkManager system settings service ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * (C) Copyright 2010 Red Hat, Inc. ++ */ ++ ++#include ++#include ++#include ++#include "utils.h" ++ ++ ++static const char temp_letters[] = ++"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; ++ ++/* ++ * Check '.[a-zA-Z0-9]{6}' file suffix used for temporary files by g_file_set_contents() (mkstemp()). ++ */ ++static gboolean ++check_mkstemp_suffix (const char *path) ++{ ++ const char *ptr; ++ ++ g_return_val_if_fail (path != NULL, FALSE); ++ ++ /* Matches *.[a-zA-Z0-9]{6} suffix of mkstemp()'s temporary files */ ++ ptr = strrchr (path, '.'); ++ if (ptr && (strspn (ptr + 1, temp_letters) == 6) && (! ptr[7])) ++ return TRUE; ++ return FALSE; ++} ++ ++static gboolean ++check_prefix (const char *base, const char *tag) ++{ ++ int len, tag_len; ++ ++ g_return_val_if_fail (base != NULL, TRUE); ++ g_return_val_if_fail (tag != NULL, TRUE); ++ ++ len = strlen (base); ++ tag_len = strlen (tag); ++ if ((len > tag_len) && !strncasecmp (base, tag, tag_len)) ++ return TRUE; ++ return FALSE; ++} ++ ++static gboolean ++check_suffix (const char *base, const char *tag) ++{ ++ int len, tag_len; ++ ++ g_return_val_if_fail (base != NULL, TRUE); ++ g_return_val_if_fail (tag != NULL, TRUE); ++ ++ len = strlen (base); ++ tag_len = strlen (tag); ++ if ((len > tag_len) && !strcasecmp (base + len - tag_len, tag)) ++ return TRUE; ++ return FALSE; ++} ++ ++gboolean ++utils_should_ignore_file (const char *filename) ++{ ++ char *base; ++ gboolean ignore = FALSE; ++ ++ g_return_val_if_fail (filename != NULL, TRUE); ++ ++ base = g_path_get_basename (filename); ++ g_return_val_if_fail (base != NULL, TRUE); ++ ++ /* Ignore files with certain patterns */ ++ if ( (check_prefix (base, ".") && check_suffix (base, SWP_TAG)) /* vim temporary files: .filename.swp */ ++ || (check_prefix (base, ".") && check_suffix (base, SWPX_TAG)) /* vim temporary files: .filename.swpx */ ++ || check_mkstemp_suffix (base)) /* temporary files created by mkstemp() */ ++ ignore = TRUE; ++ ++ g_free (base); ++ return ignore; ++} ++ +diff --git a/system-settings/plugins/keyfile/utils.h b/system-settings/plugins/keyfile/utils.h +new file mode 100644 +index 0000000..3c1a610 +--- a/dev/null ++++ b/system-settings/plugins/keyfile/utils.h +@@ -0,0 +1,30 @@ ++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ ++/* NetworkManager system settings service ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * (C) Copyright 2010 Red Hat, Inc. ++ */ ++ ++#ifndef _UTILS_H_ ++#define _UTILS_H_ ++ ++#include ++#include "common.h" ++ ++gboolean utils_should_ignore_file (const char *filename); ++ ++#endif /* _UTILS_H_ */ ++ -- cgit v1.2.3