aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan de Groot <adridg@FreeBSD.org>2022-03-01 10:17:16 +0000
committerAdriaan de Groot <adridg@FreeBSD.org>2022-03-01 10:42:47 +0000
commite0e4186db92be75489f6979af6da9aa1808cba1c (patch)
treef8c3e1287051c5faa096cdf9e200eeff8f504414
parent759b69bb6bd059363a1eaa5050eeae0d5df16267 (diff)
downloadports-e0e4186db92be75489f6979af6da9aa1808cba1c.tar.gz
ports-e0e4186db92be75489f6979af6da9aa1808cba1c.zip
editors/diamond: update to 1.3.7, latest upstream
This version is just a copyright-year update. I'm taking advantage to follow Daniel Engberg's advice to use the upstream tarballs rather than GitHub tarballs, even though the upstream tarballs are, IMO, terrible. While here, pull in a patch I wrote to avoid crashes on startup.
-rw-r--r--editors/diamond/Makefile21
-rw-r--r--editors/diamond/distinfo6
-rw-r--r--editors/diamond/files/patch-e8f0d274471cf0a50a78aec102ffa87541887f2e.patch47
3 files changed, 64 insertions, 10 deletions
diff --git a/editors/diamond/Makefile b/editors/diamond/Makefile
index 58562eaf6d2c..e36385cee66a 100644
--- a/editors/diamond/Makefile
+++ b/editors/diamond/Makefile
@@ -1,9 +1,9 @@
PORTNAME= diamond
-DISTVERSIONPREFIX= diamond-
-DISTVERSION= 1.3.6
-PORTREVISION= 1
+DISTVERSION= 1.3.7
+DISTNAME= Diamond-${DISTVERSION}
CATEGORIES= editors
PKGNAMESUFFIX= -cs
+MASTER_SITES= https://download.copperspice.com/${PORTNAME}/source/
MAINTAINER= adridg@FreeBSD.org
COMMENT= Compact programmers editor
@@ -15,13 +15,20 @@ LIB_DEPENDS= libhunspell-1.7.so:textproc/hunspell
BUILD_DEPENDS= copperspice>=1.7:x11-toolkits/copperspice
RUN_DEPENDS= copperspice>=1.7:x11-toolkits/copperspice
-USES= compiler:c++17-lang cmake gl gnome iconv jpeg pkgconfig ssl xorg
+USES= compiler:c++17-lang cmake dos2unix gl gnome iconv jpeg pkgconfig ssl tar:bz2 xorg
USE_GL= gl
USE_GNOME= cairo glib20 libxml2
USE_XORG= ice sm x11 xau xcb xcursor xext xfixes xi xinerama xrandr xrender
-USE_GITHUB= yes
-GH_ACCOUNT= copperspice
-GH_PROJECT= diamond
+# It's a bit up-in-the-air if the GitHub tarballs are less fragile
+# than the upstream source tarballs, which have their own peculiarities
+# (e.g. CRLF, no subdir). We dos2unix the files that need patching.
+#
+# USE_GITHUB= yes
+# GH_ACCOUNT= copperspice
+# GH_PROJECT= diamond
+#
+NO_WRKSUBDIR= yes
+DOS2UNIX_FILES= CMakeLists.txt src/CMakeLists.txt src/json.cpp src/recent_tabs.cpp
.include <bsd.port.mk>
diff --git a/editors/diamond/distinfo b/editors/diamond/distinfo
index d907474b1d5a..ce6e462b4c0d 100644
--- a/editors/diamond/distinfo
+++ b/editors/diamond/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1645301383
-SHA256 (copperspice-diamond-diamond-1.3.6_GH0.tar.gz) = e1b85890a870236370207c5d6b7aa7d44d7414a090723ecea513f8b5cec4fb67
-SIZE (copperspice-diamond-diamond-1.3.6_GH0.tar.gz) = 4626624
+TIMESTAMP = 1646082059
+SHA256 (Diamond-1.3.7.tar.bz2) = 1b104df02b0f4dd9debc9286776d7c202bcda64cb84d3cb2b20b161e34e918f1
+SIZE (Diamond-1.3.7.tar.bz2) = 4629796
diff --git a/editors/diamond/files/patch-e8f0d274471cf0a50a78aec102ffa87541887f2e.patch b/editors/diamond/files/patch-e8f0d274471cf0a50a78aec102ffa87541887f2e.patch
new file mode 100644
index 000000000000..52ae0371df30
--- /dev/null
+++ b/editors/diamond/files/patch-e8f0d274471cf0a50a78aec102ffa87541887f2e.patch
@@ -0,0 +1,47 @@
+From e8f0d274471cf0a50a78aec102ffa87541887f2e Mon Sep 17 00:00:00 2001
+From: Adriaan de Groot <groot@kde.org>
+Date: Sun, 20 Feb 2022 16:23:53 +0100
+Subject: [PATCH] Fix crash when passing filenames on command-line
+
+Consider running `diamond file.txt`. If previously there
+was an untitled tab open and nothing else, we arrive
+here with 2 tabs, `cnt==2`. The first for-loop finds
+an untitled tab at index `k==0` and decrements `cnt`,
+then the for-loop increments `k` and the for-loop terminates
+(because `1 < 1` is false). We have `cnt==1` but an **empty**
+list `m_openedFiles`. This crashes with an out-of-bounds access
+in the second for-loop, because `cnt` doesn't match the length
+of the list anymore.
+
+As a fix:
+- do not modify `cnt` in the first for-loop, always check
+ all of the current tabs,
+- re-calculate the `cnt` based on the files that are actually
+ opened, before the second loop.
+---
+ src/recent_tabs.cpp | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/recent_tabs.cpp b/src/recent_tabs.cpp
+index b3359ac..3eef680 100644
+--- src/recent_tabs.cpp
++++ src/recent_tabs.cpp
+@@ -31,15 +31,13 @@ void MainWindow::openTab_CreateMenus()
+ for (int k = 0; k < cnt; ++k) {
+ fullName = this->get_curFileName(k);
+
+- if (fullName.isEmpty()) {
+- --cnt;
+-
+- } else {
++ if (!fullName.isEmpty()) {
+ m_openedFiles.append(fullName);
+ m_openedModified.append(false);
+ }
+ }
+-
++ // How many were really opened
++ cnt = m_openedFiles.count();
+ //
+ QMenu *windowMenu = m_ui->menuWindow;
+ windowMenu->addSeparator();