From 72fa7d558a43ed053547ddc74972631504e40614 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Tue, 13 Dec 2016 20:52:33 -0700 Subject: gnome-desktop3: fix for x32 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. Signed-off-by: Christopher Larson Signed-off-by: Ross Burton --- ...op-thumbnail-don-t-convert-time_t-to-long.patch | 72 ++++++++++++++++++++++ .../gnome-desktop/gnome-desktop3_3.22.2.bb | 2 + 2 files changed, 74 insertions(+) create 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-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 new file mode 100644 index 0000000000..18a069fadc --- /dev/null +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch @@ -0,0 +1,72 @@ +From adfa0c8f9fec1faac4bea6a94d947ea32e585923 Mon Sep 17 00:00:00 2001 +From: Christopher Larson +Date: Tue, 13 Dec 2016 20:39:51 -0700 +Subject: [PATCH] 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 3946309..b756333 100644 +--- a/libgnome-desktop/gnome-desktop-thumbnail.c ++++ b/libgnome-desktop/gnome-desktop-thumbnail.c +@@ -126,6 +126,8 @@ + * Since: 2.2 + */ + ++#define _XOPEN_SOURCE ++ + #include + #include + #include +@@ -1483,6 +1485,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; +@@ -1502,7 +1505,11 @@ save_thumbnail (GdkPixbuf *pixbuf, + goto out; + close (tmp_fd); + +- g_snprintf (mtime_str, 21, "%ld", 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"); + +@@ -1695,6 +1702,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 (!thumb_uri) +@@ -1705,7 +1713,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.8.0 + diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb index e4e9d2fd21..e72c6ce42d 100644 --- a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb @@ -10,6 +10,8 @@ inherit gnome pkgconfig upstream-version-is-even gobject-introspection SRC_URI[archive.md5sum] = "3d7222d5305f3db022eca31d8108e02d" SRC_URI[archive.sha256sum] = "51d7ebf7a6c359be14c3dd7a022213e931484653815eb10b0131bef4c8979e1c" +SRC_URI += "file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch" + DEPENDS += "intltool-native gnome-common-native gsettings-desktop-schemas gconf virtual/libx11 gtk+3 glib-2.0 startup-notification xkeyboard-config iso-codes udev" inherit distro_features_check gtk-doc -- cgit 1.2.3-korg