1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 15:39:01 +00:00

Merge branch 'master' into update-resume-file-before-invoking-torrent-scripts

This commit is contained in:
Charles Kerr 2019-02-06 02:00:47 -05:00 committed by GitHub
commit 39d1a54fbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 121 additions and 84 deletions

View file

@ -1,4 +1,4 @@
Copyright 2005-2018. All code is copyrighted by the respective authors.
Copyright 2005-2019. All code is copyrighted by the respective authors.
Transmission can be redistributed and/or modified under the terms of
the GNU GPLv2 (http://www.gnu.org/licenses/license-list.html#GPLv2),

View file

@ -1,9 +1,9 @@
#!/bin/sh
srcdir=`dirname $0`
srcdir=$(dirname "$0")
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd "$srcdir"
ORIGDIR=$(pwd)
cd "$srcdir" || exit 1
PROJECT=Transmission
GETTEXTIZE="glib-gettextize"
@ -13,19 +13,16 @@ if test $? -ne 0; then
fi
LIBTOOLIZE=libtoolize
if libtoolize --help >/dev/null 2>&1
then
if libtoolize --help > /dev/null 2>&1; then
:
elif glibtoolize --help >/dev/null 2>&1
then
elif glibtoolize --help > /dev/null 2>&1; then
LIBTOOLIZE=glibtoolize
fi
export LIBTOOLIZE
./update-version-h.sh
autoreconf -fi || exit 1;
autoreconf -fi || exit 1
if test "$GETTEXTIZE"; then
echo "Creating aclocal.m4 ..."
@ -47,4 +44,3 @@ if test -z "$AUTOGEN_SUBDIR_MODE"; then
echo
echo "Now type 'make' to compile $PROJECT."
fi

View file

@ -50,7 +50,7 @@ The options are as follows:
Enable peer blocklists. Transmission understands the bluetack blocklist file format.
New blocklists can be added by copying them into the config-dir's "blocklists" subdirectory.
.It Fl B Fl -no-blocklist
Disble blocklists.
Disable blocklists.
.It Fl d, -downlimit Ar number
Set the maximum download speed in KB/s
.It Fl D, -no-downlimit

View file

@ -32,7 +32,7 @@ BEGIN
VALUE "FileDescription", "${TR_FILE_DESCRIPTION}"
VALUE "FileVersion", LONG_VERSION_STRING
VALUE "InternalName", "${TR_INTERNAL_NAME}"
VALUE "LegalCopyright", "2005-2016 Transmission Project"
VALUE "LegalCopyright", "2005-2019 Transmission Project"
VALUE "OriginalFilename", "${TR_ORIGINAL_FILENAME}"
VALUE "ProductName", "Transmission"
VALUE "ProductVersion", LONG_VERSION_STRING

View file

@ -1,4 +1,4 @@
#/bin/sh
#!/bin/sh
export G_SLICE=always-malloc
export G_DEBUG=gc-friendly
export GLIBCXX_FORCE_NEW=1

View file

@ -7,6 +7,7 @@ User=transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecReload=/bin/kill -s HUP $MAINPID
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target

View file

@ -47,7 +47,7 @@ SMTP_SERVER=your.smtp.server
SUBJECT="Torrent Done!"
FROM_ADDR="transmission@localhost.localdomain"
TMPFILE=`mktemp -t transmission.XXXXXXXXXX`
echo "Transmission finished downloading \"$TR_TORRENT_NAME\" on $TR_TIME_LOCALTIME" >$TMPFILE
$NAIL -v -S from="$FROM_ADDR" -S smtp -s "$SUBJECT" -S smtp=$SMTP_SERVER "$TO_ADDR" < $TMPFILE
rm $TMPFILE
TMPFILE=$(mktemp -t transmission.XXXXXXXXXX)
echo "Transmission finished downloading \"$TR_TORRENT_NAME\" on $TR_TIME_LOCALTIME" > "$TMPFILE"
$NAIL -v -S from="$FROM_ADDR" -S smtp -s "$SUBJECT" -S smtp=$SMTP_SERVER "$TO_ADDR" < "$TMPFILE"
rm "$TMPFILE"

View file

@ -59,7 +59,7 @@
#define SHOW_LICENSE
static char const* LICENSE =
"Copyright 2005-2018. All code is copyrighted by the respective authors.\n"
"Copyright 2005-2019. All code is copyrighted by the respective authors.\n"
"\n"
"Transmission can be redistributed and/or modified under the terms of the "
"GNU GPL versions 2 or 3 or by any future license endorsed by Mnemosyne LLC.\n"

View file

@ -1,4 +1,4 @@
#/bin/sh
#!/bin/sh
export G_SLICE=always-malloc
export G_DEBUG=gc-friendly
export GLIBCXX_FORCE_NEW=1

View file

@ -19,12 +19,14 @@
#include "libtransmission-test.h"
static char const* contents1 =
"10.5.6.7/8\n"
"Austin Law Firm:216.16.1.144-216.16.1.151\n"
"Sargent Controls and Aerospace:216.19.18.0-216.19.18.255\n"
"Corel Corporation:216.21.157.192-216.21.157.223\n"
"Fox Speed Channel:216.79.131.192-216.79.131.223\n";
static char const* contents2 =
"10.5.6.7/8\n"
"Austin Law Firm:216.16.1.144-216.16.1.151\n"
"Sargent Controls and Aerospace:216.19.18.0-216.19.18.255\n"
"Corel Corporation:216.21.157.192-216.21.157.223\n"
@ -70,7 +72,7 @@ static int test_parsing(void)
tr_free(path);
tr_sessionReloadBlocklists(session);
check(tr_blocklistExists(session));
check_int(tr_blocklistGetRuleCount(session), ==, 4);
check_int(tr_blocklistGetRuleCount(session), ==, 5);
/* enable the blocklist */
check(!tr_blocklistIsEnabled(session));
@ -78,6 +80,8 @@ static int test_parsing(void)
check(tr_blocklistIsEnabled(session));
/* test blocked addresses */
check(!address_is_blocked(session, "0.0.0.1"));
check(address_is_blocked(session, "10.1.2.3"));
check(!address_is_blocked(session, "216.16.1.143"));
check(address_is_blocked(session, "216.16.1.144"));
check(address_is_blocked(session, "216.16.1.145"));
@ -116,22 +120,22 @@ static int test_updating(void)
/* test that updated source files will get loaded */
create_text_file(path, contents1);
tr_sessionReloadBlocklists(session);
check_int(tr_blocklistGetRuleCount(session), ==, 4);
check_int(tr_blocklistGetRuleCount(session), ==, 5);
/* test that updated source files will get loaded */
create_text_file(path, contents2);
tr_sessionReloadBlocklists(session);
check_int(tr_blocklistGetRuleCount(session), ==, 5);
check_int(tr_blocklistGetRuleCount(session), ==, 6);
/* test that updated source files will get loaded */
create_text_file(path, contents1);
tr_sessionReloadBlocklists(session);
check_int(tr_blocklistGetRuleCount(session), ==, 4);
check_int(tr_blocklistGetRuleCount(session), ==, 5);
/* ensure that new files, if bad, get skipped */
create_text_file(path, "# nothing useful\n");
tr_sessionReloadBlocklists(session);
check_int(tr_blocklistGetRuleCount(session), ==, 4);
check_int(tr_blocklistGetRuleCount(session), ==, 5);
/* cleanup */
libttest_session_close(session);

View file

@ -301,9 +301,38 @@ static bool parseLine2(char const* line, struct tr_ipv4_range* range)
return true;
}
/*
* CIDR notation: "0.0.0.0/8", IPv4 only
* https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation
*/
static bool parseLine3(char const* line, struct tr_ipv4_range* range) {
unsigned ip[4];
unsigned pflen;
uint32_t ip_u;
uint32_t mask = 0xffffffff;
if (sscanf(line, "%u.%u.%u.%u/%u", &ip[0], &ip[1], &ip[2], &ip[3], &pflen) != 5) {
return false;
}
if (pflen > 32 || ip[0] > 0xff || ip[1] > 0xff || ip[2] > 0xff || ip[3] > 0xff) {
return false;
}
/* this is host order */
mask <<= 32 - pflen;
ip_u = ip[0] << 24 | ip[1] << 16 | ip[2] << 8 | ip[3];
/* fill the non-prefix bits the way we need it */
range->begin = ip_u & mask;
range->end = ip_u | (~mask);
return true;
}
static bool parseLine(char const* line, struct tr_ipv4_range* range)
{
return parseLine1(line, range) || parseLine2(line, range);
return parseLine1(line, range) || parseLine2(line, range) || parseLine3(line, range);
}
static int compareAddressRangesByFirstAddress(void const* va, void const* vb)

