about summary refs log tree commit diff stats
path: root/ranger/core
Commit message (Collapse)AuthorAgeFilesLines
...
* | Selection in multipane viewmode was misleadingtoonn2020-07-271-1/+18
| | | | | | | | | | | | | | | | | | | | | | 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
* | Fix unicode decode issues in py2toonn2020-07-241-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge branch 'cache-hash'toonn2020-07-081-8/+13
|\ \
| * | Fix check for Nonetoonn2020-07-081-2/+2
| | | | | | | | | | | | | | | `not inode` would fail if the inode happened to be 0. Switched from appending to prepending the inode to avoid appending to long strings.
| * | Add path to cache hashtoonn2020-07-081-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Drop st_dev from sha512_encodetoonn2020-07-071-2/+1
| | | | | | | | | | | | | | | | | | 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.
| * | Switch to packing fields for sha512_encodetoonn2020-07-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Fix indendation of sha512_encodetoonn2020-07-071-4/+5
| | |
| * | Hashlib requires objects implementing the buffer APItoonn2020-07-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Possible bug caught in reviewtoonn2020-07-051-1/+2
| | | | | | | | | | | | | | | | | | | | | Forgot to cast the `programs` generator to a list when dropping the unnecessary continuation. Miscellaneous alignment fixes.
* | | Drop explicit return Nonetoonn2020-07-051-1/+0
| | |
* | | Use in instead of multiple equality clausestoonn2020-07-051-5/+5
| | |
* | | Drop unnecessary comprehensionstoonn2020-07-051-2/+1
| | | | | | | | | | | | | | | It's unclear why these comprehensions were used, maybe as a way of cloning the lists? However, this does not seem necessary.
* | | Add local pylint disablestoonn2020-07-052-2/+3
| | |
* | | Disable spurious warning, name is obviously passedtoonn2020-07-051-0/+1
| | |
* | | Merge branch 'py-version-checks'toonn2020-07-054-12/+10
|\ \ \
| * | | Factor out python 3 version checkingtoonn2020-06-295-17/+15
| | |/ | |/| | | | | | | | | | | | | 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.
* | | Merge branch 'rc_macro_error'toonn2020-07-051-68/+40
|\ \ \
| * | | Add MacroDicttoonn2019-09-271-67/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Catch exceptions when resolving macros in rc.conftoonn2019-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | While parsing the settings in `rc.conf` `self.fm.thisfile` doesn't exist yet.
* | | | Merge branch 'cache-hash' [#2019]Wojciech Siewierski2020-07-051-11/+9
|\ \ \ \ | | |_|/ | |/| |
| * | | Switch from SHA-1 to SHA-512 for the cachetoonn2020-06-291-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Get rid of redundant codetoonn2020-06-291-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Drop file path from cache hashtoonn2020-06-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Include mtime in hash rather than comparingtoonn2020-06-291-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Allow equal mtime for cached previewstoonn2020-02-121-1/+1
| | |/ | |/| | | | | | | | | | | | | This allows the use of symlinks to prevent copying files to the cache. Fixes #1837
* | | Merge branch 'master' into py26-format-fixWojciech Siewierski2020-07-051-2/+6
|\ \ \
| * | | Revert "Revert "ranger <path> can select files""toonn2020-05-191-2/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix redundant whitespace in class definitiontoonn2020-06-271-1/+0
| | |
* | | Py26 does not support implicit format spec numberingtoonn2020-03-043-11/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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: - '"\{\}"' - '"\{:.*\}"' - "'\{\}'" - "'\{:.*\}'"
* | Add a newline before printing the exception for better readabilityWojciech Siewierski2020-01-271-1/+1
| |
* | Cleanup the temporary cache directory in the --clean modeWojciech Siewierski2020-01-271-0/+13
| |
* | Fix keyword argument assignment whitespacetoonn2019-12-301-1/+1
| |
* | Merge branch 'aRkedos-unique-file'toonn2019-12-301-0/+107
|\ \
| * | Fix hash_chunks generatortoonn2019-12-281-5/+7
| | |
| * | Add unique filter to filter_stacktoonn2019-12-241-26/+57
| | | | | | | | | | | | | | | Extracted helper function to `group_by_hash` for both duplicate and unique filters.
| * | Add duplicate filter to filter_stacktoonn2019-12-241-0/+41
| | |
| * | Extract hash_chunks to ranger.exttoonn2019-12-241-24/+7
| | | | | | | | | | | | `hash_chunks` now returns a hash even for 0 byte files.
| * | Change hash filter to match on hashtoonn2019-12-241-41/+41
| | | | | | | | | | | | | | | | | | 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.
| * | Replacing md5 with sha256arkedos2019-12-231-7/+2
| | |
| * | Replacing md5 with blake2barkedos2019-12-231-2/+7
| | |
| * | Added a filter for unique files by md5 hasharkedos2019-12-231-0/+50
| | |
* | | Merge branch 'laktak-paste_conflict'toonn2019-12-222-5/+12
|\ \ \
| * | | Merge branch 'master' into paste_conflictChristian Zangl2019-12-033-26/+9
| |\| |
| * | | Merge branch 'master' into paste_conflictChristian Zangl2019-10-042-1/+11
| |\ \ \
| * | | | set default make_safe_path=get_safe_pathChristian Zangl2019-07-212-2/+4
| | | | |
| * | | | Added a make_safe_path parameter to pasteChristian Zangl2019-07-182-25/+13
| | | | | | | | | | | | | | | | | | | | It allows you to specify your own function to generate the path for conflicting files.
| * | | | fix CopyLoaderChristian Zangl2019-07-141-1/+2
| | | | |
| * | | | Added a conflict parameter to the paste actionChristian Zangl2019-07-142-7/+23
| | |_|/ | |/| | | | | | | | | | It allows you to specify 'overwrite', 'rename', or 'rename_ext' (=default) in case of a file name conflict. This obsoletes the overwrite parameter.
* | | | Restore access to a preview cache in clean modetoonn2019-12-212-5/+2
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | `--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