From owner-freebsd-bugs@FreeBSD.ORG Sat Feb 9 14:00:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8FC2D5FF for ; Sat, 9 Feb 2013 14:00:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 742A1B36; Sat, 9 Feb 2013 14:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r19E00NS064451; Sat, 9 Feb 2013 14:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r19E007D064450; Sat, 9 Feb 2013 14:00:00 GMT (envelope-from gnats) Resent-Date: Sat, 9 Feb 2013 14:00:00 GMT Resent-Message-Id: <201302091400.r19E007D064450@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Cc: Eitan Adler Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Christoph Mallon Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CDF38469 for ; Sat, 9 Feb 2013 13:50:30 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by mx1.freebsd.org (Postfix) with ESMTP id 644FEAE2 for ; Sat, 9 Feb 2013 13:50:30 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.24]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0MP3Jh-1TyNfO1ixb-006PVG for ; Sat, 09 Feb 2013 14:50:29 +0100 Received: (qmail invoked by alias); 09 Feb 2013 13:50:29 -0000 Received: from p5B132F8B.dip.t-dialin.net (EHLO rotluchs.lokal) [91.19.47.139] by mail.gmx.net (mp024) with SMTP; 09 Feb 2013 14:50:29 +0100 Received: from tron by rotluchs.lokal with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1U4Ap1-0005mJ-Ea; Sat, 09 Feb 2013 14:50:27 +0100 Message-Id: Date: Sat, 09 Feb 2013 14:50:27 +0100 From: Christoph Mallon To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 X-GNATS-Notify: Eitan Adler Subject: gnu/175985: [PATCH] Improve send-pr Cc: Eitan Adler X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Christoph Mallon List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 14:00:00 -0000 >Number: 175985 >Category: gnu >Synopsis: [PATCH] Improve send-pr >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sat Feb 09 14:00:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Christoph Mallon >Release: >Organization: >Environment: >Description: - Do not delete lines starting with Subject:. They are most probably part of a attached git patch. - Recognize an empty file as a not filled out PR, too. - Allow attaching files via -- followed by file names. >How-To-Repeat: >Fix: Please apply the patches. --- 0001-send-pr-Do-not-delete-lines-starting-with-Subject.patch begins here --- >From 5184b240a473c99e960e3bf91137c6cbe9b87916 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 7 Feb 2013 15:27:37 +0100 Subject: [PATCH 1/3] send-pr: Do not delete lines starting with Subject:. They are most probably part of a attached git patch. --- gnu/usr.bin/send-pr/send-pr.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/gnu/usr.bin/send-pr/send-pr.sh b/gnu/usr.bin/send-pr/send-pr.sh index dee0f48..cafab61 100644 --- a/gnu/usr.bin/send-pr/send-pr.sh +++ b/gnu/usr.bin/send-pr/send-pr.sh @@ -528,19 +528,6 @@ while true; do done # -# Remove the subject field if one is already there. There's no reason -# for it to be any different than the synopsis. -# -if grep '^Subject:' $TEMP > /dev/null -then - ed -s $TEMP << __EOF__ -/^Subject:/d -w -q -__EOF__ -fi - -# # Add the subject field with the value of $SYNOPSIS. We use the To: # field as an anchor, which had better be there. # -- 1.8.1.3 --- 0001-send-pr-Do-not-delete-lines-starting-with-Subject.patch ends here --- --- 0002-send-pr-Recognize-an-empty-file-as-a-not-filled-out-.patch begins here --- >From 1aef69d088167180c2c9e7c7abc55d256afc59db Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 7 Feb 2013 15:31:48 +0100 Subject: [PATCH 2/3] send-pr: Recognize an empty file as a not filled out PR, too. --- gnu/usr.bin/send-pr/send-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/usr.bin/send-pr/send-pr.sh b/gnu/usr.bin/send-pr/send-pr.sh index cafab61..c009a18 100644 --- a/gnu/usr.bin/send-pr/send-pr.sh +++ b/gnu/usr.bin/send-pr/send-pr.sh @@ -393,7 +393,7 @@ __EOF__ chmod u+w $TEMP eval $EDIT $TEMP - if cmp -s $REF $TEMP ; then + if [ ! -s "$TEMP" ] || cmp -s $REF $TEMP ; then echo "$COMMAND: problem report not filled out, therefore not sent" xs=1; exit fi -- 1.8.1.3 --- 0002-send-pr-Recognize-an-empty-file-as-a-not-filled-out-.patch ends here --- --- 0003-send-pr-Allow-attaching-files-via-followed-by-file-n.patch begins here --- >From fe33d1d033e98bf627d49a111a711ee3c2334872 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 6 Feb 2013 15:16:23 +0100 Subject: [PATCH 3/3] send-pr: Allow attaching files via -- followed by file names. --- gnu/usr.bin/send-pr/send-pr.1 | 6 ++++++ gnu/usr.bin/send-pr/send-pr.sh | 42 +++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/gnu/usr.bin/send-pr/send-pr.1 b/gnu/usr.bin/send-pr/send-pr.1 index 49fd42b..4953a50 100644 --- a/gnu/usr.bin/send-pr/send-pr.1 +++ b/gnu/usr.bin/send-pr/send-pr.1 @@ -67,6 +67,12 @@ send-pr \- send problem report (PR) to a central support site .B \-a .I file ] +[ +-- +[ +.I file... +] +] .SH DESCRIPTION .B send-pr is a tool used to submit diff --git a/gnu/usr.bin/send-pr/send-pr.sh b/gnu/usr.bin/send-pr/send-pr.sh index c009a18..07950a7 100644 --- a/gnu/usr.bin/send-pr/send-pr.sh +++ b/gnu/usr.bin/send-pr/send-pr.sh @@ -144,6 +144,24 @@ BATCH= CC= SEVERITY_C= +attach() +{ + if [ -e "$1" -a ! -d "$1" ]; then + PRETTY_NAME=${1##*/} + if file -b "$1" | grep -q "text" 2>/dev/null ; then + ATTACHED_FILES="$ATTACHED_FILES +--- $PRETTY_NAME begins here --- +$(cat "$1") +--- $PRETTY_NAME ends here --- +" + else + ATTACHED_FILES="$ATTACHED_FILES +$(uuencode "$PRETTY_NAME" < "$1") +" + fi + fi +} + while [ $# -gt 0 ]; do case "$1" in -r) ;; # Ignore for backward compat. @@ -173,22 +191,16 @@ while [ $# -gt 0 ]; do -a | --attach) if [ -z "$2" ]; then echo "$USAGE" ; exit 1; fi - if [ -e "$2" -a ! -d "$2" ]; then - PRETTY_NAME=`basename $2` - if file $2 | grep "text" >/dev/null 2>/dev/null ; then - ATTACHED_FILES="$ATTACHED_FILES ---- $PRETTY_NAME begins here --- -`cat \"$2\"` ---- $PRETTY_NAME ends here --- -" - else - ATTACHED_FILES="$ATTACHED_FILES -`uuencode \"$PRETTY_NAME\" < \"$2\"` -" - fi - shift; - fi; + attach "$2" + shift ;; + --) + shift + while [ "$#" != 0 ]; do + attach "$1" + shift + done + break;; -*) echo "$USAGE" ; exit 1 ;; *) if [ -z "$USER_GNATS_SITE" ]; then if [ ! -r "$DATADIR/gnats/$1" ]; then -- 1.8.1.3 --- 0003-send-pr-Allow-attaching-files-via-followed-by-file-n.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: