[MERGE] don't report malformed bundles as NotABundle
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Jun 21 19:12:08 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
>>I want it to either succed or else not raise NotABundle. I don't want
>>to codify that crlf bundles should raise BadBundle, but I can't assert
>>that they don't fail.
>
>
> Well, your assertNotRaises catches all other exceptions.
That is deliberate. This test explicitly permits it read_bundle to
raise any exception it wishes, except BadBundle. That is all I care
about. That is specifically what I want to test.
> I would recommend doing:
> try:
> do_the_thing
> except NotABundle:
> self.fail('do_the_thing can't raise NotABundle')
If you do that, you'll get a BadBundle thrown, and the test case will
error out.
> All other actions are regular bugs that need to be fixed.
Any other action will not be a bizarre problem like raising NotABundle.
> Well, then you can change that to "line[1:].rstrip('\r\n')"
>
> I suppose we could have a problem if the message itself used '\r\n' line
> endings. Though I believe we strip them out when we read the commit
> message. (We read in text mode).
Either the whole bundle text is in DOS line endings, or it's not. I
propose that we add a strip_cr parameter to BundleReader, and if it's
set, strip the CRs in the generator produced by BundleReader._next().
> Another possible fix is to check the line ending of the header line. And
> then assert that all '#' prefixed lines end with that line ending, and
> strip it.
>
>
>>I don't think so. We may have trailing whitespace in our text, e.g.:
>>
>># message:
>># This is a message with a lot of
>># whitespace in it.
>
>
> Well, I'm not sure what you wrote, because there are no trailing
> whitespaces in the above text.
I put two or three spaces after "of".
> Probably your mailer stripped them.
One way of defeating that particular problem would be to have an
end-of-line marker that would not be stripped. But it's such a rare
case, it's probably simplest to just base64-encode patches that have
trailing ws, or mixed line-endings.
> The only difference I know of, is that RIO puts the first line of a
> multiline string on the same line. Whereas this one puts the first line
> on the next line. (And uses spaces rather than a tab character).
> Is there some other difference that I don't know about?
RIO uses one line per key/value pair, and uses a blank line as the
stanza separator. I assume we'd do single stanzas, though.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEmYv40F+nu1YWqI0RAh6rAJ4kwasQ2xjtUmsYqyTDNY6RwVnVugCdF1C5
grcCcKWJxdEdM8YxYA5exGY=
=d/hb
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list