Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wgetpaste for openSUSE:Factory checked in at 2022-12-03 10:04:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wgetpaste (Old) and /work/SRC/openSUSE:Factory/.wgetpaste.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wgetpaste" Sat Dec 3 10:04:01 2022 rev:10 rq:1039749 version:2.33 Changes: -------- --- /work/SRC/openSUSE:Factory/wgetpaste/wgetpaste.changes 2021-10-18 22:02:55.890125662 +0200 +++ /work/SRC/openSUSE:Factory/.wgetpaste.new.1835/wgetpaste.changes 2022-12-03 10:04:15.459447385 +0100 @@ -1,0 +2,8 @@ +Fri Dec 2 22:05:40 UTC 2022 - Dirk Müller <[email protected]> + +- update to 2.33: + * -N/--no-ansi was added to strip ANSI codes using ansifilter (fixes #34) + * bpaste is now the default to avoid issues with dpaste and DNSSEC and less + JavaScript (fixes #36) + +------------------------------------------------------------------- Old: ---- wgetpaste-2.32.tar.xz wgetpaste-2.32.tar.xz.sig New: ---- wgetpaste-2.33.tar.xz wgetpaste-2.33.tar.xz.sig wgetpaste.keyring ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wgetpaste.spec ++++++ --- /var/tmp/diff_new_pack.RHnxzH/_old 2022-12-03 10:04:15.855449585 +0100 +++ /var/tmp/diff_new_pack.RHnxzH/_new 2022-12-03 10:04:15.863449630 +0100 @@ -1,7 +1,7 @@ # # spec file for package wgetpaste # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: wgetpaste -Version: 2.32 +Version: 2.33 Release: 0 Summary: Command-line interface to various pastebins License: MIT @@ -26,6 +26,7 @@ Source0: https://github.com/zlin/wgetpaste/releases/download/%{version}/wgetpaste-%{version}.tar.xz Source1: https://github.com/zlin/wgetpaste/releases/download/%{version}/wgetpaste-%{version}.tar.xz.sig Source2: services.conf +Source3: wgetpaste.keyring Requires: bash Requires: coreutils Requires: wget ++++++ wgetpaste-2.32.tar.xz -> wgetpaste-2.33.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/.github/workflows/run_test.yml new/wgetpaste-2.33/.github/workflows/run_test.yml --- old/wgetpaste-2.32/.github/workflows/run_test.yml 2021-06-02 14:25:23.000000000 +0200 +++ new/wgetpaste-2.33/.github/workflows/run_test.yml 2022-11-21 22:19:47.000000000 +0100 @@ -8,3 +8,15 @@ - uses: actions/checkout@v2 - run: test/test.sh shell: bash + run-test-ansi: + name: 'Run test/test_ansi.sh' + # 22.04 is the earliest version that has ansifilter in the repos + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + - name: 'Install ansifilter' + run: | + sudo apt-get update + sudo apt-get install ansifilter + - run: test/test_ansi.sh + shell: bash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/test/red.txt new/wgetpaste-2.33/test/red.txt --- old/wgetpaste-2.32/test/red.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/wgetpaste-2.33/test/red.txt 2022-11-21 22:19:47.000000000 +0100 @@ -0,0 +1 @@ +[31mred text[m diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/test/red_no_ansi.txt new/wgetpaste-2.33/test/red_no_ansi.txt --- old/wgetpaste-2.32/test/red_no_ansi.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/wgetpaste-2.33/test/red_no_ansi.txt 2022-11-21 22:19:47.000000000 +0100 @@ -0,0 +1 @@ +red text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/test/test_ansi.sh new/wgetpaste-2.33/test/test_ansi.sh --- old/wgetpaste-2.32/test/test_ansi.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/wgetpaste-2.33/test/test_ansi.sh 2022-11-21 22:19:47.000000000 +0100 @@ -0,0 +1,186 @@ +#! /bin/bash + +# wgetpaste test script (stripping ANSI codes) +# Based on test/test.sh +# Exit code: number of mismatched downloads or 1 for general failure +# Copyright (C) 2022 Oskari Pirhonen <[email protected]> + +# Don't assume the test is being run from the same directory as the script +TEST_DIR="$(dirname "$0")" +ANSI_FILE="$TEST_DIR/red.txt" +NOANSI_FILE="$TEST_DIR/red_no_ansi.txt" +DL_DIR="$(mktemp -q -d /tmp/wgetpaste_test_ansi.XXXXX)" +# Services to hard skip +# Pre-declare as map to maintain type even if empty +# key -> value := service -> reason +declare -A HARD_SKIPS +HARD_SKIPS=(['codepad']='always times out') +# Services expected to require an authorization token +AUTH_SKIPS=('gists' 'snippets') +# Used to save the first working service +WORKING= +FAILED_PASTE=0 +DL_MISMATCH=0 + +# Test that temp directory was created +if [ ! -d "$DL_DIR" ]; then + echo "Failed to create temporary download directory: $DL_DIR" + exit 1 +fi +echo "Using download directory: $DL_DIR" + +# Post test file into each service until one succeeds +for serv in $("$TEST_DIR"/../wgetpaste -S --completions); do + # Hard skips + for hs in "${!HARD_SKIPS[@]}"; do + if [ "$serv" == "$hs" ]; then + echo "HARD SKIP on $serv -- reason: ${HARD_SKIPS[$serv]}" + continue 2 + fi + done + + # Log errors to analyze the reason + # Use verbose output to get more meaningful errors + # Log deleted at the end of each loop unless error other than 401 + echo -n "Posting to $serv: " + ERROR_LOG="$DL_DIR/$serv-error.log" + URL="$("$TEST_DIR"/../wgetpaste -r -s "$serv" -v "$ANSI_FILE" 2>"$ERROR_LOG")" + STATUS="$?" + + # Skip failed posts (eg, not authorized for GitHub/GitLab, service error) + if [ "$STATUS" -ne 0 ]; then + if (grep -iq "HTTP.*401.*Unauthorized" "$ERROR_LOG"); then + # Check if a 401 is expected behavior. If it isn't, mark as fail + for as in "${AUTH_SKIPS[@]}"; do + if [ "$serv" == "$as" ]; then + echo "SKIPPING, needs authorization..." + rm "$ERROR_LOG" + continue 2 + fi + done + echo "UNEXPECTED 401, skipping..." + else + echo "SKIPPING, failed to post..." + fi + + continue + fi + echo "SUCCESS!" + + echo -n "Downloading from $serv: " + if ! (wget -q "$URL" -O "/dev/null" 2>>"$ERROR_LOG"); then + echo "FAILED, skipping..." + continue + fi + echo "SUCCESS!" + rm "$ERROR_LOG" + + # This is the service we want to use + echo "Using service $serv" + WORKING="$serv" + break +done + +# Test if we have a working service +if [ -z "$WORKING" ]; then + echo "No working service found!" + for log in "$DL_DIR"/*.log; do + echo "$(basename "$log"):" + cat "$log" + done + rm -rf "$DL_DIR" + exit 1 +fi + +# Paste stuff. Use a short timeout between requests (we're friendly after all!) +sleep 1 +echo -n "Pasting command output (cat): " +ERROR_LOG="$DL_DIR/command-error.log" +URL="$("$TEST_DIR"/../wgetpaste -N -r -s "$WORKING" -v -c "cat $ANSI_FILE" 2>"$ERROR_LOG")" +if [ $? -ne 0 ]; then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) +else + echo "SUCCESS!" + + echo -n "Downloading: " + if ! (wget -q "$URL" -O "$DL_DIR/command.txt" 2>>"$ERROR_LOG"); then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) + else + echo "SUCCESS" + rm "$ERROR_LOG" + + echo "Removing 'command run' header" + sed -i -e '1d' "$DL_DIR/command.txt" + fi +fi + +sleep 1 +echo -n "Pasting stdin (cat | wgetpaste): " +ERROR_LOG="$DL_DIR/stdin-error.log" +URL="$(cat "$ANSI_FILE" | "$TEST_DIR"/../wgetpaste -N -r -s "$WORKING" -v 2>"$ERROR_LOG")" +if [ $? -ne 0 ]; then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) +else + echo "SUCCESS!" + + echo -n "Downloading: " + if ! (wget -q "$URL" -O "$DL_DIR/stdin.txt" 2>>"$ERROR_LOG"); then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) + else + echo "SUCCESS!" + rm "$ERROR_LOG" + fi +fi + +sleep 1 +echo -n "Pasting a file: " +ERROR_LOG="$DL_DIR/file-error.log" +URL="$("$TEST_DIR"/../wgetpaste -N -r -s "$WORKING" -v "$ANSI_FILE" 2>"$ERROR_LOG")" +if [ $? -ne 0 ]; then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) +else + echo "SUCCESS!" + + echo -n "Downloading: " + if ! (wget -q "$URL" -O "$DL_DIR/file.txt" 2>>"$ERROR_LOG"); then + echo "FAILED!" + FAILED_PASTE=$((FAILED_PASTE + 1)) + else + echo "SUCCESS!" + rm "$ERROR_LOG" + fi +fi + +# Compare downloaded files +for dl_file in "$DL_DIR"/*.txt; do + echo -n "Testing file $dl_file: " + # Ignore missing trailing newline and extra empty lines in downloaded file + if (diff -q -Z -B "$NOANSI_FILE" "$dl_file" &>/dev/null); then + echo "SUCCESS!" + else + echo "FAILED!" + DL_MISMATCH=$((DL_MISMATCH + 1)) + fi +done + +echo "Total failed pastes: $FAILED_PASTE" +echo "Total mismatches: $DL_MISMATCH" + +# Print failure logs +if [ $FAILED_PASTE -ne 0 ]; then + for log in "$DL_DIR"/*.log; do + echo "$(basename "$log"):" + cat "$log" + done +# Delete download directory if all tests succeeded +elif [ $DL_MISMATCH -eq 0 ]; then + echo "Deleting download directory" + rm -rf "$DL_DIR" +fi + +exit "$DL_MISMATCH" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/wgetpaste new/wgetpaste-2.33/wgetpaste --- old/wgetpaste-2.32/wgetpaste 2021-06-02 14:25:23.000000000 +0200 +++ new/wgetpaste-2.33/wgetpaste 2022-11-21 22:19:47.000000000 +0100 @@ -3,7 +3,7 @@ # relying only on bash, sed, coreutils (mktemp/sort/tr/wc/whoami/tee) and wget # Copyright (c) 2007-2016 Bo Ãrsted Andresen <[email protected]> -VERSION="2.32" +VERSION="2.33" # don't inherit LANGUAGE from the env unset LANGUAGE @@ -365,13 +365,27 @@ if [[ -n ${!regex} ]]; then RAWURL=$(sed -e "${!regex}" <<< "$URL") [[ -n $RAWURL ]] && return 0 - echo "Convertion to raw url failed." >&2 + echo "Conversion to raw url failed." >&2 else echo "Raw download of pastes is not supported by $(getrecipient)." >&2 fi return 1 } +# strip ANSI codes if NOANSI is set, otherwise pass the data through without +# transforming it +# +# accepts files as args for use with pasting the contents of said file +# (file checked at the call site) +NOANSI= +strip_ansi() { + if [[ $NOANSI ]]; then + "$(type -P ansifilter)" "$@" + else + cat "$@" + fi +} + ### verification verifyservice() { for s in $SERVICES; do @@ -524,6 +538,7 @@ -x, --xcut read input from clipboard (requires x11-misc/xclip) -X, --xpaste write resulting url to the X primary selection buffer (requires x11-misc/xclip) -C, --xclippaste write resulting url to the X clipboard selection buffer (requires x11-misc/xclip) + -N, --no-ansi strip ANSI codes such as colors before pasting (requires app-text/ansifilter) -r, --raw show url for the raw paste (no syntax highlighting or html) -t, --tee use tee to show what is being pasted @@ -774,6 +789,9 @@ requiredarg "$@" NICK=$(escape "$2") ;; + -N | --no-ansi ) + NOANSI=0 + ;; -r | --raw ) RAW=0 ;; @@ -818,6 +836,11 @@ shift $args done +# ensure ansifilter exists if requested +if [[ $NOANSI ]]; then + [[ -n "$(type -p ansifilter)" ]] || die "-N/--no-ansi requires app-text/ansifilter to be installed" +fi + ### defaults load_configs() { if [[ ! $IGNORECONFIGS ]]; then @@ -845,7 +868,7 @@ load_configs [[ $SERVICESET ]] && verifyservice "$SERVICESET" && SERVICE=$(escape "$SERVICESET") DEFAULT_NICK=${DEFAULT_NICK:-$(whoami)} || die "whoami failed" -DEFAULT_SERVICE=${DEFAULT_SERVICE:-dpaste} +DEFAULT_SERVICE=${DEFAULT_SERVICE:-bpaste} DEFAULT_LANGUAGE=${DEFAULT_LANGUAGE:-Plain Text} DEFAULT_EXPIRATION=${DEFAULT_EXPIRATION:-1 month} SERVICE=${SERVICE:-${DEFAULT_SERVICE}} @@ -934,31 +957,31 @@ command ) for c in "${COMMANDS[@]}"; do if [[ $TEE ]]; then - echo "$PS1 $c$N$(bash -c "$c" 2>&1)$N" | tee -a "$TMPF" + echo "$PS1 $c$N$(bash -c "$c" 2>&1 | strip_ansi)$N" | tee -a "$TMPF" else - INPUT="$INPUT$PS1 $c$N$(bash -c "$c" 2>&1)$N$N" + INPUT="$INPUT$PS1 $c$N$(bash -c "$c" 2>&1 | strip_ansi)$N$N" fi done ;; info ) if [[ $TEE ]]; then - echo "$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1)" | tee "$TMPF" + echo "$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1 | strip_ansi)" | tee "$TMPF" else - INPUT="$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1)" + INPUT="$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1 | strip_ansi)" fi ;; xcut ) if [[ $TEE ]]; then - x_cut | tee "$TMPF" + x_cut | strip_ansi | tee "$TMPF" else - INPUT="$(x_cut)" + INPUT="$(x_cut | strip_ansi)" fi ;; stdin ) if [[ $TEE ]]; then - tee "$TMPF" + strip_ansi | tee "$TMPF" else - INPUT="$(cat)" + INPUT="$(strip_ansi)" fi ;; files ) @@ -966,17 +989,17 @@ for f in "${FILES[@]}"; do [[ -r $f ]] || notreadable "$f" if [[ $TEE ]]; then - echo "$PS1 cat $f$N$(<"$f")$N" | tee -a "$TMPF" + echo "$PS1 cat $f$N$(strip_ansi "$f")$N" | tee -a "$TMPF" else - INPUT="$INPUT$PS1 cat $f$N$(<"$f")$N$N" + INPUT="$INPUT$PS1 cat $f$N$(strip_ansi "$f")$N$N" fi done else [[ -r $FILES ]] || notreadable "$FILES" if [[ $TEE ]]; then - tee "$TMPF" < "$FILES" + strip_ansi "$FILES" | tee "$TMPF" else - INPUT=$(<"$FILES") + INPUT=$(strip_ansi "$FILES") fi fi ;; @@ -992,9 +1015,9 @@ if [[ $INFO ]]; then DESCRIPTION="$DESCRIPTION $PS1 $INFO_COMMAND;" if [[ $TEE ]]; then - echo "$N$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1)" | tee -a "$TMPF" + echo "$N$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1 | strip_ansi)" | tee -a "$TMPF" else - INPUT="$INPUT$N$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1)" + INPUT="$INPUT$N$PS1 $INFO_COMMAND$N$($INFO_COMMAND $INFO_ARGS 2>&1 | strip_ansi)" fi fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wgetpaste-2.32/wgetpaste.spec new/wgetpaste-2.33/wgetpaste.spec --- old/wgetpaste-2.32/wgetpaste.spec 2021-06-02 14:25:23.000000000 +0200 +++ new/wgetpaste-2.33/wgetpaste.spec 2022-11-21 22:19:47.000000000 +0100 @@ -1,5 +1,5 @@ Name: wgetpaste -Version: 2.32 +Version: 2.33 Release: 1%{?dist} Summary: Command-line interface to various paste-bins
