From 022866aa0ea6d7a8963d05bb10881e8d97bdf442 Mon Sep 17 00:00:00 2001 From: Joe Slater Date: Thu, 15 Mar 2018 09:03:31 -0700 Subject: gnome-desktop: do not assume time_t is long Replace use of atol() to set a time_t variable. Signed-off-by: Joe Slater Signed-off-by: Ross Burton --- ...top-thumbnail-don-t-assume-time_t-is-long.patch | 61 ++++++++++++++++++ ...op-thumbnail-don-t-convert-time_t-to-long.patch | 73 ---------------------- .../gnome-desktop/gnome-desktop3_3.26.2.bb | 2 +- 3 files changed, 62 insertions(+), 74 deletions(-) create mode 100644 meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch delete mode 100644 meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch (limited to 'meta') diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch new file mode 100644 index 0000000000..fcc152fdef --- /dev/null +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch @@ -0,0 +1,61 @@ +From 9048939b76b3bd10783adb79ed0aaf6cd13895cc Mon Sep 17 00:00:00 2001 +From: Christopher Larson +Date: Tue, 13 Dec 2016 20:39:51 -0700 +Subject: [PATCH 1/2] gnome-desktop-thumbnail: don't convert time_t to long + +Explicitly use strftime+strptime rather than snprintf+atol. This fixes the +build for X32, where long's size doesn't match that of time_t. + +Upstream-Status: Pending +Signed-off-by: Christopher Larson + + +Modify patch described above to eliminate replacement of + +g_snprintf (mtime_str, 21, "%" G_GINT64_FORMAT, (gint64) mtime) + +which is not necessary. Retain replacement of atol(). + +Signed-off-by: Joe Slater + +--- + libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c +index e56c3d7..5d96bf3 100644 +--- a/libgnome-desktop/gnome-desktop-thumbnail.c ++++ b/libgnome-desktop/gnome-desktop-thumbnail.c +@@ -120,6 +120,8 @@ + * Since: 2.2 + */ + ++#define _XOPEN_SOURCE ++ + #include + + #include +@@ -1319,6 +1326,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, + { + const char *thumb_uri, *thumb_mtime_str; + time_t thumb_mtime; ++ struct tm tmp_mtime; + + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); + if (g_strcmp0 (uri, thumb_uri) != 0) +@@ -1327,7 +1335,11 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, + thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); + if (!thumb_mtime_str) + return FALSE; +- thumb_mtime = atol (thumb_mtime_str); ++ if (!strptime (thumb_mtime_str, "%s", &tmp_mtime)) ++ return FALSE; ++ thumb_mtime = mktime (&tmp_mtime); ++ if (!thumb_mtime) ++ return FALSE; + if (mtime != thumb_mtime) + return FALSE; + +-- +2.14.1 + diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch deleted file mode 100644 index c1a7d4f40f..0000000000 --- a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 9048939b76b3bd10783adb79ed0aaf6cd13895cc Mon Sep 17 00:00:00 2001 -From: Christopher Larson -Date: Tue, 13 Dec 2016 20:39:51 -0700 -Subject: [PATCH 1/2] gnome-desktop-thumbnail: don't convert time_t to long - -Explicitly use strftime+strptime rather than snprintf+atol. This fixes the -build for X32, where long's size doesn't match that of time_t. - -Upstream-Status: Pending -Signed-off-by: Christopher Larson - ---- - libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c -index e56c3d7..5d96bf3 100644 ---- a/libgnome-desktop/gnome-desktop-thumbnail.c -+++ b/libgnome-desktop/gnome-desktop-thumbnail.c -@@ -120,6 +120,8 @@ - * Since: 2.2 - */ - -+#define _XOPEN_SOURCE -+ - #include - - #include -@@ -1105,6 +1107,7 @@ save_thumbnail (GdkPixbuf *pixbuf, - char *tmp_path = NULL; - int tmp_fd; - char mtime_str[21]; -+ struct tm *tmp_mtime = NULL; - gboolean ret = FALSE; - GError *error = NULL; - const char *width, *height; -@@ -1124,7 +1127,11 @@ save_thumbnail (GdkPixbuf *pixbuf, - goto out; - close (tmp_fd); - -- g_snprintf (mtime_str, 21, "%" G_GINT64_FORMAT, (gint64) mtime); -+ tmp_mtime = localtime (&mtime); -+ if (!tmp_mtime) -+ goto out; -+ strftime (mtime_str, 21, "%s", tmp_mtime); -+ free (tmp_mtime); - width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width"); - height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height"); - -@@ -1319,6 +1326,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, - { - const char *thumb_uri, *thumb_mtime_str; - time_t thumb_mtime; -+ struct tm tmp_mtime; - - thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); - if (g_strcmp0 (uri, thumb_uri) != 0) -@@ -1327,7 +1335,11 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, - thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); - if (!thumb_mtime_str) - return FALSE; -- thumb_mtime = atol (thumb_mtime_str); -+ if (!strptime (thumb_mtime_str, "%s", &tmp_mtime)) -+ return FALSE; -+ thumb_mtime = mktime (&tmp_mtime); -+ if (!thumb_mtime) -+ return FALSE; - if (mtime != thumb_mtime) - return FALSE; - --- -2.14.1 - diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb index cd6c194c1b..879dc9a2f6 100644 --- a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb @@ -11,7 +11,7 @@ SRC_URI[archive.md5sum] = "6cee2ecd677d87eaa0eb5ebfa7b45fb3" SRC_URI[archive.sha256sum] = "f7561a7a313fc474b2c390cd9696df1f5c1e1556080e43f4afe042b1060e5f2a" SRC_URI += " \ - file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch \ + file://gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch \ file://0001-configure.ac-Remove-gnome-common-macro-calls.patch \ file://0001-Disable-libseccomp-sycall-filtering-mechanism.patch \ " -- cgit 1.2.3-korg