Re: git-send-email: smtpserver in $HOME

3 messages, 3 authors, 2021-02-18 · open the first message on its own page

Re: git-send-email: smtpserver in $HOME

From: Junio C Hamano <hidden>
Date: 2021-02-16 18:54:40

Jan “Khardix” Staněk  [off-list ref] writes:
On 2021-02-15, Junio C Hamano wrote:
quoted
I haven't given too much thought, but offhand do not think of a
reason why a change like the attached would break things.
Seems reasonable, but I figured I rather ask beforehand.
quoted
 git-send-email.perl | 2 ++
 1 file changed, 2 insertions(+)
diff --git c/git-send-email.perl w/git-send-email.perl
index 1f425c0809..ff58ac5046 100755
--- c/git-send-email.perl
+++ w/git-send-email.perl
@@ -1006,6 +1006,8 @@ sub expand_one_alias {
 		}
 	}
 	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
+} elsif ($smtp_server =~ /^~/) {
+	$smtp_server = glob($smtp_server);
 }
This introduces a special case just for handling $smtp_server…
Yes, and that was very much deliberate, as I think

	git send-email --smtp-server=~/bin/my-phoney-sendmail

won't be affected by %config_path_settings.  $smtp_ssl_cert_path has
the same problem already, and I didn't want to make things worse (I
think %config_path_settings is a mistake---it is fine to have a list
of variables that can use ~tilde expansion, but I do not see why it
makes sense to allow the ~tilde expansion when the value came from
configureation files, and not from the command line).
My concern was that if there is a SMTP server actually named
i.e. `~someone.example.org`, this change would break that.
Can tilde appear in a valid DNS name?  I doubt it.

Re: git-send-email: smtpserver in $HOME

From: Jan “Khardix” Staněk <hidden>
Date: 2021-02-16 22:15:19

On 2021-02-16, Junio C Hamano wrote:
Jan “Khardix” Staněk  [off-list ref] writes:
quoted
This introduces a special case just for handling $smtp_server…
Yes, and that was very much deliberate, as I think

	git send-email --smtp-server=~/bin/my-phoney-sendmail

won't be affected by %config_path_settings.  $smtp_ssl_cert_path has
the same problem already, and I didn't want to make things worse (I
think %config_path_settings is a mistake---it is fine to have a list
of variables that can use ~tilde expansion, but I do not see why it
makes sense to allow the ~tilde expansion when the value came from
configureation files, and not from the command line).
Well, unless I'm missing something, shouldn't the tilde above be
expanded by the shell before actually being passed as argument?

$ echo simulate --smtp-server=~/bin/my-phoney-sendmail
simulate --smtp-server=/home/khardix/bin/my-phoney-sendmail

I assumed that only the config values are handled specially
because only they need that – the CLI is handled by shell in advance.
Never played with $smtp_ssl_cert_path though,
so if there are known problems, just ignore me
– or better, point me to the relevant issue/discussion,
if you can be bothered :) Thanks.
quoted
My concern was that if there is a SMTP server actually named
i.e. `~someone.example.org`, this change would break that.
Can tilde appear in a valid DNS name?  I doubt it.
So I actually did my homework and skimmed through the relevant RFCs
(RFC952 and RFC1123); as it turns out, no, it cannot
– only ASCII alphanumerics, '-' and '.' are valid characters.
--
Jan Staněk – Khardix

Re: git-send-email: smtpserver in $HOME

From: Chris Torek <hidden>
Date: 2021-02-18 12:24:52

Just a small point here:

On Tue, Feb 16, 2021 at 2:17 PM Jan “Khardix” Staněk [off-list ref] wrote:
Well, unless I'm missing something, shouldn't the tilde above be
expanded by the shell before actually being passed as argument?
Maybe.  Some shells do and some don't:

$ echo foo=~/foo
foo=~/foo

bash$ echo foo=~/foo
foo=/home/torek/foo

for instance.
So I actually did my homework and skimmed through the relevant RFCs
(RFC952 and RFC1123); as it turns out, no, it cannot
– only ASCII alphanumerics, '-' and '.' are valid characters.
Right: tilde and slash are both verboten. (Underscore is too, but
that one does get used and some programs allow it.)

Chris
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help