bugranger - Bugs: bug #40771, Crash when searching in a...

 
 

bug #40771: Crash when searching in a directory where contents have yet to load

Submitter:  None
Submitted:  Sun 01 Dec 2013 11:00:49 PM UTC
   
 
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 01 Dec 2013 11:00:49 PM UTC, original submission:  

How to reproduce:

1. Navigate to a big directory. For example, I am able to reproduce this on Ranger's source code directory (7200RPM hard drive, not SSD)
2. Before the directory contents finish loading, or anything is displayed, hit `/` or your equivalent search command.
3. Start typing something (I think - though the crash might happen before you do that. I can't reproduce it if I think too hard about the commands, because every millisecond counts in reproducing this bug)
4. Crash dump!

Here's the crash log:

ranger version: 1.6.1, executed with python 3.3.3
Locale: en_US.UTF-8
Current file: None
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/ranger/core/main.py", line 133, in main
    fm.loop()
  File "/usr/lib/python3.3/site-packages/ranger/core/fm.py", line 314, in loop
    ui.handle_input()
  File "/usr/lib/python3.3/site-packages/ranger/gui/ui.py", line 208, in handle_input
    self.handle_key(key)
  File "/usr/lib/python3.3/site-packages/ranger/gui/ui.py", line 142, in handle_key
    elif not DisplayableContainer.press(self, key):
  File "/usr/lib/python3.3/site-packages/ranger/gui/displayable.py", line 261, in press
    focused_obj.press(key)
  File "/usr/lib/python3.3/site-packages/ranger/gui/widgets/console.py", line 173, in press
    self.type_key(key)
  File "/usr/lib/python3.3/site-packages/ranger/gui/widgets/console.py", line 202, in type_key
    self.on_line_change()
  File "/usr/lib/python3.3/site-packages/ranger/gui/widgets/console.py", line 418, in on_line_change
    if cmd and cmd.quick():
  File "/usr/lib/python3.3/site-packages/ranger/api/commands.py", line 380, in quick
    return self._make_cmd().quick()
  File "$XDG_CONFIG_HOME/ranger/commands.py", line 1052, in quick
    if self._count(move=asyoutype) == 1 and self.AUTO_OPEN in self.flags:
  File "$XDG_CONFIG_HOME/ranger/commands.py", line 1117, in _count
    deq = deque(cwd.files)
TypeError: 'NoneType' object is not iterable

ranger crashed.  Please report this traceback at:
http://savannah.nongnu.org/bugs/?group=ranger&func=additem

For reference, here are the relevant functions in commands.py:

    ...

    def quick(self):
        asyoutype = self.AS_YOU_TYPE in self.flags
        if self.FILTER in self.flags:
            self.fm.thisdir.temporary_filter = self._build_regex()
        if self.PERM_FILTER in self.flags and asyoutype:
            self.fm.thisdir.filter = self._build_regex()
        if self.FILTER in self.flags or self.PERM_FILTER in self.flags:
            self.fm.thisdir.refilter()
        if self._count(move=asyoutype) == 1 and self.AUTO_OPEN in self.flags:
            return True
        return False

    ...

    def _count(self, move=False, offset=0):
        count   = 0
        cwd     = self.fm.thisdir
        pattern = self.pattern

        if not pattern:
            return 0
        if pattern == '.':
            return 0
        if pattern == '..':
            return 1

        deq = deque(cwd.files)
        deq.rotate(-cwd.pointer - offset)
        i = offset
        regex = self._build_regex()
        for fsobj in deq:
            if regex.search(fsobj.basename):
                count += 1
                if move and count == 1:
                    cwd.move(to=(cwd.pointer + i) % len(cwd.files))
                    self.fm.thisfile = cwd.pointed_obj
            if count > 1:
                return count
            i += 1

        return count == 1

    ...

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-d3ae.
Corresponding source code