eol content filters are never loaded and thus never applied
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Critical
|
Ian Clatworthy |
Bug Description
[Revised the description and summary; added eol keyword.]
With the integration of the former bzr-eol plugin into bzr's core, the eol content filters are no longer actually loaded. I've verified this on MacOS X and Linux by putting a pdb breakpoint and a print at the top of bzrlib/
The eol content filters were previously registered in the former bzr-eol plugin by virtue of the registration being done at the end of its __init__.py.
With the integration of bzr-eol the bzr codebase, the eol content filters are registered when bzrlib/
Actually, bzrlib.filters.eol is explicitly imported in one place, *in the tests*, which is why the tests pass.
Steps to repeat:
0. Verify this is the current bzr-1.14; only diff to this code is a print and pdb.set_trace() in eol.py:
$ uname -a
Linux virtuoso 2.6.24.
$ alias bzr='/staff/
$ bzr version
Bazaar (bzr) 1.14rc1
from bzr checkout /tmp_mnt/
revision: 4249
revid: <email address hidden>
branch nick: bzr-1.14
Python interpreter: /usr/bin/python 2.5.2
Python standard library: /usr/lib64/
bzrlib: /tmp_mnt/
Bazaar configuration: /staff/
Bazaar log file: /staff/
Copyright 2005, 2006, 2007, 2008, 2009 Canonical Ltd.
http://
bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.
$ (cd /staff/
=== modified file 'bzrlib/
--- bzrlib/
+++ bzrlib/
@@ -19,6 +19,8 @@
See bzr help eol for details.
"""
+print "==> loaded eol.py"
+import pdb; pdb.set_trace()
import re, sys
1. Create .bazaar/rules with a rule that should apply to all files and that definitely should cause some content transformation:
$ cat ~/.bazaar/rules
[name *]
eol=lf-
2. Create a 1.14 format branch
$ bzr init --1.14 /tmp/test-branch
Created a standalone tree (format: 1.14)
$ cd /tmp/test-branch
3. Populate with some LF-terminated content.
$ cat >test1.txt
this
is
a
test
$ cat >test2.txt
son
of
a
gun
$ hexdump -C test*
00000000 74 68 69 73 0a 69 73 0a 61 0a 74 65 73 74 0a 73 |this.is.a.test.s|
00000010 6f 6e 0a 6f 66 0a 61 0a 67 75 6e 0a |on.of.a.gun.|
0000001c
$ bzr add
adding test1.txt
adding test2.txt
$
4. Commit. Note that we previously aliased bzr with -Dfilters, so we should see some output here.
$ bzr commit -m 'First commit'
Committing to: /tmp/test-branch/
added test1.txt
added test2.txt
Committed revision 1.
$ tail ~/.bzr.log
0.051 bzr arguments: [u'--no-plugins', u'-Dfilters', u'commit', u'-m', u'First commit']
0.123 encoding stdout as sys.stdout encoding 'UTF-8'
0.358 opening working tree '/tmp/test-branch'
0.418 preparing to commit
[ 5995] 2009-04-08 10:35:53.674 INFO: Committing to: /tmp/test-branch/
0.437 Selecting files for commit with filter []
[ 5995] 2009-04-08 10:35:53.677 INFO: added test1.txt
[ 5995] 2009-04-08 10:35:53.677 INFO: added test2.txt
[ 5995] 2009-04-08 10:35:53.828 INFO: Committed revision 1.
0.593 return code 0
5. Verify that the files do not have CR-LF in the repo:
$ bzr cat test1.txt | hexdump -C
00000000 74 68 69 73 0a 69 73 0a 61 0a 74 65 73 74 0a |this.is.a.test.|
0000000f
$ bzr cat test2.txt | hexdump -C
00000000 73 6f 6e 0a 6f 66 0a 61 0a 67 75 6e 0a |son.of.a.gun.|
0000000d
6. Try reverting the files, and see there is no change:
$ bzr revert test*
$ hexdump -C test*
00000000 74 68 69 73 0a 69 73 0a 61 0a 74 65 73 74 0a 73 |this.is.a.test.s|
00000010 6f 6e 0a 6f 66 0a 61 0a 67 75 6e 0a |on.of.a.gun.|
0000001c
7. Verify eol was never loaded (file size for eol.py are slightly larger as I added a print and pdb.set_trace() to the top)
$ ls -l /staff/
total 22
-rw-r--r-- 1 bsd178 wheel 2375 2009-04-08 10:35 eol.py
-rw-r--r-- 1 bsd178 wheel 9170 2009-04-08 09:49 __init__.py
-rw-r--r-- 1 bsd178 wheel 9635 2009-04-08 09:50 __init__.pyc
description: | updated |
tags: | added: 1.14 bzr eol |
summary: |
- eol filter silently ignores unknown settings + eol content filters are never loaded and thus never applied |
Changed in bzr: | |
assignee: | nobody → Ian Clatworthy (ian-clatworthy) |
importance: | Undecided → Critical |
Changed in bzr: | |
milestone: | none → 1.14rc2 |
A patch has been sent to the mailing list for this. Please apply and retest.