From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx1.pokylinux.org (Postfix) with ESMTP id D3DC94C8118C for ; Wed, 26 Jan 2011 18:04:19 -0600 (CST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 26 Jan 2011 16:04:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.60,382,1291622400"; d="scan'208";a="881339423" Received: from unknown (HELO [10.255.14.102]) ([10.255.14.102]) by fmsmga001.fm.intel.com with ESMTP; 26 Jan 2011 16:04:19 -0800 Message-ID: <4D40B682.3080901@intel.com> Date: Wed, 26 Jan 2011 16:04:18 -0800 From: Saul Wold User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 To: Darren Hart References: <4e23e8f9d0e22cf534c19224cba0be9bedba0120.1296064228.git.dvhart@linux.intel.com> In-Reply-To: <4e23e8f9d0e22cf534c19224cba0be9bedba0120.1296064228.git.dvhart@linux.intel.com> Cc: poky@yoctoproject.org Subject: Re: [PATCH] send-pull-request: ensure a proper FROM header is included X-BeenThere: poky@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Poky build system developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 00:04:20 -0000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 01/26/2011 09:52 AM, Darren Hart wrote: > From: Darren Hart > > Pull URL: git://git.pokylinux.org/poky-contrib.git > Branch: dvhart/git-pull > Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/git-pull > > Thanks, > Darren Hart > > Commit 94629f2521711055b412f954af19e48b9bda6e50 removes the FROM header when > sending via sendmail to avoid sending mail as the original change committer (as > opposed to the local user). This resulted in mail going out without any FROM > header, which some mailing lists correct by adding the *bounce address as the > FROM. > > Correct this by reading FROM from the environment, from a new -f argument, or > from the git user.name and user.email config settings, in that order of > preference. Also display the FROM that will be used prior to the send > confirmation. > > This has no effect if the -g (send via git) argument is specified, other than > printing the git sendemail.from config setting. > > Signed-off-by: Darren Hart > Reported-by: Saul Wold > --- > scripts/send-pull-request | 29 ++++++++++++++++++++++++++--- > 1 files changed, 26 insertions(+), 3 deletions(-) > > diff --git a/scripts/send-pull-request b/scripts/send-pull-request > index c08b3be..7f51a1b 100755 > --- a/scripts/send-pull-request > +++ b/scripts/send-pull-request > @@ -9,6 +9,7 @@ fi > # Prevent environment leakage to these vars. > unset TO > unset CC > +# allow the user to set FROM in the environment > > usage() > { > @@ -17,6 +18,9 @@ Usage: $(basename $0) [-h] [-a] [[-t email]...] -p pull-dir > -t email Explicitly add email to the recipients > -a Automatically harvest recipients from "*-by: email" lines > in the patches in the pull-dir > + -f Specify a FROM address, you can also use the FROM environment > + variable. If you do not specify one, it will try to use the one > + from your git config. This is ignored if -g is used. > -g Use git-send-email to send mail instead of sendmail > -p pull-dir Directory containing summary and patch files > EOM > @@ -45,11 +49,14 @@ harvest_recipients() > > > # Parse and verify arguments > -while getopts "aghp:t:" OPT; do > +while getopts "af:ghp:t:" OPT; do > case $OPT in > a) > AUTO=1 > ;; > + f) > + FROM="$OPTARG" > + ;; > g) > PULL_MTA="git" > ;; > @@ -108,13 +115,29 @@ if [ -z "$TO" ]&& [ -z "$CC" ]; then > exit 1 > fi > > +case "$PULL_MTA" in > + git) > + FROM="$(git config sendemail.from)" > + ;; > + sendmail) > + if [ -z "$FROM" ]; then > + FROM="$(git config user.name)<$(git config user.email)>" > + if [ -z "$FROM" ]; then > + echo "ERROR: unable to determine a FROM address" > + usage > + exit 1 > + fi > + fi > + ;; > +esac > > # Generate report for the user and require confirmation before sending > cat< The following patches: > $(for PATCH in $PDIR/*.patch; do echo " $PATCH"; done) > > -will be sent to the following recipients: > +will be sent with the following headers: > + From: $FROM > To: $TO > CC: $CC > > @@ -155,7 +178,7 @@ if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then > # original date as "Old-Date". > DATE=$(date +"%a, %d %b %Y %k:%M:%S %z") > GIT_FROM=$(cat $PATCH | formail -X "From:") > - cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From:" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t > + cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From: $FROM" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t > if [ $? -eq 1 ]; then > ERROR=1 > fi Pushed into master Thanks for the quick fix Sau!