Unknown branch format if line endings are modified

Bug #159021 reported by Jaap Karssenberg
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned
Breezy
Fix Released
Low
Jelmer Vernooij

Bug Description

Running Bazaar 0.91 on both Linux and Windows. Linux install came from distro, Windows install from installer on the website. Created and used branches on both hosts.

Gzipped a branch on Linux and copied it to the Windows host. Bzr is unable to use this branch:

  bzr: ERROR: Unknown branch format: 'Bazaar-NG meta directory, format 1\r\n'

Unix file endings are not the problem - converted line endings with gvim (on the Win32 host) - same error.

Copied to ".bzr\branch-format" file of a working Windows tree. Now the new error is:

  bzr: ERROR: Unknown branch format: 'Bazaar Branch Format 6 (bzr 0.15)\r\n'

Strangest thing is that I don't see a diff between the two "branch-format" files, but putting back the old one makes the first error return !?

Please suggest further tests - can submit gzipped branch that causes the error.

Related branches

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

My bad. Line ending *is* the cause for the first error. Maybe line ending in another file is the cause for the second error?

Windows unzip utilities have a habit of converting to windows line endings :(

Revision history for this message
John A Meinel (jameinel) wrote :

Line endings are the problem.

And if your utility is changing all of the line endings, it is potentially corrupting other files. We store most of your data in compressed form. But that means that you might randomly have "\n" characters in those files. Which means they would be randomly expanded to "\r\n".

I would highly recommend either just using Bazaar itself to create the local branches, or just using a different decompression tool. (Maybe there is a flag to tell it not to break all of your files?)

We *could* be more lenient about the format strings. But I think in this case, it is better to detect that there has been modification, and just give a warning about possible corruption.

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 159021] Re: Unkown branch format after copy from Linux and Win32

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel пишет:
> Line endings are the problem.
>
> And if your utility is changing all of the line endings, it is
> potentially corrupting other files. We store most of your data in
> compressed form. But that means that you might randomly have "\n"
> characters in those files. Which means they would be randomly expanded
> to "\r\n".
>
> I would highly recommend either just using Bazaar itself to create the
> local branches, or just using a different decompression tool. (Maybe
> there is a flag to tell it not to break all of your files?)

I'm suggest to use 7-zip. It's open source, understand many formats,
and never touch line-endings as I can see.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHKLK2zYr338mxwCURAl1zAKCSeNk2NR66r6dJL5VddV1fHW4BAgCgikE6
OHWV3neLPFMB0NZrAflc/bc=
=ce03
-----END PGP SIGNATURE-----

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
> John A Meinel ?8H5B:
>> Line endings are the problem.
>
>> And if your utility is changing all of the line endings, it is
>> potentially corrupting other files. We store most of your data in
>> compressed form. But that means that you might randomly have "\n"
>> characters in those files. Which means they would be randomly expanded
>> to "\r\n".
>
>> I would highly recommend either just using Bazaar itself to create the
>> local branches, or just using a different decompression tool. (Maybe
>> there is a flag to tell it not to break all of your files?)
>
> I'm suggest to use 7-zip. It's open source, understand many formats,
> and never touch line-endings as I can see.

Agreed. The only thing I miss with 7-zip is simple drag-and-drop to Explorer.
But otherwise it has a huge supported set of formats and is free.

http://www.7zip.org

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHKLXaJdeBCYSNAAMRAl/1AKC4lvHnSr9COrw0yk/wE952amcaOQCg0+ml
rE6ythNKRAnD3Fe3ZtciLC8=
=Xga5
-----END PGP SIGNATURE-----

Revision history for this message
Martin Pool (mbp) wrote :

> We *could* be more lenient about the format strings. But I think in this
> case, it is better to detect that there has been modification, and just
> give a warning about possible corruption.

To be nice, we could give a specific message when the format string is
the same as a valid one, but with line-endings changed... (bug 159089)

--
Martin

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Attached a small patch to throw a more descriptive error when line ending is wrong.

Disclaimer: I hardly know any python and patch is untested - consider it pseudo code

Revision history for this message
Martin Pool (mbp) wrote :

That looks reasonable. We should add a test that it works, by making
a repository and mangling its format.

Our first patch from cpan.org I think ;-)

Changed in bzr:
status: Triaged → In Progress
John A Meinel (jameinel)
Changed in bzr:
status: In Progress → Confirmed
tags: added: easy patch-needswork ui
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz:
status: New → Triaged
importance: Undecided → Low
Jelmer Vernooij (jelmer)
Changed in brz:
status: Triaged → Fix Committed
milestone: none → 3.0.0
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer)
Changed in brz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.