diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build/combine_libs | 9 | ||||
-rwxr-xr-x | scripts/ci/ci-driver.sh | 7 | ||||
-rwxr-xr-x | scripts/codegen/fuzzing_include_am.py | 8 | ||||
-rwxr-xr-x | scripts/git/git-list-tor-branches.sh | 3 | ||||
-rwxr-xr-x | scripts/git/git-pull-all.sh | 22 | ||||
-rw-r--r-- | scripts/maint/checkOptionDocs.pl.in | 2 | ||||
-rwxr-xr-x | scripts/maint/checkShellScripts.sh | 1 | ||||
-rwxr-xr-x | scripts/maint/checkSpace.pl | 14 | ||||
-rwxr-xr-x | scripts/maint/check_config_macros.pl | 4 | ||||
-rwxr-xr-x | scripts/maint/findMergedChanges.pl | 16 | ||||
-rwxr-xr-x | scripts/maint/gen_ccls_file.sh | 10 | ||||
-rwxr-xr-x | scripts/maint/practracker/includes.py | 10 | ||||
-rwxr-xr-x | scripts/maint/practracker/test_practracker.sh | 9 | ||||
-rw-r--r-- | scripts/maint/practracker/util.py | 3 | ||||
-rwxr-xr-x | scripts/maint/run_calltool.sh | 8 | ||||
-rwxr-xr-x | scripts/maint/updateRustDependencies.sh | 45 |
16 files changed, 51 insertions, 120 deletions
diff --git a/scripts/build/combine_libs b/scripts/build/combine_libs index 9c87f68248..a855171dc7 100755 --- a/scripts/build/combine_libs +++ b/scripts/build/combine_libs @@ -8,15 +8,11 @@ ORIGDIR="$(pwd)" trap 'cd "$ORIGDIR" && rm -rf "$TMPDIR"' 0 abspath() { - echo "$(cd "$(dirname "$1")">/dev/null && pwd)/$(basename "$1")" + echo "$(cd "$(dirname "$1")" >/dev/null && pwd)/$(basename "$1")" } TARGET=$(abspath "$1") -#echo ORIGDIR="$ORIGDIR" -#echo AR="$AR" -#echo ARFLAGS="$AFLAGS" - shift for input in "$@"; do @@ -24,12 +20,11 @@ for input in "$@"; do abs=$(abspath "$input") dir="$TMPDIR"/$(basename "$input" .a) mkdir "$dir" - cd "$dir">/dev/null + cd "$dir" >/dev/null "${AR:-ar}" x "$abs" done cd "$TMPDIR" >/dev/null -#echo "${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/** "${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/** "${RANLIB:-ranlib}" library.tmp.a mv -f library.tmp.a "$TARGET" diff --git a/scripts/ci/ci-driver.sh b/scripts/ci/ci-driver.sh index 3e47f68187..ff4881dd8e 100755 --- a/scripts/ci/ci-driver.sh +++ b/scripts/ci/ci-driver.sh @@ -30,7 +30,6 @@ RUN_STAGE_TEST="${RUN_STAGE_TEST:-yes}" FATAL_WARNINGS="${FATAL_WARNINGS:-yes}" HARDENING="${HARDENING:-no}" COVERAGE="${COVERAGE:-no}" -RUST="${RUST:-no}" DOXYGEN="${DOXYGEN:-no}" ASCIIDOC="${ASCIIDOC:-no}" TRACING="${TRACING:-no}" @@ -193,7 +192,6 @@ yes_or_no ON_GITLAB yes_or_no FATAL_WARNINGS yes_or_no HARDENING yes_or_no COVERAGE -yes_or_no RUST yes_or_no DOXYGEN yes_or_no ASCIIDOC yes_or_no TRACING @@ -245,9 +243,6 @@ fi if [[ "$COVERAGE" == "yes" ]]; then configure_options+=("--enable-coverage") fi -if [[ "$RUST" == "yes" ]]; then - configure_options+=("--enable-rust") -fi if [[ "$ASCIIDOC" != "yes" ]]; then configure_options+=("--disable-asciidoc") fi @@ -454,6 +449,8 @@ if [[ "${CHUTNEY}" = "yes" ]]; then start_section "Chutney" export CHUTNEY_TOR_SANDBOX=0 export CHUTNEY_ALLOW_FAILURES=2 + # Send 5MB for every verify check. + export CHUTNEY_DATA_BYTES=5000000 if runcmd make "${CHUTNEY_MAKE_TARGET}"; then hooray "Chutney tests have succeeded" else diff --git a/scripts/codegen/fuzzing_include_am.py b/scripts/codegen/fuzzing_include_am.py index 639b436527..d5d5cb0154 100755 --- a/scripts/codegen/fuzzing_include_am.py +++ b/scripts/codegen/fuzzing_include_am.py @@ -6,6 +6,8 @@ from __future__ import print_function from __future__ import unicode_literals FUZZERS = """ + address + addressPTR consensus descriptor diff @@ -32,7 +34,6 @@ FUZZING_LDFLAG = \ @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@ FUZZING_LIBS = \ src/test/libtor-testing.a \ - $(rust_ldadd) \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \ @@ -47,11 +48,10 @@ oss-fuzz-prereqs: \ noinst_HEADERS += \ src/test/fuzz/fuzzing.h -LIBFUZZER = -lFuzzer LIBFUZZER_CPPFLAGS = $(FUZZING_CPPFLAGS) -DLLVM_FUZZ LIBFUZZER_CFLAGS = $(FUZZING_CFLAGS) -LIBFUZZER_LDFLAG = $(FUZZING_LDFLAG) -LIBFUZZER_LIBS = $(FUZZING_LIBS) $(LIBFUZZER) -lstdc++ +LIBFUZZER_LDFLAG = $(FUZZING_LDFLAG) -fsanitize=fuzzer +LIBFUZZER_LIBS = $(FUZZING_LIBS) -lstdc++ LIBOSS_FUZZ_CPPFLAGS = $(FUZZING_CPPFLAGS) -DLLVM_FUZZ LIBOSS_FUZZ_CFLAGS = $(FUZZING_CFLAGS) diff --git a/scripts/git/git-list-tor-branches.sh b/scripts/git/git-list-tor-branches.sh index fdc1b425dd..62547dcc5d 100755 --- a/scripts/git/git-list-tor-branches.sh +++ b/scripts/git/git-list-tor-branches.sh @@ -139,9 +139,6 @@ finish() { branch maint-0.3.5 branch release-0.3.5 -branch maint-0.4.4 -branch release-0.4.4 - branch maint-0.4.5 branch release-0.4.5 diff --git a/scripts/git/git-pull-all.sh b/scripts/git/git-pull-all.sh index 94313c3473..bbe2576d8e 100755 --- a/scripts/git/git-pull-all.sh +++ b/scripts/git/git-pull-all.sh @@ -159,20 +159,7 @@ function goto_repo function fetch_origin { local cmd="git fetch origin" - printf " %s Fetching origin..." "$MARKER" - if [ $DRY_RUN -eq 0 ]; then - msg=$( eval "$cmd" 2>&1 ) - validate_ret $? "$msg" - else - printf "\\n %s\\n" "${IWTH}$cmd${CNRM}" - fi -} - -# Fetch tor-github pull requests. No arguments. -function fetch_tor_github -{ - local cmd="git fetch tor-github" - printf " %s Fetching tor-github..." "$MARKER" + printf "%s Fetching origin..." "$MARKER" if [ $DRY_RUN -eq 0 ]; then msg=$( eval "$cmd" 2>&1 ) validate_ret $? "$msg" @@ -185,7 +172,7 @@ function fetch_tor_github function fetch_tor_gitlab { local cmd="git fetch tor-gitlab" - printf " %s Fetching tor-gitlab..." "$MARKER" + printf "%s Fetching tor-gitlab..." "$MARKER" if [ $DRY_RUN -eq 0 ]; then msg=$( eval "$cmd" 2>&1 ) validate_ret $? "$msg" @@ -198,11 +185,10 @@ function fetch_tor_gitlab # Entry point # ############### -# First, fetch tor-github. +# Get into our origin repository. goto_repo "$ORIGIN_PATH" -fetch_tor_github -# Then tor-gitlab +# First, fetch tor-gitlab fetch_tor_gitlab # Then, fetch the origin. diff --git a/scripts/maint/checkOptionDocs.pl.in b/scripts/maint/checkOptionDocs.pl.in index bb8008c2e8..2d4a7884f5 100644 --- a/scripts/maint/checkOptionDocs.pl.in +++ b/scripts/maint/checkOptionDocs.pl.in @@ -43,7 +43,7 @@ open(F, "@abs_top_srcdir@/doc/man/tor.1.txt") or die; while (<F>) { if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*!) { $manPageOptions{$2} = 1; - print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor'); + print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor'); } } close F; diff --git a/scripts/maint/checkShellScripts.sh b/scripts/maint/checkShellScripts.sh index 0a423be29e..f7e260bbd2 100755 --- a/scripts/maint/checkShellScripts.sh +++ b/scripts/maint/checkShellScripts.sh @@ -41,7 +41,6 @@ rm -f "$TOPLEVEL/contrib/dist/suse/tor.sh" "$TOPLEVEL/contrib/dist/tor.sh" find "$TOPLEVEL/contrib" "$TOPLEVEL/doc" "$TOPLEVEL/scripts" "$TOPLEVEL/src" \ -name "*.sh" \ -not -path "$TOPLEVEL/src/ext/*" \ - -not -path "$TOPLEVEL/src/rust/registry/*" \ -exec shellcheck {} + # Check scripts that aren't named *.sh diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index 857ce6f6f1..8ecbf414cf 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -7,13 +7,13 @@ my $found = 0; my $COLON_POS = 10; sub msg { - $found = 1; - my $v = shift; - $v =~ /^\s*([^:]+):(.*)$/; - chomp(my $errtype = $1); - my $rest = $2; - my $padding = ' ' x ($COLON_POS - length $errtype); - print "$padding$errtype:$rest\n"; + $found = 1; + my $v = shift; + $v =~ /^\s*([^:]+):(.*)$/; + chomp(my $errtype = $1); + my $rest = $2; + my $padding = ' ' x ($COLON_POS - length $errtype); + print "$padding$errtype:$rest\n"; } my $C = 0; diff --git a/scripts/maint/check_config_macros.pl b/scripts/maint/check_config_macros.pl index bcde2beccc..1398b9984a 100755 --- a/scripts/maint/check_config_macros.pl +++ b/scripts/maint/check_config_macros.pl @@ -7,7 +7,7 @@ my @macros = (); open(F, 'orconfig.h.in'); while(<F>) { if (/^#undef +([A-Za-z0-9_]*)/) { - push @macros, $1; + push @macros, $1; } } close F; @@ -15,6 +15,6 @@ close F; for my $m (@macros) { my $s = `git grep '$m' src`; if ($s eq '') { - print "Unused: $m\n"; + print "Unused: $m\n"; } } diff --git a/scripts/maint/findMergedChanges.pl b/scripts/maint/findMergedChanges.pl index 9b3496403d..427f2b111d 100755 --- a/scripts/maint/findMergedChanges.pl +++ b/scripts/maint/findMergedChanges.pl @@ -9,7 +9,7 @@ sub nChanges { # requires perl 5.8. Avoids shell issues if we ever get a changes # file named by the parents of Little Johnny Tables. open F, "-|", "git", "log", "--no-merges", "--pretty=format:%H", $branches, "--", $fname - or die "$!"; + or die "$!"; my @changes = <F>; return scalar @changes } @@ -42,13 +42,13 @@ my $head = "origin/main"; while (@ARGV and $ARGV[0] =~ /^--/) { my $flag = shift @ARGV; if ($flag =~ /^--(weird|merged|unmerged|list)/) { - $look_for_type = $1; + $look_for_type = $1; } elsif ($flag =~ /^--branch=(\S+)/) { $target_branch = $1; } elsif ($flag =~ /^--head=(\S+)/) { $head = $1; } else { - die "Unrecognized flag $flag"; + die "Unrecognized flag $flag"; } } @@ -58,16 +58,16 @@ for my $changefile (@ARGV) { my $type; if ($n_merged != 0 and $n_postmerged == 0) { - $type = "merged"; + $type = "merged"; } elsif ($n_merged == 0 and $n_postmerged != 0) { - $type = "unmerged"; + $type = "unmerged"; } else { - $type = "weird"; + $type = "weird"; } if ($type eq $look_for_type) { - print "$changefile\n"; + print "$changefile\n"; } elsif ($look_for_type eq 'list') { - printf "% 8s: %s\n", $type, $changefile; + printf "% 8s: %s\n", $type, $changefile; } } diff --git a/scripts/maint/gen_ccls_file.sh b/scripts/maint/gen_ccls_file.sh index b1fa55c973..04e31d22a8 100755 --- a/scripts/maint/gen_ccls_file.sh +++ b/scripts/maint/gen_ccls_file.sh @@ -19,13 +19,13 @@ echo "clang" > "$CCLS_FILE" # Add these include so the ccls server can properly check new files that are # not in the compile_commands.json yet { - echo "-I." - echo "-I./src" - echo "-I./src/ext" - echo "-I./src/ext/trunnel" + echo "-I." + echo "-I./src" + echo "-I./src/ext" + echo "-I./src/ext/trunnel" } >> "$CCLS_FILE" # Add all defines (-D). for p in $PRIVATE_DEFS; do - echo "-D$p" >> "$CCLS_FILE" + echo "-D$p" >> "$CCLS_FILE" done diff --git a/scripts/maint/practracker/includes.py b/scripts/maint/practracker/includes.py index a5ee728824..46630d987f 100755 --- a/scripts/maint/practracker/includes.py +++ b/scripts/maint/practracker/includes.py @@ -40,11 +40,13 @@ def warn(msg): print(msg, file=sys.stderr) def fname_is_c(fname): - """ Return true iff 'fname' is the name of a file that we should - search for possibly disallowed #include directives. """ - if fname.endswith(".h") or fname.endswith(".c"): + """ + Return true if 'fname' is the name of a file that we should + search for possibly disallowed #include directives. + """ + if fname.endswith((".c", ".h")): bname = os.path.basename(fname) - return not (bname.startswith(".") or bname.startswith("#")) + return not bname.startswith((".", "#")) else: return False diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh index e29b9106de..bb734ad9cd 100755 --- a/scripts/maint/practracker/test_practracker.sh +++ b/scripts/maint/practracker/test_practracker.sh @@ -1,15 +1,15 @@ #!/bin/sh -# Fail if any subprocess fails unexpectedly +# Fail this script if any subprocess fails unexpectedly. set -e umask 077 unset TOR_DISABLE_PRACTRACKER TMPDIR="" -clean () { +clean() { if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + rm -rf "$TMPDIR" fi } trap clean EXIT HUP INT TERM @@ -27,7 +27,7 @@ PRACTRACKER_DIR="scripts/maint/practracker" TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)" if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then echo >&2 "mktemp failed." - exit 1; + exit 1 fi DATA="${PRACTRACKER_DIR}/testdata" @@ -43,6 +43,7 @@ run_practracker() { --terse \ "${DATA}/" "$@" || echo "practracker exit status: $?" } + compare() { # we can't use cmp because we need to use -b for windows diff -b -u "$@" > "${TMPDIR}/test-diff" || true diff --git a/scripts/maint/practracker/util.py b/scripts/maint/practracker/util.py index c52ca2fbbf..6ab10a8de7 100644 --- a/scripts/maint/practracker/util.py +++ b/scripts/maint/practracker/util.py @@ -7,8 +7,7 @@ import os # We don't want to run metrics for unittests, automatically-generated C files, # external libraries or git leftovers. -EXCLUDE_SOURCE_DIRS = {"src/test/", "src/trunnel/", "src/rust/", - "src/ext/" } +EXCLUDE_SOURCE_DIRS = {"src/test/", "src/trunnel/", "src/ext/" } EXCLUDE_FILES = {"orconfig.h"} diff --git a/scripts/maint/run_calltool.sh b/scripts/maint/run_calltool.sh index b0268322f4..025a49cd03 100755 --- a/scripts/maint/run_calltool.sh +++ b/scripts/maint/run_calltool.sh @@ -5,8 +5,8 @@ set -e if test "x$CALLTOOL_PATH" != "x"; then - PYTHONPATH="${CALLTOOL_PATH}:${PYTHONPATH}" - export PYTHONPATH + PYTHONPATH="${CALLTOOL_PATH}:${PYTHONPATH}" + export PYTHONPATH fi mkdir -p callgraph @@ -14,8 +14,8 @@ mkdir -p callgraph SUBITEMS="fn_graph fn_invgraph fn_scc fn_scc_weaklinks module_graph module_invgraph module_scc module_scc_weaklinks" for calculation in $SUBITEMS; do - echo "======== $calculation" - python -m calltool "$calculation" > callgraph/"$calculation" + echo "======== $calculation" + python -m calltool "$calculation" > callgraph/"$calculation" done cat <<EOF > callgraph/README diff --git a/scripts/maint/updateRustDependencies.sh b/scripts/maint/updateRustDependencies.sh deleted file mode 100755 index 6d0587351f..0000000000 --- a/scripts/maint/updateRustDependencies.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2018 The Tor Project, Inc. -# Copyright (c) 2018 isis agora lovecruft -# See LICENSE for license information -# -# updateRustDependencies.sh -# ------------------------- -# Update our vendored Rust dependencies, either adding/removing -# dependencies and/or upgrading current dependencies to newer -# versions. -# -# To use this script, first add your dependencies, exactly specifying -# their versions, into the appropriate *crate-level* Cargo.toml in -# src/rust/ (i.e. *not* /src/rust/Cargo.toml, but instead the one for -# your crate). -# -# Next, run this script. Then, go into src/ext/rust and commit the -# changes to the tor-rust-dependencies repo. - -set -e - -HERE=$(dirname "$(realpath "$0")") -TOPLEVEL=$(dirname "$(dirname "$HERE")") -TOML="$TOPLEVEL/src/rust/Cargo.toml" -VENDORED="$TOPLEVEL/src/ext/rust/crates" -CARGO=$(command -v cargo) - -if ! test -f "$TOML" ; then - printf "Error: Couldn't find workspace Cargo.toml in expected location: %s\\n" "$TOML" -fi - -if ! test -d "$VENDORED" ; then - printf "Error: Couldn't find directory for Rust dependencies! Expected location: %s\\n" "$VENDORED" -fi - -if test -z "$CARGO" ; then - printf "Error: cargo must be installed and in your \$PATH\\n" -fi - -if test -z "$(cargo --list | grep vendor)" ; then - printf "Error: cargo-vendor not installed\\n" -fi - -$CARGO vendor -v --locked --explicit-version --no-delete --sync "$TOML" "$VENDORED" |