[Bug 6911] New: notify.py can not send email by sendmail on Solaris

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Sep 10 11:45:35 UTC 2024


https://bz.mercurial-scm.org/show_bug.cgi?id=6911

            Bug ID: 6911
           Summary: notify.py can not send email by sendmail on Solaris
           Product: Mercurial
           Version: 6.8
          Hardware: PC
                OS: Other
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: vlmarek13 at gmail.com
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

Hi,

the steps to reproduce are:

hg init hg

cat > hg/.hg/hgrc <<EOT
> [extensions]
> hgext.notify =
> 
> [hooks]
> changegroup.notify = python:hgext.notify.hook
> 
> [notify]
> sources = serve push pull bundle
> config =
> maxdiff=0
> diffstat = False
> test = False
> template = Subject: {webroot|basename}: {desc|strip|firstline}\n\n\nchangeset: {rev}:{node|short}\nuser:      {author}\ndate:      {date|date}\ndescription:\n{desc}\n
> 
> [email]
> from = noreply at oracle.com
> 
> [usersubs]
> # key is subscriber email, value is comma-separated list of glob patterns
> some_email_address at oracle.com = *
> 
> [smtp]
> host = localhost 
> 
> EOT

hg clone hg clone
cd clone
seq 1 100 > a
hg add a
hg ci -m test a


hg push
pushing to /var/tmp/hg
searching for changes
Are you sure you wish to push? [y/N]: y
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
notify: sending 1 subscribers 1 changes
error: changegroup.notify hook failed: (421, b'4.5.0 Bare linefeed (LF) not
allowed')
(run with --traceback for stack trace)


As a fix we are using

--- mercurial-6.8/hgext/notify.py
+++ mercurial-6.8/hgext/notify.py
@@ -524,7 +524,7 @@ class notifier:
                 )
         msg['To'] = ', '.join(sorted(subs))

-        msgtext = msg.as_bytes()
+        msgtext = msg.as_bytes(policy=msg.policy.clone(linesep='\r\n'))
         if self.test:
             self.ui.write(msgtext)
             if not msgtext.endswith(b'\n'):


I'm not the author of the fix, I merely integrate it to Solaris and try to
offer back to you.

I did look into SMTP RFC and my understanding of it is that it really should
separate the lines by <CR><LF> instead of just <LF>

https://www.rfc-editor.org/rfc/rfc5321#section-2.3.8


Thank you for Mercurial

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list