summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmy Liffey <amynka@gentoo.org>2018-03-13 09:57:55 +0100
committerAmy Liffey <amynka@gentoo.org>2018-03-13 10:05:26 +0100
commit06f8269c38f50f99683311ebb84658cb7a87b865 (patch)
tree9acb50d4cf442f0ff7942066d1f2267d2e382b8f /app-editors
parentdev-python/pydispatcher: Switch to PyPyDispatcher fork (diff)
downloadgentoo-06f8269c38f50f99683311ebb84658cb7a87b865.tar.gz
gentoo-06f8269c38f50f99683311ebb84658cb7a87b865.tar.bz2
gentoo-06f8269c38f50f99683311ebb84658cb7a87b865.zip
app-editors/nedit: fix X core font crash
Closes: https://bugs.gentoo.org/591912 Package-Manager: Portage-2.3.19, Repoman-2.3.6
Diffstat (limited to 'app-editors')
-rw-r--r--app-editors/nedit/files/nedit-5.6-fix-crash-with-noX.patch118
-rw-r--r--app-editors/nedit/files/nedit-5.6-ldflags.patch4
-rw-r--r--app-editors/nedit/nedit-5.6-r2.ebuild78
3 files changed, 198 insertions, 2 deletions
diff --git a/app-editors/nedit/files/nedit-5.6-fix-crash-with-noX.patch b/app-editors/nedit/files/nedit-5.6-fix-crash-with-noX.patch
new file mode 100644
index 000000000000..92b0778e2ab2
--- /dev/null
+++ b/app-editors/nedit/files/nedit-5.6-fix-crash-with-noX.patch
@@ -0,0 +1,118 @@
+diff -urN a/source/highlightData.c b/source/highlightData.c
+--- a/source/highlightData.c 2018-03-13 08:42:40.930188154 +0100
++++ b/source/highlightData.c 2018-03-13 08:44:59.651196431 +0100
+@@ -1280,7 +1280,7 @@
+ XFontStruct *font;
+
+ if (styleNo<0)
+- return GetDefaultFontStruct(window->fontList);
++ return GetDefaultFontStruct(TheDisplay, window->fontList);
+ fontNum = HighlightStyles[styleNo]->font;
+ if (fontNum == BOLD_FONT)
+ font = window->boldFontStruct;
+@@ -1289,10 +1289,10 @@
+ else if (fontNum == BOLD_ITALIC_FONT)
+ font = window->boldItalicFontStruct;
+ else /* fontNum == PLAIN_FONT */
+- font = GetDefaultFontStruct(window->fontList);
++ font = GetDefaultFontStruct(TheDisplay, window->fontList);
+
+ /* If font isn't loaded, silently substitute primary font */
+- return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
++ return font == NULL ? GetDefaultFontStruct(TheDisplay, window->fontList) : font;
+ }
+
+ int FontOfNamedStyleIsBold(char *styleName)
+diff -urN a/source/text.c b/source/text.c
+--- a/source/text.c 2018-03-13 08:42:40.931188154 +0100
++++ b/source/text.c 2018-03-13 08:46:37.785202286 +0100
+@@ -778,9 +778,13 @@
+ textBuffer *buf;
+ Pixel white, black;
+ int textLeft;
+- int charWidth = fs->max_bounds.width;
+- int marginWidth = new->text.marginWidth;
+- int lineNumCols = new->text.lineNumCols;
++ int charWidth;
++ int marginWidth;
++ int lineNumCols;
++
++ charWidth = fs->max_bounds.width;
++ marginWidth = new->text.marginWidth;
++ lineNumCols = new->text.lineNumCols;
+
+ /* Set the initial window size based on the rows and columns resources */
+ if (request->core.width == 0)
+diff -urN a/source/window.c b/source/window.c
+--- a/source/window.c 2018-03-13 08:42:40.937188155 +0100
++++ b/source/window.c 2018-03-13 08:48:07.727207652 +0100
+@@ -1839,7 +1839,7 @@
+
+ /* Change the primary font in all the widgets */
+ if (primaryChanged) {
+- font = GetDefaultFontStruct(window->fontList);
++ font = GetDefaultFontStruct(TheDisplay, window->fontList);
+ XtVaSetValues(window->textArea, textNfont, font, NULL);
+ for (i=0; i<window->nPanes; i++)
+ XtVaSetValues(window->textPanes[i], textNfont, font, NULL);
+@@ -1861,7 +1861,7 @@
+ size appropriate for the new font, but only do so if there's only
+ _one_ document in the window, in order to avoid growing-window bug */
+ if (NDocuments(window) == 1) {
+- fontWidth = GetDefaultFontStruct(window->fontList)->max_bounds.width;
++ fontWidth = GetDefaultFontStruct(TheDisplay, window->fontList)->max_bounds.width;
+ fontHeight = textD->ascent + textD->descent;
+ newWindowWidth = (oldTextWidth*fontWidth) / oldFontWidth + borderWidth;
+ newWindowHeight = (oldTextHeight*fontHeight) / oldFontHeight +
+@@ -2244,7 +2244,7 @@
+ textNrows, rows, textNcolumns, cols,
+ textNlineNumCols, lineNumCols,
+ textNemulateTabs, emTabDist,
+- textNfont, GetDefaultFontStruct(window->fontList),
++ textNfont, GetDefaultFontStruct(TheDisplay, window->fontList),
+ textNhScrollBar, hScrollBar, textNvScrollBar, vScrollBar,
+ textNreadOnly, IS_ANY_LOCKED(window->lockReasons),
+ textNwordDelimiters, delimiters,
+
+--- a/util/misc.c 2018-03-13 08:50:54.892217626 +0100
++++ b/util/misc.c 2018-03-13 08:56:50.346238834 +0100
+@@ -1018,7 +1018,7 @@
+ ** a Motif font list. Since Motif stores this, it saves us from storing
+ ** it or querying it from the X server.
+ */
+-XFontStruct *GetDefaultFontStruct(XmFontList font)
++XFontStruct *GetDefaultFontStruct(Display *d, XmFontList font)
+ {
+ XFontStruct *fs;
+ XmFontContext context;
+@@ -1028,6 +1028,17 @@
+ XmFontListGetNextFont(context, &charset, &fs);
+ XmFontListFreeFontContext(context);
+ XtFree(charset);
++
++ /* FontList might be a render table with no only XFT fonts */
++ if (fs == NULL) {
++ fs = XLoadQueryFont(d, "fixed");
++ }
++
++ if (fs == NULL) {
++ fprintf(stderr, "Unabled to load any fallback fonts.\n");
++ exit(EXIT_FAILURE);
++ }
++
+ return fs;
+ }
+
+diff -urN a/util/misc.h b/util/misc.h
+--- a/util/misc.h 2018-03-13 08:50:54.890217626 +0100
++++ b/util/misc.h 2018-03-13 08:55:52.790235400 +0100
+@@ -65,7 +65,7 @@
+ void AccelLockBugPatch(Widget topWidget, Widget topMenuContainer);
+ void UpdateAccelLockPatch(Widget topWidget, Widget newButton);
+ char *GetXmStringText(XmString fromString);
+-XFontStruct *GetDefaultFontStruct(XmFontList font);
++XFontStruct *GetDefaultFontStruct(Display *d, XmFontList font);
+ XmString* StringTable(int count, ...);
+ void FreeStringTable(XmString *table);
+ void SimulateButtonPress(Widget widget);
+
diff --git a/app-editors/nedit/files/nedit-5.6-ldflags.patch b/app-editors/nedit/files/nedit-5.6-ldflags.patch
index 4532c6251894..a549b02490c0 100644
--- a/app-editors/nedit/files/nedit-5.6-ldflags.patch
+++ b/app-editors/nedit/files/nedit-5.6-ldflags.patch
@@ -1,5 +1,5 @@
---- source/Makefile.common 2004-03-21 15:25:56.000000000 +0100
-+++ source/Makefile.common.new 2009-10-24 10:47:03.667835157 +0200
+--- a/source/Makefile.common 2004-03-21 15:25:56.000000000 +0100
++++ b/source/Makefile.common 2009-10-24 10:47:03.667835157 +0200
@@ -21,12 +21,12 @@
# we only want natural rebuilds to regenerate the link date.
nedit: $(OBJS) ../util/libNUtil.a $(XMLLIB) $(XLTLIB)
diff --git a/app-editors/nedit/nedit-5.6-r2.ebuild b/app-editors/nedit/nedit-5.6-r2.ebuild
new file mode 100644
index 000000000000..783aa0f01403
--- /dev/null
+++ b/app-editors/nedit/nedit-5.6-r2.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit desktop toolchain-funcs
+
+DESCRIPTION="Multi-purpose text editor for the X Window System"
+HOMEPAGE="https://sourceforge.net/projects/nedit"
+SRC_URI="
+ https://downloads.sourceforge.net/project/${PN}/${PN}-source/${P}a-src.tar.gz
+ https://dev.gentoo.org/~jlec/distfiles/${PN}.png.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~mips ~ppc ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
+
+RDEPEND=">=x11-libs/motif-2.3:0
+ x11-libs/libXp
+ x11-libs/libXpm
+ x11-libs/libXt
+ x11-libs/libX11"
+DEPEND="${RDEPEND}
+ || ( dev-util/yacc sys-devel/bison )
+ dev-lang/perl"
+
+S="${WORKDIR}/${PN}-${PV}"
+
+PATCHES=( "${FILESDIR}/${P}-format.patch"
+ "${FILESDIR}/${P}-ldflags.patch"
+ "${FILESDIR}/${P}-40_Pointer_to_Integer.patch"
+ "${FILESDIR}/${P}-security.patch"
+ "${FILESDIR}/${P}-fix-crash-with-noX.patch"
+)
+
+src_prepare() {
+ #respecting LDFLAGS, bug #208189
+ default
+ sed \
+ -e "s:bin/:${EPREFIX}/bin/:g" \
+ -i Makefile source/preferences.c source/help_data.h source/nedit.c Xlt/Makefile || die
+ sed \
+ -e "s:nc:neditc:g" -i doc/nc.pod || die
+ sed -i -e "s:CFLAGS=-O:CFLAGS=${CFLAGS}:" -e "s:check_tif_rule::" \
+ makefiles/Makefile.linux || die
+ sed -i -e "s:CFLAGS=-O:CFLAGS=${CFLAGS}:" \
+ -e "s:MOTIFDIR=/usr/local:MOTIFDIR=${EPREFIX}/usr:" \
+ -e "s:-lX11:-lX11 -lXmu -liconv:" \
+ -e "s:check_tif_rule::" \
+ makefiles/Makefile.macosx || die
+}
+
+src_compile() {
+ case "${CHOST}" in
+ *-darwin*)
+ emake CC="$(tc-getCC)" AR="$(tc-getAR)" macosx
+ ;;
+ *-linux*)
+ emake CC="$(tc-getCC)" AR="$(tc-getAR)" linux
+ ;;
+ esac
+ emake VERSION="NEdit ${PV}" -C doc all
+}
+
+src_install() {
+ dobin source/nedit
+ newbin source/nc neditc
+
+ make_desktop_entry "${PN}"
+ doicon "${WORKDIR}/${PN}.png"
+
+ newman doc/nedit.man nedit.1
+ newman doc/nc.man neditc.1
+
+ dodoc README ReleaseNotes ChangeLog
+ dodoc doc/nedit.doc doc/NEdit.ad doc/faq.txt
+ dohtml doc/nedit.html
+}