| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tabs only remembered the pointer of their browsercolumn. This lead to
erroneous rendering of the selection. By additionally keeping track of
the object which is pointed at we can restore the remembered pointer
even when sorting or (un)filtering completely invalidates the remembered
index.
Fixes #1511
Fixes #1995
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Python 2 implicitly decodes strings as ASCII or the system's default
encoding before encoding a string to bytes. This results in problems if
the string already contains characters outside the ASCII range (> 127).
I reintroduced this bug thinking encoding a string in both python 2 and
3 would be harmless.
Actually swapped the order of the inode and the path which should've
happened in the previous commit.
Fixes #2054
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | | |
`not inode` would fail if the inode happened to be 0. Switched from
appending to prepending the inode to avoid appending to long strings.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Without the `st_dev` the `st_ino` is no longer enough to uniquely
identify a file. A disadvantage of including the mtime in the hash is
that changed previews don't overwrite the old cache path so the cached
grows faster.
We use the path to the file to uniquely identify a device. We
concatenate it with the `st_ino` which ensures that replacing a file is
not enough to cause a collision. This is hashed to create the cache
path. Every time we check whether a preview is cached we verify that the
file being preview is as old or older than the cached preview.
The only differences from the original scheme are the algorithm (SHA-512
now), accepting previews of with the same mtime as the original file and
including the inode identifier in the hash.
|
| | |
| | |
| | |
| | |
| | |
| | | |
The device identifier is not necessarily consistent across reboots or
system crashes. Since we don't want to regenerate cached previews at
every reboot we can't rely on it.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The easy solution was to render the `st_dev, st_ino, st_mtime` to a
string and encode that before hashing.
This solution is more efficient because it packs the numbers as bytes
rather than the digits. Technically POSIX.1 does not specify an upper
limit on the sizes for these fields. I think it's safe to say none of
the major operating systems will use more than 8 bytes/64 bits any time
soon.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The hashes from python's hashlib only support objects that implement the
buffer API. Bytes objects (python 2 string, python 3 string.encode())
are such objects.
Passing fields from a stat object to a hash directly caused crashes
whenever ranger checked for an image preview.
Fixes #2032
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Forgot to cast the `programs` generator to a list when dropping the
unnecessary continuation.
Miscellaneous alignment fixes.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
It's unclear why these comprehensions were used, maybe as a way of
cloning the lists? However, this does not seem necessary.
|
| | | |
|
| | | |
|
|\ \ \ |
|
| | |/
| |/|
| | |
| | |
| | |
| | | |
We check whether we're running python 2 or 3 in many places. In some
places we do more specific version checks but with the new `PY3`
constant modeled after `six` this code should be slightly more readable.
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Macros are resolved for set commands. A contributor wanted to add a
setting for a date format string to be used in ranger's status bar. The
string they tried happened to include `%d` which is a valid ranger macro
for the name of `thisdir`. This attribute is not yet defined when ranger
is reading `rc.conf` and this uncaught exception would crash ranger.
To work around this we need to catch `AttributeError`s for values that
might not exist yet. To avoid the repetition that'd come with all these
try-catch statements that behavior has been encapsulated in a new
MacroDict. This is almost as easy to use as the regular python
dictionary used previously. The only difference being that we need to
wrap values that might cause problems in a python `lambda`, though it
doesn't do any harm to wrap values that can't raise exceptions.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
While parsing the settings in `rc.conf` `self.fm.thisfile` doesn't exist
yet.
|
|\ \ \ \
| | |_|/
| |/| | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The performance hit is negligible. File name lengths are usually 255
bytes at minimum (except for FAT, but a SHA-1 digest is truncated too).
An attack on the ranger cache based on hash collisions is probably
fairly unlikely but preventing it is almost free.
This should be merged soon after #1838 because both these PRs change the
cache hashes and can therefore cause generation of previews that have
been cached before, wasting some disk space.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The python version dependence is gone because we no longer want to hash
the path.
We've been doubling up `os.path.join` calls for a long time, that's
silly, let's just not.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Because we include the device identifier and the inode in cache hashes
now we no longer need the path to the file. Files are already more
uniquely identified (if the path was reused for another file with an
acceptable mtime there used to be a collision).
A small benefit is that hardlinked and symlinked files should now only
require a single cached preview.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Comparing the mtimes of a file and a cached preview or including the
mtime in the preview's hash are almost equivalent except this way we
don't need to find out the preview's mtime.
We include the device identifier and the inode in the hash, this makes
sure duplicate filenames don't cause erroneous hits in the cache.
|
| | |/
| |/|
| | |
| | |
| | |
| | | |
This allows the use of symlinks to prevent copying files to the cache.
Fixes #1837
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I can't reproduce the problems with <Right> and I don't see anything in
the commit that could've caused them in the first place tbh. The issue
this introduces keeps coming up so I'm verting the original change.
Fixes #1655
Fixes #1386
This reverts commit 11549e2c0c73a8a0bb543801af4e134b3e076095.
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As FichteFoll rightly pointed outin #1840, python 2.6 did *not* support
implicit format spec numbering for positional arguments.
This commit brings the code back in line with our promise that it is
compatible with python 2.6.
I used the following patterns to grep for occurences:
- '"\{\}"'
- '"\{:.*\}"'
- "'\{\}'"
- "'\{:.*\}'"
|
| | |
|
| | |
|
| | |
|
|\ \ |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Extracted helper function to `group_by_hash` for both duplicate and
unique filters.
|
| | | |
|
| | |
| | |
| | |
| | | |
`hash_chunks` now returns a hash even for 0 byte files.
|
| | |
| | |
| | |
| | |
| | |
| | | |
The `hash` filter for `filter_stack` requires a path as argument,
defaulting to the currently selected file. It filters out any files or
directories with a different hash.
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \ |
|
| |\| | |
|
| |\ \ \ |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
It allows you to specify your own function to generate the path for conflicting files.
|
| | | | | |
|
| | |_|/
| |/| |
| | | |
| | | | |
It allows you to specify 'overwrite', 'rename', or 'rename_ext' (=default) in case of a file name conflict. This obsoletes the overwrite parameter.
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`--clean` is incredibly useful when testing contributions to `scope.sh`
among other things but some (most?) previews require the cache to
function.
As a compromise every invocation using `--clean` will create a temporary
cache directory.
Fixes #1783
|