Skip to content
Commits on Source (5)
pluma (1.20.3-1) unstable; urgency=medium
* New upstream release.
- Fix crashes when opening files with BOM at beginning (Closes: #912188).
* debian/copyright:
+ Update copyright attributions.
* debian/control:
+ Bump Standards-Version: to 4.2.1. No changes needed.
+ List gir1.2-pluma-1.0 under D of pluma-dev, too, so lintian becomes
happy.
-- Mike Gabriel <sunweaver@debian.org> Thu, 22 Nov 2018 12:49:35 +0100
pluma (1.20.2-1) unstable; urgency=medium
* New upstream release.
......
......@@ -23,7 +23,7 @@ Build-Depends: debhelper (>= 11~),
libxml2-dev,
mate-common (>= 1.18),
yelp-tools,
Standards-Version: 4.1.4
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/debian-mate-team/pluma
Vcs-Git: https://salsa.debian.org/debian-mate-team/pluma.git
Homepage: http://www.mate-desktop.org/
......@@ -87,6 +87,7 @@ Package: pluma-dev
Architecture: any
Section: libdevel
Depends: pluma (= ${binary:Version}),
gir1.2-pluma-1.0 (= ${binary:Version}),
${misc:Depends},
Breaks: mate-text-editor (<< 1.5.0),
Description: official text editor of the MATE desktop environment (development files)
......
......@@ -429,27 +429,105 @@ Comment:
Using license from COPYING file.
Files: help/*.in
help/af/*
help/am/*
help/ar/*
help/as/*
help/ast/*
help/az/*
help/be/*
help/bg/*
help/bn/*
help/bn_IN/*
help/br/*
help/bs/*
help/C/*
help/ca/*
help/ca@valencia/*
help/cmn/*
help/crh/*
help/cs/*
help/cy/*
help/da/*
help/de/*
help/dz/*
help/el/*
help/en_AU/*
help/en_CA/*
help/en_GB/*
help/eo/*
help/es/*
help/es_AR/*
help/es_CO/*
help/et/*
help/eu/*
help/fa/*
help/fi/*
help/fr/*
help/frp/*
help/fur/*
help/ga/*
help/gl/*
help/gu/*
help/he/*
help/hi/*
help/hr/*
help/hu/*
help/hy/*
help/id/*
help/is/*
help/it/*
help/ja/*
help/ka/*
help/kk/*
help/kn/*
help/ko/*
help/ku/*
help/ku_IQ/*
help/ky/*
help/lt/*
help/lv/*
help/mai/*
help/mg/*
help/mk/*
help/ml/*
help/mn/*
help/mr/*
help/ms/*
help/nb/*
help/nds/*
help/ne/*
help/nl/*
help/nn/*
help/oc/*
help/or/*
help/pa/*
help/pl/*
help/pluma.pot
help/ps/*
help/pt/*
help/pt_BR/*
help/ro/*
help/ru/*
help/rw/*
help/si/*
help/sk/*
help/sl/*
help/sq/*
help/sr/*
help/sr@latin/*
help/sv/*
help/ta/*
help/te/*
help/th/*
help/tr/*
help/ug/*
help/uk/*
help/ur/*
help/uz/*
help/vi/*
help/wa/*
help/xh/*
help/zh_CN/*
help/zh_HK/*
help/zh_TW/*
......
From 8c124726ea8fbf9b6dd2ea5d63b70cb2a29654cc Mon Sep 17 00:00:00 2001
From: Pablo Barciela <scow@riseup.net>
Date: Sun, 19 Aug 2018 05:38:15 +0200
Subject: [PATCH] pluma-document: Fix: don't crash using files with 'bom'
Fixes https://github.com/mate-desktop/pluma/issues/301
---
pluma/pluma-document.c | 57 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 9364ef1..1e9ca81 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -650,12 +650,54 @@ pluma_document_class_init (PlumaDocumentClass *klass)
g_type_class_add_private (object_class, sizeof(PlumaDocumentPrivate));
}
+static gboolean
+file_with_bom (GFile *file)
+{
+ FILE *testfile;
+ gchar c;
+ int i;
+ gchar bom[3];
+ gchar *file_path;
+
+ file_path = g_file_get_path (file);
+
+ testfile = fopen (file_path, "r");
+
+ g_free (file_path);
+
+ if (testfile == NULL)
+ {
+ perror ("fopen");
+ return FALSE;
+ }
+
+ for (i = 0; i < 3; i++)
+ {
+ c = fgetc (testfile);
+
+ if (c == EOF)
+ break;
+ else
+ bom[i] = c;
+ }
+
+ fclose (testfile);
+
+ if ((bom[0] == '\357') &&
+ (bom[1] == '\273') &&
+ (bom[2] == '\277'))
+ return TRUE;
+ else
+ return FALSE;
+}
+
static void
set_language (PlumaDocument *doc,
GtkSourceLanguage *lang,
gboolean set_by_user)
{
GtkSourceLanguage *old_lang;
+ const gchar *bom_langs;
pluma_debug (DEBUG_DOCUMENT);
@@ -664,7 +706,20 @@ set_language (PlumaDocument *doc,
if (old_lang == lang)
return;
- gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
+ bom_langs = "asp,dtl,docbook,html,mxml,mallard,markdown,mediawiki,php,tera,xml,xslt";
+
+ if (g_strrstr (bom_langs, gtk_source_language_get_id (lang)))
+ {
+ GFile *file;
+ file = pluma_document_get_location (doc);
+
+ if (!file_with_bom (file))
+ gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
+
+ g_object_unref (file);
+ }
+ else
+ gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
if (lang != NULL)
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc),
0001_Fix_Pluma_crashes_opening_files_with_bom.patch