From 30d93b719a68045bba60a5f4af1523db8c6ee4d1 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 7 Nov 2023 22:41:55 -0500 Subject: [PATCH] network/gtorrentviewer: New maintainer, fix segfaults. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- network/gtorrentviewer/README | 6 +- network/gtorrentviewer/doinst.sh | 6 ++ .../gtorrentviewer/gtorrentviewer.SlackBuild | 69 ++++++++++--------- network/gtorrentviewer/gtorrentviewer.desktop | 12 ++++ network/gtorrentviewer/gtorrentviewer.info | 4 +- .../patches/GTorrentViewer-0.2b-format.patch | 48 +++++++++++++ .../GTorrentViewer-0.2b-missing-tracker.patch | 12 ++++ .../patches/fix_linking_libm.diff | 12 ---- .../patches/gtorrentviewer-0.2b-desktop.patch | 17 ----- .../gtorrentviewer-0.2b-trackerdetails.patch | 56 +++++++++++++++ network/gtorrentviewer/patches/manpage.diff | 23 +++++++ network/gtorrentviewer/patches/series | 5 ++ 12 files changed, 204 insertions(+), 66 deletions(-) create mode 100644 network/gtorrentviewer/gtorrentviewer.desktop create mode 100644 network/gtorrentviewer/patches/GTorrentViewer-0.2b-format.patch create mode 100644 network/gtorrentviewer/patches/GTorrentViewer-0.2b-missing-tracker.patch delete mode 100644 network/gtorrentviewer/patches/fix_linking_libm.diff delete mode 100644 network/gtorrentviewer/patches/gtorrentviewer-0.2b-desktop.patch create mode 100644 network/gtorrentviewer/patches/gtorrentviewer-0.2b-trackerdetails.patch create mode 100644 network/gtorrentviewer/patches/manpage.diff create mode 100644 network/gtorrentviewer/patches/series diff --git a/network/gtorrentviewer/README b/network/gtorrentviewer/README index 1d1e56ec43..e7af7de9e8 100644 --- a/network/gtorrentviewer/README +++ b/network/gtorrentviewer/README @@ -1,3 +1,5 @@ +gtorrentviewer (A torrent viewer and editor) + GTorrentViewer is a GTK2-based viewer and editor for BitTorrent meta files. It is able to retrieve information from trackers, check files, show detailed information, and modify .torrent files without having @@ -5,6 +7,6 @@ to start downloading. The purpose of GTorrentViewer is to give the ability to see and modify all the possible information from .torrent files without having to start -downloading and the ability to see in real time the current number of +downloading, and the ability to see in real time the current number of seeds and peers on the torrent, so you will always know the status -before start the download. +before starting the download. diff --git a/network/gtorrentviewer/doinst.sh b/network/gtorrentviewer/doinst.sh index 9a8ded3c60..3edf8699cf 100644 --- a/network/gtorrentviewer/doinst.sh +++ b/network/gtorrentviewer/doinst.sh @@ -1,3 +1,9 @@ +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi + if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 fi diff --git a/network/gtorrentviewer/gtorrentviewer.SlackBuild b/network/gtorrentviewer/gtorrentviewer.SlackBuild index 4eb3257498..90b73f2eb6 100644 --- a/network/gtorrentviewer/gtorrentviewer.SlackBuild +++ b/network/gtorrentviewer/gtorrentviewer.SlackBuild @@ -2,8 +2,9 @@ # Slackware build script for gtorrentviewer +# Copyright 2023 B. Watson # Copyright 2018 Donald Cooley South Haven, Indiana USA -# Copyright 2010, 2012 Binh Nguyen +# Copyright 2010, 2012 Binh Nguyen # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -23,12 +24,20 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20231107 bkw: BUILD=5 +# - take over maintenance. +# - patch various segfault issues. +# - remove generic INSTALL from doc dir. +# - fix .desktop file. +# - new-style icon. +# - slight grammar fix in README and man page. + cd $(dirname $0) ; CWD=$(pwd) PRGNAM=gtorrentviewer SRCNAM=GTorrentViewer VERSION=${VERSION:-0.2b} -BUILD=${BUILD:-4} +BUILD=${BUILD:-5} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -40,9 +49,6 @@ if [ -z "$ARCH" ]; then esac fi -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -75,27 +81,24 @@ rm -rf $SRCNAM-$VERSION tar xvf $CWD/$SRCNAM-$VERSION.tar.gz cd $SRCNAM-$VERSION chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + + +# 20231107 bkw: most of these patches came from ALT Linux: +# https://git.altlinux.org/srpms/g/gtorrentviewer.git?a=tree;hb=0.2b-alt4_38 +# ...but a couple of them were "-p0" patches. I reworked them to apply +# with "patch -p1". The curl-types, desktop, and dso-linking patches aren't +# needed because their issues are fixed by code in this script. +# The manpage patch is a grammar fix, done by me. +for i in `cat $CWD/patches/series`; do + echo "=== applying $i" + patch -p1 < $CWD/patches/$i +done # Fix building against newer cURL -sed -i 's|#include ||g' src/main.c - -# Fix linking of libm -patch -p1 < $CWD/patches/fix_linking_libm.diff - -# The following 2 patches are from Fedora 13 - -# Let drag and drop work with URIs as well as files -patch -p1 < $CWD/patches/gtorrentviewer-0.2b-desktop.patch - -# Fix crash due to use of uninitialized GValue -# Thanks to Niels Horn for pointing this out -patch -p1 < $CWD/patches/GTorrentViewer-0.2b-tracker-details-refresh.patch +sed -i '/#include /d' src/main.c +LIBS="-lm" \ CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ @@ -106,19 +109,19 @@ CFLAGS="$SLKCFLAGS" \ --build=$ARCH-slackware-linux make -make install DESTDIR=$PKG +make install-strip DESTDIR=$PKG +gzip -9 $PKG/usr/man/man*/* -find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# 20231107 bkw: ship .desktop with corrections already applied. +cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop -find $PKG/usr/man -type f -exec gzip -9 {} \; -for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +mkdir -p $PKG/usr/share/icons/hicolor/48x48 +ln -s ../../../pixmaps/$PRGNAM.png $PKG/usr/share/icons/hicolor/48x48/$PRGNAM.png -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a \ - AUTHORS COPYING ChangeLog INSTALL README \ -$PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKGDOC +cp -a AUTHORS COPYING ChangeLog README $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/network/gtorrentviewer/gtorrentviewer.desktop b/network/gtorrentviewer/gtorrentviewer.desktop new file mode 100644 index 0000000000..42bb9ab276 --- /dev/null +++ b/network/gtorrentviewer/gtorrentviewer.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=Torrent Metainfo Viewer +GenericName=Torrent Viewer +Comment=Viewer and Editor for .torrent files +Exec=gtorrentviewer %f +Icon=gtorrentviewer +StartupNotify=false +Terminal=false +Type=Application +Categories=Network; +MimeType=application/x-bittorrent; +Version=1.0 diff --git a/network/gtorrentviewer/gtorrentviewer.info b/network/gtorrentviewer/gtorrentviewer.info index 7f3405ecb1..069a2fd9ff 100644 --- a/network/gtorrentviewer/gtorrentviewer.info +++ b/network/gtorrentviewer/gtorrentviewer.info @@ -6,5 +6,5 @@ MD5SUM="c29058a09f26693863404ecdb2580770" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Donald Cooley" -EMAIL="chytraeu@sdf.org" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/network/gtorrentviewer/patches/GTorrentViewer-0.2b-format.patch b/network/gtorrentviewer/patches/GTorrentViewer-0.2b-format.patch new file mode 100644 index 0000000000..9b1d7e3484 --- /dev/null +++ b/network/gtorrentviewer/patches/GTorrentViewer-0.2b-format.patch @@ -0,0 +1,48 @@ +diff -Naur GTorrentViewer-0.2b/src/mainwindow.c GTorrentViewer-0.2b.patched/src/mainwindow.c +--- GTorrentViewer-0.2b/src/mainwindow.c 2004-10-26 00:37:58.000000000 -0400 ++++ GTorrentViewer-0.2b.patched/src/mainwindow.c 2023-11-07 20:56:10.027535819 -0500 +@@ -634,7 +634,7 @@ + /* create the open file thread */ + if(g_thread_create(open_torrent_file, filename, FALSE, &err) == NULL) + { +- g_warning(err->message); ++ g_warning("%s", err->message); + g_free(filename); + g_error_free(err); + } +@@ -671,7 +671,7 @@ + + if(g_thread_create(tracker_scrape, tracker, FALSE, &err) == NULL) + { +- g_warning(err->message); ++ g_warning("%s", err->message); + g_free(tracker); + g_error_free(err); + } +@@ -722,7 +722,7 @@ + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + if(g_thread_create(check_files, filename, FALSE, &err) == NULL) + { +- g_warning(err->message); ++ g_warning("%s", err->message); + g_free(filename); + g_error_free(err); + } +@@ -755,7 +755,7 @@ + + if(g_thread_create(tracker_scrape, tracker, FALSE, &err) == NULL) + { +- g_warning(err->message); ++ g_warning("%s", err->message); + g_error_free(err); + } + +@@ -853,7 +853,7 @@ + { + if(g_thread_create(open_torrent_file, filename, FALSE, &err) == NULL) + { +- g_warning(err->message); ++ g_warning("%s", err->message); + g_free(filename); + g_error_free(err); + } diff --git a/network/gtorrentviewer/patches/GTorrentViewer-0.2b-missing-tracker.patch b/network/gtorrentviewer/patches/GTorrentViewer-0.2b-missing-tracker.patch new file mode 100644 index 0000000000..8e1f3a4a06 --- /dev/null +++ b/network/gtorrentviewer/patches/GTorrentViewer-0.2b-missing-tracker.patch @@ -0,0 +1,12 @@ +diff -Naur GTorrentViewer-0.2b/src/mainwindow.c GTorrentViewer-0.2b.patched/src/mainwindow.c +--- GTorrentViewer-0.2b/src/mainwindow.c 2023-11-07 21:01:19.243506719 -0500 ++++ GTorrentViewer-0.2b.patched/src/mainwindow.c 2023-11-07 21:02:04.947502418 -0500 +@@ -423,7 +423,7 @@ + + node = benc_node_find_key(torrent, "announce"); + gtk_list_store_append(liststore, &iter); +- gtk_list_store_set(liststore, &iter, 0, benc_node_data(node), -1); ++ gtk_list_store_set(liststore, &iter, 0, node!=NULL?benc_node_data(node):"", -1); + + node = benc_node_find_key(torrent, "announce-list"); + if(node != NULL) /* multi-tracker support */ diff --git a/network/gtorrentviewer/patches/fix_linking_libm.diff b/network/gtorrentviewer/patches/fix_linking_libm.diff deleted file mode 100644 index 4be5b63bb3..0000000000 --- a/network/gtorrentviewer/patches/fix_linking_libm.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nur GTorrentViewer-0.2b.orig/src/Makefile.in GTorrentViewer-0.2b/src/Makefile.in ---- GTorrentViewer-0.2b.orig/src/Makefile.in 2004-10-25 23:42:16.000000000 -0500 -+++ GTorrentViewer-0.2b/src/Makefile.in 2012-09-09 23:31:34.092115981 -0500 -@@ -115,7 +115,7 @@ - - CFLAGS = @CFLAGS@ @CURL_CFLAGS@ @GTK_CFLAGS@ - --LDADD = @GTK_LIBS@ @CURL_LIBS@ -+LDADD = @GTK_LIBS@ @CURL_LIBS@ -lm - - bin_PROGRAMS = gtorrentviewer - diff --git a/network/gtorrentviewer/patches/gtorrentviewer-0.2b-desktop.patch b/network/gtorrentviewer/patches/gtorrentviewer-0.2b-desktop.patch deleted file mode 100644 index ca12b05ec3..0000000000 --- a/network/gtorrentviewer/patches/gtorrentviewer-0.2b-desktop.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- GTorrentViewer-0.2b/data/gtorrentviewer.desktop.in.orig 2004-10-21 05:40:16.000000000 +0100 -+++ GTorrentViewer-0.2b/data/gtorrentviewer.desktop.in 2007-08-12 12:14:52.000000000 +0100 -@@ -2,7 +2,7 @@ - _Name=Torrent Metainfo Viewer - _GenericName=Torrent Viewer - _Comment=Viewer and Editor for .torrent files --Exec=gtorrentviewer %U -+Exec=gtorrentviewer %f - Icon=gtorrentviewer.png - StartupNotify=false - Terminal=false -@@ -10,4 +10,4 @@ - Encoding=UTF-8 - Categories=Application;Network; - MimeType=application/x-bittorrent; --Version=0.2 -+Version=1.0 diff --git a/network/gtorrentviewer/patches/gtorrentviewer-0.2b-trackerdetails.patch b/network/gtorrentviewer/patches/gtorrentviewer-0.2b-trackerdetails.patch new file mode 100644 index 0000000000..dbdb68d62c --- /dev/null +++ b/network/gtorrentviewer/patches/gtorrentviewer-0.2b-trackerdetails.patch @@ -0,0 +1,56 @@ +diff --git a/src/main.c b/src/main.c +index fc51205..a770768 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -336,12 +336,8 @@ tracker_scrape(gpointer tracker) + SHA1((guint8*)string, number, (guint8*)torrent_sha); + g_free(string); + +- if(g_str_has_suffix((gchar*)tracker, "info_hash=")) +- string = util_convert_to_hex(torrent_sha, SHA_DIGEST_LENGTH, "%"); +- else +- string = g_strdup(" "); +- +- host = g_strdup_printf("%s%s", (gchar*)tracker, string); ++ string = util_convert_to_hex(torrent_sha, SHA_DIGEST_LENGTH, "%"); ++ host = g_strdup_printf("%s?info_hash=%s", (gchar*)tracker, string); + g_free(string); + + string = g_strrstr(host, "announce"); +diff --git a/src/mainwindow.c b/src/mainwindow.c +index 6b1bbf0..415098e 100644 +--- a/src/mainwindow.c ++++ b/src/mainwindow.c +@@ -421,23 +421,23 @@ mainwindow_fill_trackers_tab(MainWindow const *mwin, BencNode *torrent) + + gtk_combo_box_set_active(mwin->TrackerComboBox, -1); + ++ node = benc_node_find_key(torrent, "announce"); ++ gtk_list_store_append(liststore, &iter); ++ gtk_list_store_set(liststore, &iter, 0, benc_node_data(node), -1); ++ + node = benc_node_find_key(torrent, "announce-list"); +- if(node == NULL) /* no multi-tracker */ +- { +- node = benc_node_find_key(torrent, "announce"); +- gtk_list_store_append(liststore, &iter); +- gtk_list_store_set(liststore, &iter, 0, benc_node_data(node), -1); +- } +- else /* multi-tracker support */ ++ if(node != NULL) /* multi-tracker support */ + { +- node = benc_node_first_child(node); +- if(node != NULL) ++ for (node = benc_node_first_child(node); node != NULL; ++ node = benc_node_next_sibling(node)) ++ { + for(subnode = benc_node_first_child(node); subnode != NULL; + subnode = benc_node_next_sibling(subnode)) + { + gtk_list_store_append(liststore, &iter); + gtk_list_store_set(liststore, &iter, 0, benc_node_data(subnode), -1); + } ++ } + } + + gtk_combo_box_set_model(mwin->TrackerComboBox, GTK_TREE_MODEL(liststore)); diff --git a/network/gtorrentviewer/patches/manpage.diff b/network/gtorrentviewer/patches/manpage.diff new file mode 100644 index 0000000000..99909b805e --- /dev/null +++ b/network/gtorrentviewer/patches/manpage.diff @@ -0,0 +1,23 @@ +diff -Naur GTorrentViewer-0.2b/data/gtorrentviewer.1 GTorrentViewer-0.2b.patched/data/gtorrentviewer.1 +--- GTorrentViewer-0.2b/data/gtorrentviewer.1 2004-10-18 18:40:11.000000000 -0400 ++++ GTorrentViewer-0.2b.patched/data/gtorrentviewer.1 2023-11-07 22:30:10.103005035 -0500 +@@ -14,8 +14,8 @@ + .PP + The purpose of GTorrentViewer is to give the ability to see and modify all + the possible information from .torrent files without having to start +-downloading and the ability to see in real time the current number of seeds +-and peers on the torrent, so you will always know the status before start ++downloading, and the ability to see in real time the current number of seeds ++and peers on the torrent, so you will always know the status before starting + the download. + .SH OPTIONS + gtorrentviewer options: +@@ -24,7 +24,7 @@ + output version information and exit. + .TP + .B \-h, \-\-help +-display a option overview and exit. ++display an option overview and exit. + .SH AUTHOR + GTorrentViewer was written by Alejandro Claro . + .PP diff --git a/network/gtorrentviewer/patches/series b/network/gtorrentviewer/patches/series new file mode 100644 index 0000000000..c9c40df86d --- /dev/null +++ b/network/gtorrentviewer/patches/series @@ -0,0 +1,5 @@ +GTorrentViewer-0.2b-tracker-details-refresh.patch +gtorrentviewer-0.2b-trackerdetails.patch +GTorrentViewer-0.2b-format.patch +GTorrentViewer-0.2b-missing-tracker.patch +manpage.diff