diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2010-05-03 23:45:56 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2010-05-03 23:45:56 +0000 |
commit | 144c1364b3d415a9676f9a28bef84cbfa156c2e7 (patch) | |
tree | 91e1f9ccfb095b881dbe6489d16156b8216145c3 /app-text | |
parent | workaround broken test suite (diff) | |
download | gentoo-2-144c1364b3d415a9676f9a28bef84cbfa156c2e7.tar.gz gentoo-2-144c1364b3d415a9676f9a28bef84cbfa156c2e7.tar.bz2 gentoo-2-144c1364b3d415a9676f9a28bef84cbfa156c2e7.zip |
Fix sparc/sigbus wrt #265792 by Tiago Cunha.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'app-text')
-rw-r--r-- | app-text/stardict/ChangeLog | 8 | ||||
-rw-r--r-- | app-text/stardict/files/stardict-3.0.1-sparc_sigbus.patch | 86 | ||||
-rw-r--r-- | app-text/stardict/stardict-3.0.1-r3.ebuild | 101 |
3 files changed, 194 insertions, 1 deletions
diff --git a/app-text/stardict/ChangeLog b/app-text/stardict/ChangeLog index 1001f5804a80..c027e999454c 100644 --- a/app-text/stardict/ChangeLog +++ b/app-text/stardict/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for app-text/stardict # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-text/stardict/ChangeLog,v 1.6 2010/02/09 21:13:13 josejx Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-text/stardict/ChangeLog,v 1.7 2010/05/03 23:45:56 ssuominen Exp $ + +*stardict-3.0.1-r3 (03 May 2010) + + 03 May 2010; Samuli Suominen <ssuominen@gentoo.org> + +stardict-3.0.1-r3.ebuild, +files/stardict-3.0.1-sparc_sigbus.patch: + Fix sparc/sigbus wrt #265792 by Tiago Cunha. 09 Feb 2010; Joseph Jezak <josejx@gentoo.org> stardict-3.0.1-r2.ebuild: Marked ppc/ppc64 stable for bug #288555. diff --git a/app-text/stardict/files/stardict-3.0.1-sparc_sigbus.patch b/app-text/stardict/files/stardict-3.0.1-sparc_sigbus.patch new file mode 100644 index 000000000000..2a5af3e170ce --- /dev/null +++ b/app-text/stardict/files/stardict-3.0.1-sparc_sigbus.patch @@ -0,0 +1,86 @@ +http://bugs.gentoo.org/show_bug.cgi?id=265792 + +by Tiago Cunha + +diff -ru stardict-3.0.1.orig/src/lib/getuint32.h stardict-3.0.1/src/lib/getuint32.h +--- stardict-3.0.1.orig/src/lib/getuint32.h 2010-03-11 21:25:04.349799973 +0000 ++++ stardict-3.0.1/src/lib/getuint32.h 2010-03-11 21:46:59.029797974 +0000 +@@ -1,7 +1,9 @@ + #ifndef _SD_GET_UINT32_H_ + #define _SD_GET_UINT32_H_ + +-#ifdef ARM ++#include <string.h> ++ ++#if defined(ARM) || defined(__sparc__) + static inline guint32 get_uint32(const gchar *addr) + { + guint32 result; +diff -ru stardict-3.0.1.orig/src/lib/stddict.cpp stardict-3.0.1/src/lib/stddict.cpp +--- stardict-3.0.1.orig/src/lib/stddict.cpp 2010-03-11 21:25:04.339799373 +0000 ++++ stardict-3.0.1/src/lib/stddict.cpp 2010-03-11 21:53:30.415449981 +0000 +@@ -260,8 +260,12 @@ + delete mf; + return NULL; + } +- +- gchar *p = mf->begin(); ++ guint32 word_off_size = (get_uint32(mf->begin()) + 1) * sizeof(guint32); ++ if (word_off_size >= cachestat.st_size || ++ *(mf->begin() + cachestat.st_size - 1) != '\0') ++ return NULL; ++ ++ gchar *p = mf->begin() + word_off_size; + gboolean has_prefix; + if (cachefiletype == CacheFileType_oft) + has_prefix = g_str_has_prefix(p, OFFSETFILE_MAGIC_DATA); +@@ -314,7 +318,7 @@ + } + g_free(tmpstr); + } +- if (cachestat.st_size!=glong(filedatasize + strlen(mf->begin()) +1)) { ++ if (cachestat.st_size != static_cast<gulong>(filedatasize + sizeof(guint32) + strlen(mf->begin() + word_off_size) +1)) { + delete mf; + return NULL; + } +@@ -375,7 +379,7 @@ + mf = get_cache_loadfile(oftfilename.c_str(), url, saveurl, cltfunc, filedatasize, 2); + if (!mf) + continue; +- wordoffset = (guint32 *)(mf->begin()+strlen(mf->begin())+1); ++ wordoffset = reinterpret_cast<guint32 *>(mf->begin()) + 1; + return true; + } + return false; +@@ -425,7 +429,12 @@ + if (!mf.open(filename, oftstat.st_size)) { + return fopen(filename, "wb"); + } +- gchar *p = mf.begin(); ++ guint32 word_off_size = (get_uint32(mf.begin()) + 1) * sizeof(guint32); ++ if (word_off_size >= oftstat.st_size || ++ *(mf.begin() + oftstat.st_size - 1) != '\0') ++ return fopen(filename, "wb"); ++ ++ gchar *p = mf.begin() + word_off_size; + bool has_prefix; + if (cachefiletype == CacheFileType_oft) + has_prefix = g_str_has_prefix(p, OFFSETFILE_MAGIC_DATA); +@@ -506,6 +515,9 @@ + FILE *out= get_cache_savefile(oftfilename.c_str(), url, 2, cfilename, cltfunc); + if (!out) + continue; ++ guint32 nentries = npages; ++ fwrite(&nentries, sizeof(nentries), 1, out); ++ fwrite(wordoffset, sizeof(guint32), npages, out); + if (cachefiletype == CacheFileType_oft) + fwrite(OFFSETFILE_MAGIC_DATA, 1, sizeof(OFFSETFILE_MAGIC_DATA)-1, out); + else +@@ -520,7 +532,6 @@ + #endif + } + fwrite("\n", 1, 2, out); +- fwrite(wordoffset, sizeof(guint32), npages, out); + fclose(out); + g_print("Save cache file: %s\n", cfilename.c_str()); + return true; diff --git a/app-text/stardict/stardict-3.0.1-r3.ebuild b/app-text/stardict/stardict-3.0.1-r3.ebuild new file mode 100644 index 000000000000..e8865c637f31 --- /dev/null +++ b/app-text/stardict/stardict-3.0.1-r3.ebuild @@ -0,0 +1,101 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-text/stardict/stardict-3.0.1-r3.ebuild,v 1.1 2010/05/03 23:45:56 ssuominen Exp $ + +EAPI="2" + +inherit gnome2 eutils autotools + +# NOTE: Even though the *.dict.dz are the same as dictd/freedict's files, +# their indexes seem to be in a different format. So we'll keep them +# seperate for now. + +IUSE="festival espeak gnome gucharmap qqwry pronounce spell" +DESCRIPTION="A GNOME2 international dictionary supporting fuzzy and glob style matching" +HOMEPAGE="http://stardict.sourceforge.net/" +SRC_URI="mirror://sourceforge/stardict/${P}.tar.bz2 + qqwry? ( mirror://sourceforge/stardict/QQWry.Dat.bz2 ) + pronounce? ( mirror://sourceforge/stardict/WyabdcRealPeopleTTS.tar.bz2 )" + +RESTRICT="test" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86" + +DEP="gnome? ( >=gnome-base/libbonobo-2.2.0 + >=gnome-base/libgnome-2.2.0 + pronounce? ( >=gnome-base/libgnome-2.2.0[esd] ) + >=gnome-base/libgnomeui-2.2.0 + >=gnome-base/gconf-2 + >=gnome-base/orbit-2.6 + app-text/scrollkeeper ) + spell? ( app-text/enchant ) + gucharmap? ( >=gnome-extra/gucharmap-1.4.0 ) + dev-libs/libsigc++ + sys-libs/zlib + >=x11-libs/gtk+-2.12" + +RDEPEND="${DEP} + espeak? ( >=app-accessibility/espeak-1.29 ) + festival? ( ~app-accessibility/festival-1.96_beta )" + +DEPEND="${DEP} + >=dev-util/intltool-0.22 + dev-util/pkgconfig" + +src_prepare() { + epatch "${FILESDIR}"/${P}-configure.in-EST.diff + epatch "${FILESDIR}"/${P}-gconf-m4.diff + epatch "${FILESDIR}"/${P}-gcc43.patch + epatch "${FILESDIR}"/${P}-transparent_trayicon.patch + epatch "${FILESDIR}"/${P}-changelog-minor-typo-fixes.patch + epatch "${FILESDIR}"/${P}-gcc44.patch + epatch "${FILESDIR}"/${P}-sparc_sigbus.patch + + # Fix compatibility with gucharmap-2, bug #240728 + epatch "${FILESDIR}/${P}-gucharmap2.patch" + + AT_M4DIR="m4" eautoreconf + gnome2_omf_fix +} + +src_configure() { + export PKG_CONFIG=$(type -P pkg-config) + # Festival plugin crashes, bug 188684. Disable for now. + G2CONF="$(use_enable gnome gnome-support) + $(use_enable spell) + $(use_enable gucharmap) + $(use_enable espeak) + $(use_enable qqwry) + --disable-festival + --disable-advertisement + --disable-updateinfo" + gnome2_src_configure +} + +src_install() { + gnome2_src_install + if use qqwry; then + insinto /usr/share/stardict/data + doins ../QQWry.Dat + fi + if use pronounce; then + dodir /usr/share/ + mv ../WyabdcRealPeopleTTS "${D}"/usr/share/ + fi + dodoc doc/{FAQ,HowToCreateDictionary,StarDictFileFormat,Translation,HACKING} +} + +pkg_postinst() { + if use festival; then + elog "Note: festival text to speech (TTS) plugin is not built. To use festival" + elog 'TTS plugin, please, enable "Use TTS program." at:' + elog '"Preferences -> Dictionary -> Sound" and fill in "Commandline" with:' + elog '"echo %s | festival --tts"' + elog + fi + elog "You will now need to install stardict dictionary files. If" + elog "you have not, execute the below to get a list of dictionaries:" + elog + elog " emerge -s stardict-" +} |