Merge lp:~bialix/bzr/hidden_attr_on_unicode into lp:~bzr/bzr/trunk-old

Proposed by Alexander Belchenko
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bialix/bzr/hidden_attr_on_unicode
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 83 lines
To merge this branch: bzr merge lp:~bialix/bzr/hidden_attr_on_unicode
Reviewer Review Type Date Requested Status
John A Meinel Approve
bzr-core Pending
Review via email: mp+8181@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexander Belchenko (bialix) wrote :

Bzr has one latent bug related to create new .bzr directory inside unicode directory. The problem occurs when unicode path cannot be encoded in current user encoding, as pointed by INADA Naoki, see
https://bugs.launchpad.net/tortoisebzr/+bug/335362/comments/41

This is rare condition, but bug itself is very serious.
Please, merge for 1.17.

(This is 3rd version of my patch, started from merge directive in ML, and now I send it to LP as jml and vila suggested).

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

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

Alexander Belchenko wrote:
> You have been requested to review the proposed merge of lp:~bialix/bzr/hidden_attr_on_unicode into lp:bzr.
>
> Bzr has one latent bug related to create new .bzr directory inside unicode directory. The problem occurs when unicode path cannot be encoded in current user encoding, as pointed by INADA Naoki, see
> https://bugs.launchpad.net/tortoisebzr/+bug/335362/comments/41
>
> This is rare condition, but bug itself is very serious.
> Please, merge for 1.17.
>
> (This is 3rd version of my patch, started from merge directive in ML, and now I send it to LP as jml and vila suggested).
>
> --
> https://code.launchpad.net/~bialix/bzr/hidden_attr_on_unicode/+merge/8181
> You are requested to review the proposed merge of lp:~bialix/bzr/hidden_attr_on_unicode into lp:bzr.
>

As mentioned on Bundle Buggy, you need to add
"requireFeature(Unicode...)" for the tests, otherwise:

 vote approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpODmcACgkQJdeBCYSNAAMPSQCaA8V9Jw0JCqAfbG1tKbL52tXT
xAcAoI+o5mhlJxLqlw8gKioaCXTEaBzL
=ZGcT
-----END PGP SIGNATURE-----

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

John A Meinel пишет:
> As mentioned on Bundle Buggy, you need to add
> "requireFeature(Unicode...)" for the tests, otherwise:

As I said in ML it's all about windows behavior. Can I just skip tests
when running not on Windows? They have no sense for Linux.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Review: approve

>>>>> "bialix" == Alexander Belchenko <email address hidden> writes:

    bialix> John A Meinel пишет:
    >> As mentioned on Bundle Buggy, you need to add
    >> "requireFeature(Unicode...)" for the tests, otherwise:

    bialix> As I said in ML it's all about windows behavior. Can
    bialix> I just skip tests when running not on Windows? They
    bialix> have no sense for Linux.

Sorted out on IRC, I'll merge.

       Vincent

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-07-03 09:16:56 +0000
+++ NEWS 2009-07-03 14:35:11 +0000
@@ -92,6 +92,10 @@
92 content plus the size of the compressed text. Related to bug #109114.92 content plus the size of the compressed text. Related to bug #109114.
93 (John Arbash Meinel)93 (John Arbash Meinel)
9494
95* Set hidden attribute on .bzr directory below unicode path should never
96 fail with error. The operation should succeed even if bzr unable to set
97 the attribute. (Alexander Belchenko, related to bug #335362).
98
95* Stacking will no longer accept requests to stack on the same99* Stacking will no longer accept requests to stack on the same
96 branch/repository. Existing branches that incorrectly reference the same100 branch/repository. Existing branches that incorrectly reference the same
97 repository in a stacking configuration will now raise101 repository in a stacking configuration will now raise
98102
=== modified file 'bzrlib/tests/test_win32utils.py'
--- bzrlib/tests/test_win32utils.py 2009-06-25 10:05:17 +0000
+++ bzrlib/tests/test_win32utils.py 2009-07-03 14:35:11 +0000
@@ -18,7 +18,13 @@
18import sys18import sys
1919
20from bzrlib import osutils20from bzrlib import osutils
21from bzrlib.tests import TestCase, TestCaseInTempDir, TestSkipped, Feature21from bzrlib.tests import (
22 Feature,
23 TestCase,
24 TestCaseInTempDir,
25 TestSkipped,
26 UnicodeFilenameFeature,
27 )
22from bzrlib.win32utils import glob_expand, get_app_path28from bzrlib.win32utils import glob_expand, get_app_path
23from bzrlib import win32utils29from bzrlib import win32utils
2430
@@ -238,3 +244,20 @@
238244
239 def restoreCtypes(self):245 def restoreCtypes(self):
240 win32utils.has_ctypes = self.old_ctypes246 win32utils.has_ctypes = self.old_ctypes
247
248
249class TestSetHidden(TestCaseInTempDir):
250
251 def test_unicode_dir(self):
252 # we should handle unicode paths without errors
253 self.requireFeature(UnicodeFilenameFeature)
254 os.mkdir(u'\u1234')
255 win32utils.set_file_attr_hidden(u'\u1234')
256
257 def test_dot_bzr_in_unicode_dir(self):
258 # we should not raise traceback if we try to set hidden attribute
259 # on .bzr directory below unicode path
260 self.requireFeature(UnicodeFilenameFeature)
261 os.makedirs(u'\u1234\\.bzr')
262 path = osutils.abspath(u'\u1234\\.bzr')
263 win32utils.set_file_attr_hidden(path)
241264
=== modified file 'bzrlib/win32utils.py'
--- bzrlib/win32utils.py 2009-06-26 07:15:24 +0000
+++ bzrlib/win32utils.py 2009-07-03 14:35:11 +0000
@@ -66,6 +66,7 @@
66 suffix = 'W'66 suffix = 'W'
67try:67try:
68 import win32file68 import win32file
69 import pywintypes
69 has_win32file = True70 has_win32file = True
70except ImportError:71except ImportError:
71 has_win32file = False72 has_win32file = False
@@ -499,7 +500,15 @@
499def set_file_attr_hidden(path):500def set_file_attr_hidden(path):
500 """Set file attributes to hidden if possible"""501 """Set file attributes to hidden if possible"""
501 if has_win32file:502 if has_win32file:
502 win32file.SetFileAttributes(path, win32file.FILE_ATTRIBUTE_HIDDEN)503 if winver != 'Windows 98':
504 SetFileAttributes = win32file.SetFileAttributesW
505 else:
506 SetFileAttributes = win32file.SetFileAttributes
507 try:
508 SetFileAttributes(path, win32file.FILE_ATTRIBUTE_HIDDEN)
509 except pywintypes.error, e:
510 from bzrlib import trace
511 trace.mutter('Unable to set hidden attribute on %r: %s', path, e)
503512
504513
505if has_ctypes and winver != 'Windows 98':514if has_ctypes and winver != 'Windows 98':