View file

@ -1,7 +1,8 @@
#!/bin/sh
err=0
count=0
while [ $err -eq 0 ]; do
count=$((count+1))
count=$((count + 1))
echo starting run number $count
make check
err=$?

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -72,7 +72,7 @@
<true/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2005-2016 The Transmission Project</string>
<string>Copyright © 2005-2019 The Transmission Project</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -49,7 +49,7 @@
<key>CFPlugInUnloadFunction</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2005-2018 The Transmission Project</string>
<string>Copyright © 2005-2019 The Transmission Project</string>
<key>QLNeedsToBeRunInMainThread</key>
<false/>
<key>QLPreviewHeight</key>

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 20052018 Transmission-Projekt";
NSHumanReadableCopyright = "Copyright © 20052019 Transmission-Projekt";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2005-2012 Transmission authors and contributors
* Copyright (c) 2005-2019 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 Het Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 Het Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 2005-2018 The Transmission Project";
NSHumanReadableCopyright = "Copyright © 2005-2019 The Transmission Project";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "© 2005-2018 The Transmission Project, все права защищены";
NSHumanReadableCopyright = "© 2005-2019 The Transmission Project, все права защищены";

View file

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "© 2005-2018 The Transmission Project, tüm hakları saklıdır";
NSHumanReadableCopyright = "© 2005-2019 The Transmission Project, tüm hakları saklıdır";

