Re: [HACKERS] pgcommitfest reply having corrupted subject line

2016-02-07 Thread Noah Misch
On Sun, Feb 07, 2016 at 03:49:47PM +0100, Magnus Hagander wrote:
> On Fri, Feb 5, 2016 at 3:44 AM, Noah Misch  wrote:
> > On Thu, Feb 04, 2016 at 09:19:19AM +0100, Magnus Hagander wrote:

> > So it is.  The problem happens when email.mime.text.MIMEText wraps the
> > subject line; see attached test program.
> 
> Ouch. So that's basically a bug in the python standard libraries :( It
> looks a lot like this one, doesn't it? https://bugs.python.org/issue25257
> 
> > > Have you
> > > seen this with any other messages, that you can recall, or just this one?
> >
> > Just this one.  However, no other hackers subject line since 2015-01-01
> > contains a comma followed by something other than a space.
> 
> I wonder in that case if it's worth trying to do something about that in
> our code, or just leave it be.

In light of those facts, I would leave it.  Thanks for tracking down the
Python bug.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pgcommitfest reply having corrupted subject line

2016-02-07 Thread Magnus Hagander
On Fri, Feb 5, 2016 at 3:44 AM, Noah Misch  wrote:

> On Thu, Feb 04, 2016 at 09:19:19AM +0100, Magnus Hagander wrote:
> > On Thu, Feb 4, 2016 at 7:26 AM, Noah Misch  wrote:
> > > The following message, which bears "User-Agent: pgcommitfest",
> > >
> > >
> > >
> http://www.postgresql.org/message-id/flat/20160202164101.1291.30526.p...@coridan.postgresql.org
> > >
> > > added spaces after commas in its subject line, compared to the subject
> > > line of
> > > its In-Reply-To message.
> > >
> > >  new subject line: Re: Add generate_series(date, date) and
> > > generate_series(date, date, integer)
> > > previous subject line: Re: Add generate_series(date,date) and
> > > generate_series(date,date,integer)
> > >
> > > I see no way to manually alter the subject line from the
> > > commitfest.postgresql.org review UI.  Is commitfest.postgresql.org
> > > initiating
> > > this change internally?
> > >
> >
> > That is weird.
> >
> > The CF app certainly doesn't do that intentionally - it copies it from
> the
> > archives. And if I look in the db on the cf app, it has the subject
> without
> > the space as the field that it copied :O
> >
> > The code is line 355-358 at:
> >
> http://git.postgresql.org/gitweb/?p=pgcommitfest2.git;a=blob;f=pgcommitfest/commitfest/views.py;h=b4f19b2db470e5269943418b2402ca9ddfff0dff;hb=fec3b2431730c131a206a170a99a7610cdbacc6b#l355
> >
> > the "subject" field in the db that we copy does not have the spaces... I
> > honestly have no idea where they are coming from :O I'm guessing it must
> be
> > something internally in the python libraries that create the MIME.
>
> So it is.  The problem happens when email.mime.text.MIMEText wraps the
> subject
> line; see attached test program.
>

Ouch. So that's basically a bug in the python standard libraries :( It
looks a lot like this one, doesn't it? https://bugs.python.org/issue25257



> > Have you
> > seen this with any other messages, that you can recall, or just this one?
>
> Just this one.  However, no other hackers subject line since 2015-01-01
> contains a comma followed by something other than a space.
>

I wonder in that case if it's worth trying to do something about that in
our code, or just leave it be.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: [HACKERS] pgcommitfest reply having corrupted subject line

2016-02-04 Thread Noah Misch
On Thu, Feb 04, 2016 at 09:19:19AM +0100, Magnus Hagander wrote:
> On Thu, Feb 4, 2016 at 7:26 AM, Noah Misch  wrote:
> > The following message, which bears "User-Agent: pgcommitfest",
> >
> >
> > http://www.postgresql.org/message-id/flat/20160202164101.1291.30526.p...@coridan.postgresql.org
> >
> > added spaces after commas in its subject line, compared to the subject
> > line of
> > its In-Reply-To message.
> >
> >  new subject line: Re: Add generate_series(date, date) and
> > generate_series(date, date, integer)
> > previous subject line: Re: Add generate_series(date,date) and
> > generate_series(date,date,integer)
> >
> > I see no way to manually alter the subject line from the
> > commitfest.postgresql.org review UI.  Is commitfest.postgresql.org
> > initiating
> > this change internally?
> >
> 
> That is weird.
> 
> The CF app certainly doesn't do that intentionally - it copies it from the
> archives. And if I look in the db on the cf app, it has the subject without
> the space as the field that it copied :O
> 
> The code is line 355-358 at:
> http://git.postgresql.org/gitweb/?p=pgcommitfest2.git;a=blob;f=pgcommitfest/commitfest/views.py;h=b4f19b2db470e5269943418b2402ca9ddfff0dff;hb=fec3b2431730c131a206a170a99a7610cdbacc6b#l355
> 
> the "subject" field in the db that we copy does not have the spaces... I
> honestly have no idea where they are coming from :O I'm guessing it must be
> something internally in the python libraries that create the MIME.

So it is.  The problem happens when email.mime.text.MIMEText wraps the subject
line; see attached test program.

> Have you
> seen this with any other messages, that you can recall, or just this one?

Just this one.  However, no other hackers subject line since 2015-01-01
contains a comma followed by something other than a space.
import email.mime.text

msg = email.mime.text.MIMEText('body text', _charset='utf-8')
msg['Subject'] = 'Re: generate_series(date,date)'
print(msg.as_string())

msg = email.mime.text.MIMEText('body text', _charset='utf-8')
msg['Subject'] = ('Re: '
  '  '
  '  '
  'generate_series(date,date) '
  '')
print(msg.as_string())

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pgcommitfest reply having corrupted subject line

2016-02-04 Thread Magnus Hagander
On Thu, Feb 4, 2016 at 7:26 AM, Noah Misch  wrote:

> The following message, which bears "User-Agent: pgcommitfest",
>
>
> http://www.postgresql.org/message-id/flat/20160202164101.1291.30526.p...@coridan.postgresql.org
>
> added spaces after commas in its subject line, compared to the subject
> line of
> its In-Reply-To message.
>
>  new subject line: Re: Add generate_series(date, date) and
> generate_series(date, date, integer)
> previous subject line: Re: Add generate_series(date,date) and
> generate_series(date,date,integer)
>
> I see no way to manually alter the subject line from the
> commitfest.postgresql.org review UI.  Is commitfest.postgresql.org
> initiating
> this change internally?
>

That is weird.

The CF app certainly doesn't do that intentionally - it copies it from the
archives. And if I look in the db on the cf app, it has the subject without
the space as the field that it copied :O

The code is line 355-358 at:
http://git.postgresql.org/gitweb/?p=pgcommitfest2.git;a=blob;f=pgcommitfest/commitfest/views.py;h=b4f19b2db470e5269943418b2402ca9ddfff0dff;hb=fec3b2431730c131a206a170a99a7610cdbacc6b#l355

the "subject" field in the db that we copy does not have the spaces... I
honestly have no idea where they are coming from :O I'm guessing it must be
something internally in the python libraries that create the MIME. Have you
seen this with any other messages, that you can recall, or just this one?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/