Thomas Frohwein writes: > On Wed, Jun 10, 2020 at 09:47:44PM +0200, Rafael Sadowski wrote: >> I would like to delete eliot for the following reasons: >> >> - Segmentation fault on startup > > Also here on amd64. > >> - xscrabble (Alternative scrabble works fine here) >> - Qt4 > > There is a "prepare for 2.2" in the commit log, indicating that eliot > may see a new release soon. This appears to add Qt5 support [1]. > >> OK to delete it? > > I think it would be good to see if updating to a recent checkout would > fix the seg fault and can run with Qt5 before deleting. I'm a little > short on time today to do that myself, but hope to test this out in the > next couple of days unless someone beats me to it. > > [1] http://git.savannah.nongnu.org/cgit/eliot.git/tree/configure.ac#n185
This is an update for games/eliot to qt5 with a segfault fix when opening menus. - Move HOMEPAGE to https - Hosts MASTER_SITES as a tarball from a git checkout dated 2018/11/10 on my server. Does anyone have space available to host this distfile until upstream does a new release? My VPS is cheap and not so reliable, but if this is acceptable, I could host it. - Moves to qt5 - CONFIGURE_STYLE autoreconf because it is not a release tarball - Adds gettext,-tools to BUILD_DEPENDS for building translations - do-gen line taken from Makefile.template to run autohell Note: I omitted BUILD_DEPENDS like devel/libtool and ${MODGNU_AUTOHELL_DEPENDS} because they seem to be pulled in by the autoreconf CONFIGURE_STYLE. - pre-build calls e...@quot.po-create and e...@boldquot.po-create targets in the po/Makefile. By default msgfmt fails because it expects a header (the header is inserted by these targets) when converting the po (portable object) files into gmo (GNU machine object). Note: I omitted the canonical env -i ${MAKE_ENV} before ${MAKE_PROGRAM} because it strangely fails. It should not be a problem because the *.po for quot and boldquot get headers correctly inserted for processing by gettext's msgfmt. Also, quote and boldquot only change quotation marks and are not really translation files. - new qt_new_game_cpp patch for missing header - removal of patch for utils/Makefile.in, which can be brought back with new release. ncurses works fine still. - I discovered a new segfault when opening any menu, resolved by patch-qt_main_cpp. eliot adds its own MyApplication class with superclass QApplication. MyApplication's constructor wrongly passes in the argc argument by value because these superclasses store argc as reference to this argument. However, this argument expires after the constructor returns. Opening a menu uses a codepath that eventually calls arguments(). x11/qt/qtbase's ${WRKSRC}/src/corelib/kernel/qcoreapplication.cpp QCoreApplication::arguments() returns command-line arguments as a list of strings. const int ac = self->d_func()->argc; char ** const av = self->d_func()->argv; gdb showed that ac had a distinct, large value and different address from main()'s argc (argc = 1 and argv[0] = /usr/local/bin/eliot typically). The large ac caused reading past the end of av. To resolve, heed the warning in the documentation, "Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QApplication object." Pass argc from main() by reference to MyApplication and all of its superclasses, which already store references to argc. - Known quirks 1. I experienced a rare segfault at startup at one point during development, as brought up by rsadowski@ and thfr@, but I can no longer reproduce it. 2. Starting at the second turn, the rack might contain: D+EAD?BEEF where ? is a question mark. + is a bug and should not appear. It actually goes away if you rearrange tiles, but the + does appear in the game history. 3. I tested the ncurses interface. It segfaults if you forget to add --human players. $ eliotcurses -m d -d /usr/local/share/eliot/twl06.dawg --human player1 Feedback and tests are welcome. Index: Makefile =================================================================== RCS file: /cvs/ports/games/eliot/Makefile,v retrieving revision 1.14 diff -u -p -u -p -r1.14 Makefile --- Makefile 12 Jul 2019 20:46:17 -0000 1.14 +++ Makefile 23 Jun 2020 08:16:51 -0000 @@ -1,14 +1,13 @@ # $OpenBSD: Makefile,v 1.14 2019/07/12 20:46:17 sthen Exp $ -V = 2.1 +V = 2.1pl20181110 COMMENT = scrabble game DISTNAME = eliot-${V} CATEGORIES = games -REVISION = 5 -HOMEPAGE = http://nongnu.org/eliot/ +HOMEPAGE = https://nongnu.org/eliot/ -MASTER_SITES = ${MASTER_SITE_SAVANNAH:=eliot/releases/${V}/} +MASTER_SITES = https://namtsui.com/source/ EXTRACT_ONLY = ${DISTNAME}${EXTRACT_SUFX} DISTFILES += ${DISTNAME}${EXTRACT_SUFX} @@ -22,24 +21,41 @@ MASTER_SITES0 = ${MASTER_SITE_SAVANNAH:= # GPLv2 PERMIT_PACKAGE = Yes -MODULES = x11/qt4 +MODULES = x11/qt5 COMPILER = base-clang ports-gcc base-gcc -CONFIGURE_STYLE = gnu +CONFIGURE_STYLE = autoreconf +CONFIGURE_ARGS = --enable-qt5 --disable-qt CONFIGURE_ENV += CPPFLAGS="-I${LOCALBASE}/include" \ - LDFLAGS="-L${X11BASE}/lib -pthread -L${LOCALBASE}/lib -liconv" + LDFLAGS="-L${X11BASE}/lib -pthread -L${LOCALBASE}/lib -liconv" USE_GMAKE = Yes +AUTOCONF_VERSION = 2.69 +AUTOMAKE_VERSION = 1.16 + +WRKDIST = ${WRKDIR}/eliot +WRKSRC = ${WRKDIR}/eliot + BUILD_DEPENDS = devel/boost \ + devel/gettext,-tools \ devel/libexecinfo RUN_DEPENDS = devel/desktop-file-utils LIB_DEPENDS = textproc/arabica devel/libconfig -WANTLIB += lib/qt4/QtGui lib/qt4/QtNetwork c m pthread ${COMPILER_LIBCXX} +WANTLIB += Qt5Core Qt5Gui Qt5Network Qt5PrintSupport Qt5Widgets +WANTLIB += c m pthread ${COMPILER_LIBCXX} WANTLIB += arabica config++ expat iconv intl curses +do-gen: + cd ${WRKSRC}; ${AUTOCONF_ENV} ./bootstrap + post-configure: ${SUBST_CMD} ${WRKSRC}/qt/main_window.cpp + +# po/Makefile all target fails to build portable object files for quot/boldquot +pre-build: + @cd ${WRKSRC}/po && ${MAKE_PROGRAM} ${MAKE_FLAGS} \ + -f ${WRKSRC}/po/Makefile e...@quot.po-create e...@boldquot.po-create post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/eliot Index: distinfo =================================================================== RCS file: /cvs/ports/games/eliot/distinfo,v retrieving revision 1.2 diff -u -p -u -p -r1.2 distinfo --- distinfo 26 Apr 2013 13:04:14 -0000 1.2 +++ distinfo 23 Jun 2020 08:16:51 -0000 @@ -1,5 +1,5 @@ SHA256 (eliot/danosc.dawg) = W5WPswZz5U8/kQf+yFtu+8YK7D5X+nBhA0JXI4U2xEY= -SHA256 (eliot/eliot-2.1.tar.gz) = NVZf+NGpCWY9XcMaHtpnlqqB291PbqNDhmDzm0j2rC4= +SHA256 (eliot/eliot-2.1pl20181110.tar.gz) = BiUCJxEkBp2iBiY1J0Whh4iU4vUU2ZJ3SRWSp3As+ms= SHA256 (eliot/eliot-dic-cs.dawg) = XJUtv6lG4AGCZdi/y2CiLKBT8P5gxXkoE2gQCMt1Rng= SHA256 (eliot/eliot-dic-fr.dawg) = Xljscd4KP3zl1i3CWVQJfC3beeVH2HojjtYp+ztM5EI= SHA256 (eliot/lex-fise.dawg) = qbpm12Bo/an2Wq8D4g7XUJJDvfx7kcQNGfxR+JNd1Wk= @@ -7,7 +7,7 @@ SHA256 (eliot/rak.dawg) = zb+DtIN6KGsEnT SHA256 (eliot/sowpods06.dawg) = X0b65j9pDaZ85P8wEdIU4KBQV2HmrUeOw84GC8uUmVM= SHA256 (eliot/twl06.dawg) = 4eoz0oBRNyZk1DW4lw2zaTpTa17YOYaW1m4J3VnGSwE= SIZE (eliot/danosc.dawg) = 444874 -SIZE (eliot/eliot-2.1.tar.gz) = 1182295 +SIZE (eliot/eliot-2.1pl20181110.tar.gz) = 640438 SIZE (eliot/eliot-dic-cs.dawg) = 471118 SIZE (eliot/eliot-dic-fr.dawg) = 314634 SIZE (eliot/lex-fise.dawg) = 525106 Index: patches/patch-qt_main_cpp =================================================================== RCS file: patches/patch-qt_main_cpp diff -N patches/patch-qt_main_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-qt_main_cpp 23 Jun 2020 08:16:51 -0000 @@ -0,0 +1,28 @@ +$OpenBSD$ + +Resolve out of bounds memory access when opening any menu + +Warning: The data referred to by argc and argv must stay valid for the entire +lifetime of the QApplication object.[1] + +Pass argc by reference instead of by value because main()'s argc will stay +valid. Before, argc copied by value to this constructor expired after the +constructor returned. arguments()[2] eventually used this expired argc to read +past the end of argv. + +See also: +[1] https://doc.qt.io/qt-5/qapplication.html#QApplication +[2] https://doc.qt.io/qt-5/qcoreapplication.html#arguments + +Index: qt/main.cpp +--- qt/main.cpp.orig ++++ qt/main.cpp +@@ -54,7 +54,7 @@ static void bt_sighandler(int); + class MyApplication : public QApplication + { + public: +- MyApplication(int argc, char **argv) ++ MyApplication(int &argc, char **argv) + : QApplication(argc, argv) + {} + Index: patches/patch-qt_new_game_cpp =================================================================== RCS file: patches/patch-qt_new_game_cpp diff -N patches/patch-qt_new_game_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-qt_new_game_cpp 23 Jun 2020 08:16:51 -0000 @@ -0,0 +1,15 @@ +$OpenBSD$ + +compilation error: allocation of incomplete type 'QAction' + +Index: qt/new_game.cpp +--- qt/new_game.cpp.orig ++++ qt/new_game.cpp +@@ -22,6 +22,7 @@ + #include <QFileSystemModel> + #include <QFileDialog> + #include <QSettings> ++#include <QAction> + + #include "new_game.h" + #include "players_table_helper.h" Index: patches/patch-utils_Makefile_in =================================================================== RCS file: patches/patch-utils_Makefile_in diff -N patches/patch-utils_Makefile_in --- patches/patch-utils_Makefile_in 26 Apr 2013 13:04:14 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-utils_Makefile_in,v 1.2 2013/04/26 13:04:14 bcallah Exp $ ---- utils/Makefile.in.orig Sat Apr 6 18:16:14 2013 -+++ utils/Makefile.in Wed Apr 24 23:11:25 2013 -@@ -72,7 +72,7 @@ host_triplet = @host@ - noinst_PROGRAMS = $(am__EXEEXT_2) - bin_PROGRAMS = $(am__EXEEXT_1) - @BUILD_TEXT_TRUE@am__append_1 = eliottxt --@BUILD_TEXT_TRUE@@HAS_READLINE_TRUE@am__append_2 = -lreadline -+@BUILD_TEXT_TRUE@@HAS_READLINE_TRUE@am__append_2 = -lreadline -lncursesw - @BUILD_TEXT_TRUE@@WITH_LOGGING_TRUE@am__append_3 = @LOG4CXX_LIBS@ - @BUILD_NCURSES_TRUE@am__append_4 = eliotcurses - @BUILD_NCURSES_TRUE@@WITH_LOGGING_TRUE@am__append_5 = @LOG4CXX_LIBS@ Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/games/eliot/pkg/PLIST,v retrieving revision 1.3 diff -u -p -u -p -r1.3 PLIST --- pkg/PLIST 27 Jun 2018 21:03:45 -0000 1.3 +++ pkg/PLIST 23 Jun 2020 08:16:51 -0000 @@ -13,8 +13,7 @@ share/eliot/lex-fise.dawg share/eliot/rak.dawg share/eliot/sowpods06.dawg share/eliot/twl06.dawg -share/icons/ -share/icons/eliot.xpm +share/icons/eliot.png share/locale/ca/LC_MESSAGES/eliot.mo share/locale/cs/LC_MESSAGES/eliot.mo share/locale/en/LC_MESSAGES/eliot.mo @@ -22,6 +21,7 @@ share/locale/en@boldquot/LC_MESSAGES/eli share/locale/en@quot/LC_MESSAGES/eliot.mo share/locale/es/LC_MESSAGES/eliot.mo share/locale/fr/LC_MESSAGES/eliot.mo +share/locale/gl/LC_MESSAGES/eliot.mo share/locale/id/LC_MESSAGES/eliot.mo share/locale/it/LC_MESSAGES/eliot.mo share/locale/sr/LC_MESSAGES/eliot.mo