* clcommit.m4sh, config/mailnotify.m4sh: Updated from

cvs-utils--tla--1.0 to fix quoting of metachars in patch names.
This commit is contained in:
Gary V. Vaughan 2004-10-22 12:10:31 +00:00
parent 128f90e9ff
commit e7a9d306f6
3 changed files with 61 additions and 28 deletions

View File

@ -1,5 +1,8 @@
2004-10-22 Gary V. Vaughan <gary@gnu.org> 2004-10-22 Gary V. Vaughan <gary@gnu.org>
* clcommit.m4sh, config/mailnotify.m4sh: Updated from
cvs-utils--tla--1.0 to fix quoting of metachars in patch names.
* HACKING: Updated: `.in' files are now `.m4sh'; document some * HACKING: Updated: `.in' files are now `.m4sh'; document some
more coding standards for these files. more coding standards for these files.

View File

@ -2,7 +2,7 @@ m4_define([_m4_divert(SCRIPT)], 100)
m4_divert_push([SCRIPT])#!/bin/sh m4_divert_push([SCRIPT])#!/bin/sh
# @configure_input@ # @configure_input@
# clcommit (GNU @PACKAGE@) version 0.12 # clcommit (GNU @PACKAGE@) version 0.14
# Written by Gary V. Vaughan <gary@gnu.org> # Written by Gary V. Vaughan <gary@gnu.org>
# and Alexandre Oliva <aoliva@redhat.com> # and Alexandre Oliva <aoliva@redhat.com>
@ -76,7 +76,7 @@ m4_divert_push([SCRIPT])#!/bin/sh
: ${MAILNOTIFY="mailnotify"} : ${MAILNOTIFY="mailnotify"}
: ${MKSTAMP="mkstamp"} : ${MKSTAMP="mkstamp"}
test -f "config/$MAILNOTIFY" && MAILNOTIFY="config/MAILNOTIFY" test -f "config/$MAILNOTIFY" && MAILNOTIFY="config/$MAILNOTIFY"
test -f "config/$MKSTAMP" && MKSTAMP="config/$MKSTAMP" test -f "config/$MKSTAMP" && MKSTAMP="config/$MKSTAMP"
PROGRAM=clcommit PROGRAM=clcommit
@ -100,7 +100,7 @@ mailnotify_flags=
sendmail_to= sendmail_to=
exit_cmd=: exit_cmd=:
# Locations for important files # Locations for important files:
signature_file= signature_file=
log_file="${TMPDIR-/tmp}/$progname-$$" log_file="${TMPDIR-/tmp}/$progname-$$"
@ -134,7 +134,8 @@ set -e
-f|--force) opt_update=false; PAGER=cat ;; -f|--force) opt_update=false; PAGER=cat ;;
--from) test $# = 0 && func_missing_arg $opt && break --from) test $# = 0 && func_missing_arg $opt && break
mailnotify_flags="$mailnotify_flags --from '"$1"'" func_quote_for_eval "$1"
mailnotify_flags="$mailnotify_flags --from=$func_quote_for_eval_result"
shift shift
;; ;;
@ -185,7 +186,8 @@ set -e
-q|--quiet) cvs_flags="$cvs_flags -q" ;; -q|--quiet) cvs_flags="$cvs_flags -q" ;;
-s|--sendmail) test $# = 0 && func_missing_arg $opt && break -s|--sendmail) test $# = 0 && func_missing_arg $opt && break
sendmail_to="$1" func_quote_for_eval "$1"
sendmail_to="$func_quote_for_eval_result"
shift shift
;; ;;
@ -426,8 +428,10 @@ func_mailnotify ()
echo "$my_mail_body" > "$notify_file" echo "$my_mail_body" > "$notify_file"
func_verbose "mailing commit notification to \"$sendmail_to\"" func_verbose "mailing commit notification to \"$sendmail_to\""
eval func_verbose_eval $MAILNOTIFY $mailnotify_flags -s "'$my_mail_subject'" \ func_quote_for_eval "$my_mail_subject"
-m "text/plain" -f "$notify_file" -- "'$sendmail_to'" func_show_eval "$MAILNOTIFY $mailnotify_flags \
-s $func_quote_for_eval_result -m 'text/plain' -f '$notify_file' \
-- $sendmail_to"
} }

View File

@ -2,7 +2,7 @@ m4_define([_m4_divert(SCRIPT)], 100)
m4_divert_push([SCRIPT])#!/bin/sh m4_divert_push([SCRIPT])#!/bin/sh
# @configure_input@ # @configure_input@
# mailnotify (GNU @PACKAGE@) version 0.4 # mailnotify (GNU @PACKAGE@) version 0.6
# Written by Gary V. Vaughan <gary@gnu.org> # Written by Gary V. Vaughan <gary@gnu.org>
# Copyright (C) 2004 Free Software Foundation, Inc. # Copyright (C) 2004 Free Software Foundation, Inc.
@ -60,6 +60,7 @@ m4_divert_push([SCRIPT])#!/bin/sh
: ${TMPDIR=/tmp} : ${TMPDIR=/tmp}
: ${HOST=`hostname`} : ${HOST=`hostname`}
: ${SENDMAIL=sendmail}
PROGRAM=mailnotify PROGRAM=mailnotify
@ -92,12 +93,14 @@ sed_mail_address='s,^.*<\(.*\)>.*$,\1,'
;; ;;
-C|--carbon-copy) test $# -eq 0 && func_missing_arg "$opt" && break -C|--carbon-copy) test $# -eq 0 && func_missing_arg "$opt" && break
cc="$1" func_quote_for_eval "$1"
cc="$func_quote_for_eval_result"
shift shift
;; ;;
-F|--from) test $# -eq 0 && func_missing_arg "$opt" && break -F|--from) test $# -eq 0 && func_missing_arg "$opt" && break
from="$1" func_quote_for_eval "$1"
from="$func_quote_for_eval_result"
shift shift
;; ;;
@ -132,12 +135,14 @@ sed_mail_address='s,^.*<\(.*\)>.*$,\1,'
;; ;;
-o|--output-file) test $# -eq 0 && func_missing_arg "$opt" && break -o|--output-file) test $# -eq 0 && func_missing_arg "$opt" && break
outputfile="$1" func_quote_for_eval "$1"
outputfile="$func_quote_for_eval_result"
shift shift
;; ;;
-s|--subject) test $# -eq 0 && func_missing_arg "$opt" && break -s|--subject) test $# -eq 0 && func_missing_arg "$opt" && break
subject="$1" func_quote_for_eval "$1"
subject="$func_quote_for_eval_result"
shift shift
;; ;;
@ -205,10 +210,10 @@ func_headers ()
{ {
echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $progpath`" echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $progpath`"
echo "MIME-Version: 1.0" echo "MIME-Version: 1.0"
test -n "$from" && echo "From: $from" test -n "$from" && eval echo From: $from
echo "To: $my_destination" eval echo To: $my_destination
test -n "$cc" && echo "CC: $cc" test -n "$cc" && eval echo CC: $cc
test -n "$subject" && echo "Subject: $subject" test -n "$subject" && eval echo Subject: $subject
} > "$my_outfile" } > "$my_outfile"
} }
@ -282,16 +287,25 @@ func_sendmail ()
my_destination="$2" my_destination="$2"
my_from="$3" my_from="$3"
from_name=`echo "$my_from" | sed 's, *<.*> *$,,;s,",,g'` from_name=`eval echo "X$my_from" | $Xsed -e 's, *<.*> *$,,'`
from_addr=`echo "$my_from" | sed "$sed_mail_address"` from_addr=`eval echo "X$my_from" | $Xsed -e "$sed_mail_address"`
SENDMAIL=sendmail save_PATH="$PATH"
for try_sendmail in sendmail /usr/lib/sendmail /usr/sbin/sendmail; do PATH="/usr/lib:/usr/sbin:$PATH"
if which $try_sendmail >/dev/null 2>&1; then
SENDMAIL=$try_sendmail save_IFS="$IFS"
IFS=':'
for try_sendmail_dir in $PATH; do
IFS="$save_IFS"
PATH="$save_PATH"
if test -x "$try_sendmail_dir/$SENDMAIL"; then
SENDMAIL="$try_sendmail_dir/$SENDMAIL"
break break
fi fi
done done
IFS="$save_IFS"
PATH="$save_PATH"
test -x "$SENDMAIL" || func_fatal_error "sendmail executable not found"
func_verbose "Delivering mail, please wait..." func_verbose "Delivering mail, please wait..."
if test -n "$from_name"; then if test -n "$from_name"; then
@ -319,12 +333,18 @@ func_sendmail ()
fname="${TMPDIR}/$PROGRAM$RANDOM-$RANDOM.$$" fname="${TMPDIR}/$PROGRAM$RANDOM-$RANDOM.$$"
trap 'rm -f "$fname"; exit 1' 1 2 15 trap 'rm -f "$fname"; exit 1' 1 2 15
# Generate a comma separated list of destination addresses for the
# mail headers:
destination="" destination=""
for to; for to in : ${1+"$@"}
do do
test "X$to" = X: && continue
func_quote_for_eval "$to"
case $destination in case $destination in
"") destination="$to" ;; "") destination="$func_quote_for_eval_result" ;;
*) destination="$destination, $to" ;; *) destination="$destination, $func_quote_for_eval_result" ;;
esac esac
done done
@ -335,11 +355,17 @@ func_sendmail ()
func_single_content "$fname" func_single_content "$fname"
fi fi
# Generate a space delimited list of destination addresses for sendmail:
if test -z "$outputfile"; then if test -z "$outputfile"; then
destination="" destination=""
for to; do for to in : ${1+"$@"}
to_addr=`echo "$to" | sed "$sed_mail_address"` do
test -n "$to_addr" || to_addr="$to" test "X$to" = X: && continue
func_quote_for_eval "$to"
to_addr=`echo "$func_quote_for_eval_result" | sed "$sed_mail_address"`
test -n "$to_addr" || to_addr="$func_quote_for_eval_result"
destination="$destination $to_addr" destination="$destination $to_addr"
done done
func_sendmail "$fname" "$destination" "$from" func_sendmail "$fname" "$destination" "$from"