/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: Robert Collins
  • Date: 2010-07-04 06:22:11 UTC
  • mto: This revision was merged to the branch mainline in revision 5332.
  • Revision ID: robertc@robertcollins.net-20100704062211-tk9hw6bnsn5x47fm
``bzrlib.lsprof.profile`` will no longer silently generate bad threaded
profiles when concurrent profile requests are made. Instead the profile
requests will be serialised. Reentrant requests will now deadlock.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
        try:
136
136
            out = [ ]
137
137
            # TODO: win32 incorrectly lists paths with non-ascii if path is not
138
 
            # unicode. However on Linux the server should only deal with
 
138
            # unicode. However on unix the server should only deal with
139
139
            # bytestreams and posix.listdir does the right thing
140
140
            if sys.platform == 'win32':
141
141
                flist = [f.encode('utf8') for f in os.listdir(path)]
283
283
        self._socket.close()
284
284
 
285
285
    def run(self):
 
286
        trace.mutter('SocketListener %r has started', self)
286
287
        while True:
287
288
            readable, writable_unused, exception_unused = \
288
289
                select.select([self._socket], [], [], 0.1)
289
290
            if self._stop_event.isSet():
 
291
                trace.mutter('SocketListener %r has stopped', self)
290
292
                return
291
293
            if len(readable) == 0:
292
294
                continue
293
295
            try:
294
296
                s, addr_unused = self._socket.accept()
 
297
                trace.mutter('SocketListener %r has accepted connection %r',
 
298
                    self, s)
295
299
                # because the loopback socket is inline, and transports are
296
300
                # never explicitly closed, best to launch a new thread.
297
301
                threading.Thread(target=self._callback, args=(s,)).start()
442
446
                'the local current working directory.' % (backing_server,))
443
447
        self._original_vendor = ssh._ssh_vendor_manager._cached_ssh_vendor
444
448
        ssh._ssh_vendor_manager._cached_ssh_vendor = self._vendor
445
 
        # FIXME: the following block should certainly just be self._homedir =
446
 
        # osutils.getcwd() but that fails badly on Unix -- vila 20100224
447
449
        if sys.platform == 'win32':
448
450
            # Win32 needs to use the UNICODE api
449
451
            self._homedir = os.getcwdu()
 
452
            # Normalize the path or it will be wrongly escaped
 
453
            self._homedir = osutils.normpath(self._homedir)
450
454
        else:
451
 
            # But Linux SFTP servers should just deal in bytestreams
 
455
            # But unix SFTP servers should just deal in bytestreams
452
456
            self._homedir = os.getcwd()
453
457
        if self._server_homedir is None:
454
458
            self._server_homedir = self._homedir