Michael Hudson points out that commit now fails if a file with a newline in the name is added, but that's when running with asserts.
If you are using python -O (or a bzr installed to use .pyo files), then instead of the assert, you get:
KnitCorrupt: Knit None corrupt: incorrect number of lines 4 != 3 for version {<email address hidden>}
I used this script:
---
set -e
BZR=bzr
mkdir test
cd test/
python -O $BZR init
touch foo
python -O $BZR add foo
python -O $BZR ci -m "Initial"
cd ..
python -O $BZR co test co-test
cd co-test/
echo "newline" > "file
name"
python -O $BZR add "file
name"
python -O $BZR ci -m "Commit"
---
And got this traceback with bzr.dev:
Traceback (most recent call last):
File "/home/andrew/code/bzr/bzrlib/commands.py", line 836, in run_bzr_catch_errors
return run_bzr(argv)
File "/home/andrew/code/bzr/bzrlib/commands.py", line 791, in run_bzr
ret = run(*run_argv)
File "/home/andrew/code/bzr/bzrlib/commands.py", line 492, in run_argv_aliases
return self.run(**all_cmd_args)
File "/home/andrew/code/bzr/bzrlib/builtins.py", line 2329, in run
author=author)
File "/home/andrew/code/bzr/bzrlib/decorators.py", line 165, in write_locked
return unbound(self, *args, **kwargs)
File "/home/andrew/code/bzr/bzrlib/workingtree_4.py", line 246, in commit
result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
File "/home/andrew/code/bzr/bzrlib/decorators.py", line 165, in write_locked
return unbound(self, *args, **kwargs)
File "/home/andrew/code/bzr/bzrlib/mutabletree.py", line 187, in commit
revprops=revprops, *args, **kwargs)
File "/home/andrew/code/bzr/bzrlib/commit.py", line 389, in commit
revision_id=self.rev_id)
File "/home/andrew/code/bzr/bzrlib/repository.py", line 949, in fetch
return inter.fetch(revision_id=revision_id, pb=pb, find_ghosts=find_ghosts)
File "/home/andrew/code/bzr/bzrlib/decorators.py", line 165, in write_locked
return unbound(self, *args, **kwargs)
File "/home/andrew/code/bzr/bzrlib/repository.py", line 2737, in fetch
revision_ids).pack()
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 589, in pack
return self._create_pack_from_packs()
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 719, in _create_pack_from_packs
self._copy_inventory_texts()
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 649, in _copy_inventory_texts
self._process_inventory_lines(inv_lines)
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 904, in _process_inventory_lines
inv_lines, self.revision_ids)
File "/home/andrew/code/bzr/bzrlib/repository.py", line 1276, in _find_file_ids_from_xml_inventory_lines
line_iterator).iterkeys():
File "/home/andrew/code/bzr/bzrlib/repository.py", line 1216, in _find_text_key_references_from_xml_inventory_lines
for line, version_id in line_iterator:
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 805, in _copy_nodes_graph
write_index, output_lines, pb, readv_group_iter, total_items):
File "/home/andrew/code/bzr/bzrlib/repofmt/pack_repo.py", line 833, in _do_copy_nodes_graph
content, _ = knit_data._parse_record(version_id, raw_data)
File "/home/andrew/code/bzr/bzrlib/knit.py", line 2412, in _parse_record
version_id))
KnitCorrupt: Knit None corrupt: incorrect number of lines 4 != 3 for version {<email address hidden>}
Michael Hudson points out that commit now fails if a file with a newline in the name is added, but that's when running with asserts.
If you are using python -O (or a bzr installed to use .pyo files), then instead of the assert, you get:
KnitCorrupt: Knit None corrupt: incorrect number of lines 4 != 3 for version {<email address hidden>}
I used this script:
---
set -e
BZR=bzr
mkdir test
cd test/
python -O $BZR init
touch foo
python -O $BZR add foo
python -O $BZR ci -m "Initial"
cd ..
python -O $BZR co test co-test
cd co-test/
echo "newline" > "file
name"
python -O $BZR add "file
name"
python -O $BZR ci -m "Commit"
---
And got this traceback with bzr.dev:
Traceback (most recent call last): andrew/ code/bzr/ bzrlib/ commands. py", line 836, in run_bzr_ catch_errors andrew/ code/bzr/ bzrlib/ commands. py", line 791, in run_bzr andrew/ code/bzr/ bzrlib/ commands. py", line 492, in run_argv_aliases **all_cmd_ args) andrew/ code/bzr/ bzrlib/ builtins. py", line 2329, in run andrew/ code/bzr/ bzrlib/ decorators. py", line 165, in write_locked andrew/ code/bzr/ bzrlib/ workingtree_ 4.py", line 246, in commit commit( self, message, revprops, *args, **kwargs) andrew/ code/bzr/ bzrlib/ decorators. py", line 165, in write_locked andrew/ code/bzr/ bzrlib/ mutabletree. py", line 187, in commit revprops, *args, **kwargs) andrew/ code/bzr/ bzrlib/ commit. py", line 389, in commit id=self. rev_id) andrew/ code/bzr/ bzrlib/ repository. py", line 949, in fetch revision_ id=revision_ id, pb=pb, find_ghosts= find_ghosts) andrew/ code/bzr/ bzrlib/ decorators. py", line 165, in write_locked andrew/ code/bzr/ bzrlib/ repository. py", line 2737, in fetch ids).pack( ) andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 589, in pack pack_from_ packs() andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 719, in _create_ pack_from_ packs _copy_inventory _texts( ) andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 649, in _copy_inventory _texts _process_ inventory_ lines(inv_ lines) andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 904, in _process_ inventory_ lines andrew/ code/bzr/ bzrlib/ repository. py", line 1276, in _find_file_ ids_from_ xml_inventory_ lines iterator) .iterkeys( ): andrew/ code/bzr/ bzrlib/ repository. py", line 1216, in _find_text_ key_references_ from_xml_ inventory_ lines andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 805, in _copy_nodes_graph andrew/ code/bzr/ bzrlib/ repofmt/ pack_repo. py", line 833, in _do_copy_ nodes_graph _parse_ record( version_ id, raw_data) andrew/ code/bzr/ bzrlib/ knit.py" , line 2412, in _parse_record
File "/home/
return run_bzr(argv)
File "/home/
ret = run(*run_argv)
File "/home/
return self.run(
File "/home/
author=author)
File "/home/
return unbound(self, *args, **kwargs)
File "/home/
result = WorkingTree3.
File "/home/
return unbound(self, *args, **kwargs)
File "/home/
revprops=
File "/home/
revision_
File "/home/
return inter.fetch(
File "/home/
return unbound(self, *args, **kwargs)
File "/home/
revision_
File "/home/
return self._create_
File "/home/
self.
File "/home/
self.
File "/home/
inv_lines, self.revision_ids)
File "/home/
line_
File "/home/
for line, version_id in line_iterator:
File "/home/
write_index, output_lines, pb, readv_group_iter, total_items):
File "/home/
content, _ = knit_data.
File "/home/
version_id))
KnitCorrupt: Knit None corrupt: incorrect number of lines 4 != 3 for version {<email address hidden>}