bzrlib._walkdirs_win32.Win32ReadDir.read_dir doesn't work with junction points on Windows 7

Bug #887067 reported by Yaroslav Sokolov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Bazaar Explorer
Invalid
Medium
Unassigned

Bug Description

the error message: bzr: ERROR: [Error 5] C:/Users/yarick/Anwendungsdaten/*

the log file contains the following:
963.846 Traceback (most recent call last):
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\explorer.py", line 1485, in callable_with_cleanup
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\explorer.py", line 1652, in _open_location_task
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\location_viewer.py", line 163, in add_location
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\location.py", line 176, in view
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\view_workingtree.py", line 75, in __init__
  File "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\view_workingtree.py", line 116, in _add_file_watcher_paths
  File "bzrlib\osutils.pyo", line 1787, in _walkdirs_utf8
  File "_walkdirs_win32.pyx", line 227, in bzrlib._walkdirs_win32.Win32ReadDir.read_dir (bzrlib\_walkdirs_win32.c:1837)
WindowsError: [Error 5] C:/Users/yarick/Anwendungsdaten/*

PS: the error does not happens, when View/Diagnostic Mode is turned on

Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

the tested version is bzr 2.4.2 standalone for windows

Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

OS: Windows 7 Ultimate, 64 bit

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 887067] [NEW] branch cannot be opened after upgrade from 2.3.4 to 2.4.*

Yaroslav Sokolov пишет:
> Public bug reported:

> File "_walkdirs_win32.pyx", line 227, in bzrlib._walkdirs_win32.Win32ReadDir.read_dir (bzrlib\_walkdirs_win32.c:1837)
> WindowsError: [Error 5] C:/Users/yarick/Anwendungsdaten/*

Does your path has non-ascii characters in it?

> PS: the error does not happens, when View/Diagnostic Mode is turned on

In that mode nothing really executed.

--
All the dude wanted was his rug back

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

Alexander Belchenko пишет:
> Yaroslav Sokolov пишет:
>> Public bug reported:
>
>> File "_walkdirs_win32.pyx", line 227, in bzrlib._walkdirs_win32.Win32ReadDir.read_dir (bzrlib\_walkdirs_win32.c:1837)
>> WindowsError: [Error 5] C:/Users/yarick/Anwendungsdaten/*
>
> Does your path has non-ascii characters in it?

I think the problem in the line 111 of the file "C:/Program Files
(x86)/Bazaar/plugins\explorer\lib\view_workingtree.py"

             root = self.model.branch.user_transport.local_abspath(".")

It should be

             root = self.model.branch.user_transport.local_abspath(u".")

Yaroslav, can you change that line as I shown and try again? Will it fix
the problem for you?

--
All the dude wanted was his rug back

Changed in bzr-explorer:
status: New → Incomplete
importance: Undecided → Critical
milestone: none → 1.2.2
tags: added: unicode
Revision history for this message
Yaroslav Sokolov (yarick123) wrote : Re: branch cannot be opened after upgrade from 2.3.4 to 2.4.*

Alexander Belchenko wrote:

> Does your path has non-ascii characters in it?

No, my path does not contain non-ascii characters.

> I think the problem in the line 111 of the file "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\view_workingtree.py"
>
> root = self.model.branch.user_transport.local_abspath(".")
>
> It should be
>
> root = self.model.branch.user_transport.local_abspath(u".")
>
> Yaroslav, can you change that line as I shown and try again? Will it fix the problem for you?

Unfortunately it did not fix the problem.

Maybe the following information can help to find the cause:

- C:/Users/yarick/Anwendungsdaten is a junction to C:\Users\yarick\AppData\Roaming,
- its owner is "NT AUTHORITY \ SYSTEM", the rights are very restrictive, but it is allowed to me to read and to write into this junction,
- if I make a copy of the folder C:/Users/yarick and manually create a junction "Anwendungsdaten" with default rights, BZR crashes in a subfolder with a junction "Programme", which has the same rights as the original "Anwendungsdaten":

bzr: ERROR: [Error 5] Q:/Users/yarick/Anwendungsdaten/Microsoft/Windows/Start Menu/Programme/*

Actually, the word "Anwendungsdaten" is listed in "C:\Users\yarick\.bzrignore". I think, in this case this folder should not be processed at all, am I wrong?

Thank you for the help!

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

Thank you for the additional info.

Error 5 it's "ERROR_ACCESS_DENIED": Access is denied.

I think it explains something.

bzr is unable to escalate access rights. I think you should run bzr with corresponding rights.

I have no idea though why you didn't get that error with previous version. Maybe it simple did less.

tags: removed: unicode
Changed in bzr-explorer:
importance: Critical → Undecided
Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

Alexander Belchenko (bialix),

I ran the Explorer "as administrator" - result is the same.

Anyway, is it correct, that folders, which are in the ignore list, are processed at this point?

Thank you for the help.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 887067] Re: branch cannot be opened after upgrade from 2.3.4 to 2.4.*

Yaroslav Sokolov пишет:
> Alexander Belchenko (bialix),
>
> I ran the Explorer "as administrator" - result is the same.
>
> Anyway, is it correct, that folders, which are in the ignore list, are
> processed at this point?

Those folders have been tried to be added to "filesystem watcher"
list, but unfortunately they don't checked for ignore condition.

You can try to disable automatic refresh in Bazaar Explorer settings*
-- it should disable that behavior.

* Tools - Options - Behavior - Automatically refresh status report

--
All the dude wanted was his rug back

Revision history for this message
Yaroslav Sokolov (yarick123) wrote : Re: branch cannot be opened after upgrade from 2.3.4 to 2.4.*

PS: C:/Users/{UserName}/Anwendungsdaten is "standard" folder junction for german windows 7. The rights are predefined. So I would name it "default" environment.

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

Assigned to bzrlib core because error comes from C-extension.

summary: - branch cannot be opened after upgrade from 2.3.4 to 2.4.*
+ bzrlib._walkdirs_win32.Win32ReadDir.read_dir don't work with junction
+ points on Windows 7
summary: - bzrlib._walkdirs_win32.Win32ReadDir.read_dir don't work with junction
+ bzrlib._walkdirs_win32.Win32ReadDir.read_dir doesn't work with junction
points on Windows 7
Jelmer Vernooij (jelmer)
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
tags: added: win32
Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

Alexander Belchenko (bialix) wrote:

> You can try to disable automatic refresh in Bazaar Explorer settings*
> -- it should disable that behavior.

I tried this work around. Unfortunately it does not help. The log entries are the same.

Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

I "disabled" the function _add_file_watcher_paths in the file "C:/Program Files (x86)/Bazaar/plugins\explorer\lib\view_workingtree.py":

105: def _add_file_watcher_paths(self):
106: return [] # yarick: work around to completely disable the file system watcher functionality (see https://bugs.launchpad.net/bzr/+bug/887067)

Now I can use the version 2.4.* in my environment. I understand, that this work around turns off the complete file watcher functionality, but it is better as nothing.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 887067] Re: bzrlib._walkdirs_win32.Win32ReadDir.read_dir doesn't work with junction points on Windows 7

Yaroslav Sokolov пишет:
> I "disabled" the function _add_file_watcher_paths in the file
> "C:/Program Files
> (x86)/Bazaar/plugins\explorer\lib\view_workingtree.py":
>
> 105: def _add_file_watcher_paths(self):
> 106: return [] # yarick: work around to completely disable the file system watcher functionality (see https://bugs.launchpad.net/bzr/+bug/887067)
>
> Now I can use the version 2.4.* in my environment. I understand, that
> this work around turns off the complete file watcher functionality, but
> it is better as nothing.

Well, disabling automatic refresh should in theory do the same, but in
practice it's not. It is separate bug, I think.

Martin Packman (gz)
tags: added: filewatcher
Changed in bzr-explorer:
milestone: 1.2.2 → none
Revision history for this message
Alexander Belchenko (bialix) wrote :

Please, test new Bazaar Explorer 1.2.2 release, and tell us whether the problem still exists.

Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

the bug still exists :(
I attach the .bzr.log

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

Yaroslav: OK, I see. I've re-read all comments in this bug report and I see there 2 bugs:

1. bzrlib is unable to process junction points.
2. bzr-explorer tries to add ignored folders to filewatcher.

Your local workaround is fine, because on Windows I have disabled the filewatcher, but the problem occurs not in filewatcher per se, but in bzrlib.

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

Yaroslav: please test the following command in your branch:

bzr ls -R -V -k directory

and tell me whether it works OK without errors.

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

I've filed bzr-explorer specific bug report based on this one: https://bugs.launchpad.net/bzr-explorer/+bug/938994

Changed in bzr-explorer:
status: Incomplete → New
status: New → Invalid
Revision history for this message
Alexander Belchenko (bialix) wrote :

I've marked bzr-explorer's bug status as invalid because the bug title is really talk about bzrlib internals, and we have separate bug report for explorer-specific bug.

Revision history for this message
Yaroslav Sokolov (yarick123) wrote :

Alexander Belchenko (bialix) wrote on 2012-02-22:
> Yaroslav: please test the following command in your branch:
>
> bzr ls -R -V -k directory
>
> and tell me whether it works OK without errors.

It works OK without errors.

Changed in bzr-explorer:
status: Invalid → Confirmed
importance: Undecided → Medium
status: Confirmed → Invalid
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.