bzr doesn't accept newlines in file names

Bug #649250 reported by Rudolf Meijering
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
bzr (Debian)
Fix Released
Unknown

Bug Description

On bzr commit from within bzr explorer I get:

...
added Research/SP3A-EVAL/xlx_s3a_evl-ug.pdf
aborting commit write group: BzrBadParameterContainsNewline(Parameter lines contains a newline.)
bzr: ERROR: bzrlib.errors.BzrBadParameterContainsNewline: Parameter lines contains a newline.

Tried to create a new bzr repository and add same fileset which gave the same error. I have not been able to identify which file might cause this problem.

Revision history for this message
Rudolf Meijering (skaapgif) wrote :
Revision history for this message
Alexander Belchenko (bialix) wrote :
Download full text (4.3 KiB)

PythonVersion: 2.6.5
Traceback:
 Traceback (most recent call last):
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 853, in exception_to_return_code
     return the_callable(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1055, in run_bzr
     ret = run(*run_argv)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 661, in run_argv_aliases
     return self.run_direct(**all_cmd_args)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 665, in run_direct
     return self._operation.run_simple(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 122, in run_simple
     self.cleanups, self.func, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
     result = func(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/qbzr/lib/commands.py", line 788, in run
     return run_subprocess_command(cmd, bencoded)
   File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/qbzr/lib/subprocess.py", line 789, in run_subprocess_command
     return commands.run_bzr(argv)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1055, in run_bzr
     ret = run(*run_argv)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 661, in run_argv_aliases
     return self.run_direct(**all_cmd_args)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 665, in run_direct
     return self._operation.run_simple(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 122, in run_simple
     self.cleanups, self.func, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
     result = func(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3138, in run
     exclude=safe_relpath_files(tree, exclude))
   File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 194, in write_locked
     result = unbound(self, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree_4.py", line 197, in commit
     result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 194, in write_locked
     result = unbound(self, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/mutabletree.py", line 225, in commit
     *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 257, in commit
     possible_master_transports=possible_master_transports)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 118, in run
     self.cleanups, self.func, self, *args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
     result = func(*args, **kwargs)
   File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 395, in _commit
     self.builder.finish_inventory()
   File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 217, in finish_inventory
     self.parents)
   File "/usr/lib/python2.6/dist-packages/bzrlib/repofmt/groupcompress_r...

Read more...

Revision history for this message
Alexander Belchenko (bialix) wrote :

Although the commit have been invoked via QBzr's qcommit but the real error comes deeply from bzrlib.

Revision history for this message
Alexander Belchenko (bialix) wrote :

@sKAApGIF can you check that the same error happens when you run the commit command from the command line, e.g.

bzr commit -m test

?

Revision history for this message
Rudolf Meijering (skaapgif) wrote :

Same problem:

added Research/SP3A-EVAL/xlx_s3a_evl-ug.pdf
aborting commit write group: BzrBadParameterContainsNewline(Parameter lines contains a newline.)
bzr: ERROR: bzrlib.errors.BzrBadParameterContainsNewline: Parameter lines contains a newline.

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    attaching the crash file
        /home/skaapgif/.cache/crash/bzr-20100927203050-8209.crash
    and including a description of the problem.

    The crash file is plain text and you can inspect or edit it to remove
    private information.

I have tried to remove several files without any luck, if I remove the whole Research directory the commit works. I cannot see any file names with weird names that might cause something strange. I attached bzr status before trying to commit.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 649250] Re: bzr crashes on commit (paramater lines contains a newline)

sKAApGIF пишет:
> Same problem:
>
> added Research/SP3A-EVAL/xlx_s3a_evl-ug.pdf

Can you exclude just this file? E.g.

bzr commit -m test -x Research/SP3A-EVAL/xlx_s3a_evl-ug.pdf

I think something inside this file triggers the error.

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: bzr crashes on commit (paramater lines contains a newline)

Your problem is a filename that contains a newline. Look closely at the 'bzr status' output:

"""
  Research/Cyclone III/Nios II Custom Instruction
User Guide.pdf
"""

That file name is almost certainly the problem.

There's a few issues here:
 * bzr ought to support files with newlines in their name, but doesn't.
 * bzr ought to be reporting the error more clearly than it is.
 * bzr shouldn't allow you to add that file in the first place. IIRC plain 'bzr add' does prevent this, but maybe qbzr avoids that check? If so we should move the check in bzr to somewhere better so that qbzr etc can't dodge it by accident.

Basically though this is a duplicate of the bug that we don't support newlines, so I'll mark it as a duplicate of that.

Revision history for this message
Andrew Bennetts (spiv) wrote :

Hmm, I actually can't find the bug report specifically for newlines-in-filenames, although I thought it existed. Bug 81844 (handle backslashes in filenames more gracefully) and bug 274250 (bzr upgrade gives a KnitCorrupt traceback when branch contains any revision with \n in filenames) are related though.

summary: - bzr crashes on commit (paramater lines contains a newline)
+ bzr crashes on commit "Parameter lines contains a newline" due to
+ newline in filename
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Jelmer Vernooij (jelmer)
tags: added: commit
Changed in bzr (Debian):
status: Unknown → Confirmed
Martin Pool (mbp)
summary: - bzr crashes on commit "Parameter lines contains a newline" due to
- newline in filename
+ bzr doesn't accept newlines in file names
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Changed in bzr (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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