comparison tests/test-patchbomb.t @ 43019:2cc453284d5c

patchbomb: protect email addresses from shell When patchbomb sends email via a sendmail-like program it invokes this using procutil.popen which passes the string to a shell to be parsed. To protect any special characters in the email addresses on the command line from being interpretered by the shell they must be quoted.
author Floris Bruynooghe <flub@google.com>
date Mon, 30 Sep 2019 00:01:58 +0200
parents 55fcdb73c88b
children 7d4f2e4899c5
comparison
equal deleted inserted replaced
43018:d1d919f679f7 43019:2cc453284d5c
3033 +d 3033 +d
3034 3034
3035 sending [PATCH] test ... 3035 sending [PATCH] test ...
3036 sending mail: $TESTTMP/t2/pretendmail.sh -f test foo 3036 sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
3037 3037
3038 Shell characters in addresses
3039
3040 $ hg email --date '1980-1-1 0:1' -v -t '~foo/bar@example.com' -f 'me*@example.com' -r '10'
3041 this patch series consists of 1 patches.
3042
3043 warning: invalid patchbomb.intro value "mpmwearaclownnose"
3044 (should be one of always, never, auto)
3045 -f me*@example.com ~foo/bar@example.com
3046 MIME-Version: 1.0
3047 Content-Type: text/plain; charset="us-ascii"
3048 Content-Transfer-Encoding: 7bit
3049 Subject: [PATCH] dd
3050 X-Mercurial-Node: 3b6f1ec9dde933a40a115a7990f8b320477231af
3051 X-Mercurial-Series-Index: 1
3052 X-Mercurial-Series-Total: 1
3053 Message-Id: <3b6f1ec9dde933a40a11.315532860@test-hostname>
3054 X-Mercurial-Series-Id: <3b6f1ec9dde933a40a11.315532860@test-hostname>
3055 User-Agent: Mercurial-patchbomb/* (glob)
3056 Date: Tue, 01 Jan 1980 00:01:00 +0000
3057 From: me*@example.com
3058 To: ~foo/bar@example.com
3059
3060 # HG changeset patch
3061 # User test
3062 # Date 5 0
3063 # Thu Jan 01 00:00:05 1970 +0000
3064 # Branch test
3065 # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af
3066 # Parent 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
3067 dd
3068
3069 diff -r 2f9fa9b998c5 -r 3b6f1ec9dde9 d
3070 --- a/d Thu Jan 01 00:00:04 1970 +0000
3071 +++ b/d Thu Jan 01 00:00:05 1970 +0000
3072 @@ -1,1 +1,2 @@
3073 d
3074 +d
3075
3076 sending [PATCH] dd ...
3077 sending mail: $TESTTMP/t2/pretendmail.sh -f 'me*@example.com' '~foo/bar@example.com'
3078
3038 Test pull url header 3079 Test pull url header
3039 ================================= 3080 =================================
3040 3081
3041 basic version 3082 basic version
3042 3083