View file

@ -20,7 +20,7 @@
<bool>true</bool>
</property>
<property name="plainText">
<string notr="true">Copyright 2005-2016. All code is copyrighted by the respective authors.
<string notr="true">Copyright 2005-2019. All code is copyrighted by the respective authors.
Transmission can be redistributed and/or modified under the terms of the GNU GPL versions 2 or 3 or by any future license endorsed by Mnemosyne LLC.

View file

@ -1,4 +1,4 @@
#/bin/sh
#!/bin/sh
#valgrind --tool=cachegrind ./transmission-qt 2>&1 | tee runlog
#valgrind --tool=massif --threshold=0.2 ./transmission-qt 2>&1 | tee runlog
valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=16 --log-file=x-valgrind --show-reachable=no ./transmission-qt 2>&1 | tee runlog

View file

@ -2,47 +2,44 @@
# Generate files to be included: only overwrite them if changed so make
# won't rebuild everything unless necessary
replace_if_differs ()
{
if cmp $1 $2 > /dev/null 2>&1; then
rm -f $1
replace_if_differs() {
if cmp "$1" "$2" > /dev/null 2>&1; then
rm -f "$1"
else
mv -f $1 $2
mv -f "$1" "$2"
fi
}
echo "creating libtransmission/version.h"
user_agent_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix | cut -d , -f 6`
user_agent_prefix=$(grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix | cut -d , -f 6)
peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix | cut -d , -f 6`
peer_id_prefix=$(grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix | cut -d , -f 6)
major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
major_version=$(echo "${user_agent_prefix}" | awk -F . '{print $1}')
minor_version=$(echo "${user_agent_prefix}" | awk -F . '{print $2 + 0}')
vcs_revision=
vcs_revision_file=REVISION
if [ -n "$JENKINS_URL" -a -n "$GIT_COMMIT" ]; then
if [ -n "$JENKINS_URL" ] && [ -n "$GIT_COMMIT" ]; then
vcs_revision=$GIT_COMMIT
elif [ -n "$TEAMCITY_PROJECT_NAME" -a -n "$BUILD_VCS_NUMBER" ]; then
elif [ -n "$TEAMCITY_PROJECT_NAME" ] && [ -n "$BUILD_VCS_NUMBER" ]; then
vcs_revision=$BUILD_VCS_NUMBER
elif [ -d ".git" ] && type git >/dev/null 2>&1; then
vcs_revision=`git rev-list --max-count=1 HEAD`
elif [ -d ".git" ] && type git > /dev/null 2>&1; then
vcs_revision=$(git rev-list --max-count=1 HEAD)
elif [ -f "$vcs_revision_file" ]; then
vcs_revision=`cat "$vcs_revision_file"`
vcs_revision=$(cat "$vcs_revision_file")
fi
vcs_revision=`echo $vcs_revision`
if [ -n "$vcs_revision" ]; then
[ -f "$vcs_revision_file" ] && [ "`cat "$vcs_revision_file"`" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
[ -f "$vcs_revision_file" ] && [ "$(cat "$vcs_revision_file")" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
else
vcs_revision=0
rm -f "$vcs_revision_file"
fi
vcs_revision=`echo $vcs_revision | head -c10`
vcs_revision=$(echo $vcs_revision | head -c10)
cat > libtransmission/version.h.new << EOF
#pragma once

View file

@ -32,6 +32,7 @@ static tr_option options[] =
{
{ 'm', "magnet", "Give a magnet link for the specified torrent", "m", 0, NULL },
{ 's', "scrape", "Ask the torrent's trackers how many peers are in the torrent's swarm", "s", 0, NULL },
{ 'u', "unsorted", "Do not sort files by name", "u", 0, NULL },
{ 'V', "version", "Show version number and exit", "V", 0, NULL },
{ 0, NULL, NULL, NULL, 0, NULL }
};
@ -43,6 +44,7 @@ static char const* getUsage(void)
static bool magnetFlag = false;
static bool scrapeFlag = false;
static bool unsorted = false;
static bool showVersion = false;
char const* filename = NULL;
@ -63,6 +65,10 @@ static int parseCommandLine(int argc, char const* const* argv)
scrapeFlag = true;
break;
case 'u':
unsorted = true;
break;
case 'V':
showVersion = true;
break;
@ -189,7 +195,10 @@ static void showInfo(tr_info const* inf)
files[i] = &inf->files[i];
}
if (!unsorted)
{
qsort(files, inf->fileCount, sizeof(tr_file*), compare_files_by_name);
}
for (unsigned int i = 0; i < inf->fileCount; ++i)
{