Linefeed symbols appear in notepad

Bug #110901 reported by Matthew Steeples
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Alexander Belchenko

Bug Description

On Win32 0.16rc1:
In a branch, make some changes and then run bzr --commit
In the notepad window that pops up, the entire file is on one line and the squares appear where CR+LF would usually be. I don't know if this is an actual problem for checking in (I'm guessing not) but it doesn't look too pretty.

Windows XP SP2

This used to work in 0.14 and before (didn't get chance to try 0.15)

Tags: win32

Related branches

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

Confirmed. This is regression.

Actually bug in the code that write commit template to the file. Now it use unix line-endings (LF-only), but notepad don't understand this. It requires CRLF.

To fix problem need to change code that open file before write: mode should be 'w' not 'wb'.

Changed in bzr:
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
Alexander Belchenko (bialix) wrote :

Actually this bug exists an in 0.15 too. And I believe it caused by this statement:

msgfile = os.fdopen(tmp_fileno, 'w')

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

Bug caused by the code:

        tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.', dir=u'.')
        msgfile = os.fdopen(tmp_fileno, 'w')

By default mkstemp open file in binary mode. In 0.14 and before we explicitly re-open file in text mode. Now should be used such fix:

=== modified file 'bzrlib/msgeditor.py'
--- bzrlib/msgeditor.py 2007-02-26 21:48:05 +0000
+++ bzrlib/msgeditor.py 2007-04-29 07:28:14 +0000
@@ -103,7 +103,9 @@

     msgfilename = None
     try:
- tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.', dir=u'.')
+ tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
+ dir=u'.',
+ text=True)
         msgfile = os.fdopen(tmp_fileno, 'w')
         try:
             if start_message is not None:

Changed in bzr:
assignee: nobody → bialix
Revision history for this message
Alexander Belchenko (bialix) wrote :

fix and test to prevent regression in the future in associated branch

Changed in bzr:
status: Confirmed → Fix Committed
Revision history for this message
Matthew Steeples (matthew.steeples) wrote :

Thanks very much for the rapid turnaround. Works perfectly now.

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

Fix already in 0.16rc2 and corresponding tests in bzr.dev

Changed in bzr:
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.