Hello community, here is the log from the commit of package feh for openSUSE:Factory checked in at 2019-01-10 15:22:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/feh (Old) and /work/SRC/openSUSE:Factory/.feh.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "feh" Thu Jan 10 15:22:29 2019 rev:30 rq:663765 version:3.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/feh/feh.changes 2018-11-26 10:28:30.961153974 +0100 +++ /work/SRC/openSUSE:Factory/.feh.new.28833/feh.changes 2019-01-10 15:22:48.786363238 +0100 @@ -1,0 +2,7 @@ +Sun Jan 06 04:19:38 UTC 2019 - s...@suspend.net + +- update to 3.1.1 + * Decrease libcurl timeout from indefinite to 30m + * Handle SIGINT/SIGTERM/SIGQUIT signals when loading via libcurl + +------------------------------------------------------------------- Old: ---- feh-3.0.tar.bz2 feh-3.0.tar.bz2.asc New: ---- feh-3.1.1.tar.bz2 feh-3.1.1.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ feh.spec ++++++ --- /var/tmp/diff_new_pack.Oibevq/_old 2019-01-10 15:22:49.326362678 +0100 +++ /var/tmp/diff_new_pack.Oibevq/_new 2019-01-10 15:22:49.330362675 +0100 @@ -1,7 +1,7 @@ # # spec file for package feh # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: feh -Version: 3.0 +Version: 3.1.1 Release: 0 Summary: X11 image viewer License: MIT AND LGPL-2.0-or-later ++++++ feh-3.0.tar.bz2 -> feh-3.1.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/ChangeLog new/feh-3.1.1/ChangeLog --- old/feh-3.0/ChangeLog 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/ChangeLog 2018-12-07 22:56:49.000000000 +0100 @@ -1,3 +1,31 @@ +Fri, 07 Dec 2018 22:51:15 +0100 Daniel Friesel <derf+...@finalrewind.org> + +* Release v3.1.1 + * Decrease libcurl timeout from indefinite to 30 minutes. This should + be sufficient even for use cases with unusually high timeouts (just in + case anyone wants to do interplanetary slideshows), while at the same + time avoiding stalls in unattended slideshows when encountering + temporary network issues. + * Handle SIGINT/SIGTERM/SIGQUIT signals while loading images using libcurl. + Previously, signals were ignored during a (possibly slow) libcurl + network transfer, which was not intended behaviour. + +Wed, 21 Nov 2018 19:37:34 +0100 Daniel Friesel <derf+...@finalrewind.org> + +* Release v3.1 + * Running "feh --start-at .../file.jpg" without specifying images, + directories or filelists to load is now equivalent to running + "feh --start-at .../file.jpg $(dirname .../file.jpg)". This way, it is + possible to view a specific file and browse all other files in the + corresponding directory. This is especially useful when starting feh + from file managers. + * Introduce fuzzy matching in --start-at: If the specified path is not + found in the file list, feh now resorts to comparing basenames (i.e., + file names without the directory components). This allows calls + like "feh --start-at cat.jpg ~/Pictures", which led to a file not found + error in previous versions. + * Respect -j / --output-dir when using save_image or save_filelist actions. + Fri, 09 Nov 2018 17:17:15 +0100 Daniel Friesel <derf+...@finalrewind.org> * Release v3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/README.md new/feh-3.1.1/README.md --- old/feh-3.0/README.md 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/README.md 2018-12-07 22:56:49.000000000 +0100 @@ -1,12 +1,21 @@ [![build status](https://travis-ci.org/derf/feh.svg?branch=master)](https://travis-ci.org/derf/feh) -# feh -Imlib2 based image viewer +Feh – Image viewer and Cataloguer --- - * http://feh.finalrewind.org/ - * http://linuxbrit.co.uk/feh/ - * #feh on irc.oftc.net +feh is a light-weight, configurable and versatile image viewer. +It is aimed at command line users, but can also be started from graphical file +managers. Apart from viewing images, it can compile text and thumbnail +listings, show (un)loadable files, set X11 backgrounds, and more. + +Features include filelists, various image sorting modes, custom action scripts, +and image captions. feh can be controlled by configurable keyboard and mouse +shortcuts, terminal input and signals. When no file arguments or filelists are +specified, feh displays all files in the current directory. + +For more information, please refer to the [feh +website](https://feh.finalrewind.org/) or read the [feh +manual](https://man.finalrewind.org/1/feh/). Dependencies --- @@ -22,11 +31,10 @@ * libexif-dev * libexif12 -Recommended +Recommended Binaries --- - * jpegtran (supplied by the jpeg library, for lossless image rotation) - * convert (supplied by ImageMagick, can be used to load unsupported formats) + * convert (supplied by ImageMagick, can be used to load image formats not supported by Imlib2) Installation --- @@ -46,24 +54,23 @@ **Explanation:** feh ships some icons and an X11 desktop entry, which allow it to be used from file managers, desktop menus and similar. However, installing -icons to /usr/local/share/... does not seem to work reliable in all cases. +icons to /usr/local/share/... does not seem to work reliably. Because of this, when using "make install app=1", feh will install its icons to /usr/share/..., even though they technically belong into /usr/local. - -ZSH Completion for feh is available [here](http://git.finalrewind.org/zsh/plain/etc/completions/_feh) +[ZSH completion for +feh](https://git.finalrewind.org/zsh/plain/etc/completions/_feh) is also +available. Make flags ---------- -Flags can be used to control the build and installation process. - -e.g. +feh's build process uses make flags to enable/disable optional features and +fine-tune the build and installation process. They can be passed as **make** +arguments or set as environment variables, like so: ```bash make flag=bool -``` -```bash make install flag=bool ``` or @@ -72,14 +79,13 @@ make && make install ``` -For example, `make xinerama=0 debug=1` will disable Xinerama support and produce a debug build. - -Available flags are: +The following flags are respected by the makefile. A default value of **1** +indicates that the corresponding feature is enabled by default. | Flag | Default value | Description | | :--- | :---: | :--- | | app | 0 | install icons to /usr/share, regardless of `DESTDIR` and `PREFIX`, and call gtk-update-icon-cache afterwards | -| curl | 1 | use libcurl to view http:// and similar images | +| curl | 1 | use libcurl to view https:// and similar images | | debug | 0 | debug build, enables `--debug` | | exif | 0 | Builtin EXIF tag display support | | help | 0 | include help text (refers to the manpage otherwise) | @@ -87,19 +93,19 @@ | verscmp | 1 | Support naturing sorting (`--version-sort`). Requires a GNU-compatible libc exposing `strverscmp` | | xinerama | 1 | Support Xinerama/XRandR multiscreen setups | -So, by default **libcurl**, **verscmp**, and **Xinerama** are enabled. -All other flags are disabled. +For example, `make xinerama=0 debug=1` will disable Xinerama support and +produce a debug build; libcurl and natural sorting support will remain enabled. Additionally, the standard variables `PREFIX` and `DESTDIR` are supported. -**PREFIX _(default: /usr)_** controls where the application and its data files +**PREFIX _(default: /usr/local)_** controls where the application and its data files will be installed. It must be set both during `make` and `make install`. **DESTDIR _(default: empty)_** sets the installation root during "make install". It is mostly useful for package maintainers. -**Note:** config.mk is designed so that in most cases, you can set environment -variables instead of editing it. E.g.: +**Note:** Defaults are specified in `config.mk`. It is designed so that in most +cases, you can set environment variables instead of editing it. E.g.: ```bash CFLAGS='-g -Os' make @@ -114,26 +120,29 @@ Testing (non-X) --------------- + +The non-X11 parts of feh can be automatically tested by running + ```bash $ make test ``` +This requires **perl >= 5.10** and the perl module `Test::Command`. Tests are +non-interactive and do not require a running X11, so they can safely be run on +a headless buildserver. -Requires **perl >= 5.10** with `Test::Command`. The tests are non-interactive and -work without X, so they can safely be run even on a headless buildserver. - - -Testing (X) ------------ -Requires - * import (usually supplied by imagemagick) - * perl >= 5.10 with GD, Test::More and X11::GUITest - * twm - * Xephyr +Contributing +--- -```bash -$ make test-x11 -``` +Bugfixes are always welcome, just open a pull request :) -**_Be aware that this is quite experimental, so far the X-tests have only been -run on one machine. So they may or may not work for you._** +Before proposing a new feature, please consider the scope of feh: It is an +image viewer and cataloguer, not an image editor or similar. Also, its option +list is already pretty long. Please discuss your ideas in a feature request +before opening a pull request in this case. + +Please keep in mind that feh's options, key bindings and format specifiers are +documented in two different places: The manual (man/feh.pre) and the help text +(src/help.raw). Although the help is not compiled in by default, it should be +kept up-to-date. On space-constrained embedded systems, it may be more useful +than the (significantly larger) man page. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/config.mk new/feh-3.1.1/config.mk --- old/feh-3.0/config.mk 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/config.mk 2018-12-07 22:56:49.000000000 +0100 @@ -1,5 +1,5 @@ PACKAGE ?= feh -VERSION ?= 3.0 +VERSION ?= 3.1.1 app ?= 0 curl ?= 1 @@ -86,7 +86,7 @@ MAN_EXIF = disabled endif -MAN_DATE ?= November 09, 2018 +MAN_DATE ?= December 07, 2018 # Uncomment this to use dmalloc #CFLAGS += -DWITH_DMALLOC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/man/feh.pre new/feh-3.1.1/man/feh.pre --- old/feh-3.0/man/feh.pre 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/man/feh.pre 2018-12-07 22:56:49.000000000 +0100 @@ -32,27 +32,24 @@ .Sh DESCRIPTION . .Nm -is a mode-based image viewer. -It is especially aimed at command line users who need a fast image viewer -without huge GUI dependencies, though it can also be started by -.Pq graphical -file managers to view an image. -When no file arguments or filelists are specified, -.Nm -displays all files in the current directory. +is a light-weight, configurable and versatile image viewer. +It is aimed at command line users, but can also be started from graphical file +managers. +Apart from viewing images, it can compile text and thumbnail +listings, show (un)loadable files, set X11 backgrounds, and more. . .Pp . +Features include filelists, various image sorting modes, custom action scripts, +and image captions. .Nm -supports filelists, various image sorting modes, image captions, HTTP and more. -It can be controlled by configurable keyboard and mouse shortcuts, terminal +can be controlled by configurable keyboard and mouse shortcuts, terminal input and signals. -. -.Pp -. -In many desktop environments, +When no file arguments or filelists are specified and +.Cm --start-at +is not used, .Nm -can also be used as wallpaper setter. +displays all files in the current directory. . .Pp . @@ -259,6 +256,22 @@ the caption will be looked for in .Qq images/captions/foo.jpg.txt . . +.It Cm --conversion-timeout Ar timeout +. +.Nm +can use ImageMagick to try converting unloadable files into a supportad +file format. +As this can take a long time, it is disabled by default. +Set +.Ar timeout +to a non-negative value to enable it. +A positive value +specifies after how many seconds conversion attempts should be aborted, +zero causes +.Nm +to try indefinitely. +Negative values restore the default by disabling conversion altogether. +. .It Cm -L , --customlist Ar format . Don't display images, print image info according to @@ -450,6 +463,12 @@ the output will not be displayed by default, but has to be enabled by the toggle_info key. . +.It Cm --insecure +. +When viewing files with HTTPS, this option disables all certificate checks. It +allows images on sites with self-signed or expired certificates to be opened, +but is no more secure than plain HTTP. +. .It Cm -k , --keep-http . When viewing files using HTTP, @@ -460,12 +479,6 @@ .Cm --output-dir , or in the current working directory. . -.It Cm --insecure -. -When viewing files with HTTPS, this option disables all certificate checks. It -allows images on sites with self-signed or expired certificates to be opened, -but is no more secure than plain HTTP. -. .It Cm --keep-zoom-vp . When switching images, keep zoom and viewport settings @@ -485,22 +498,6 @@ Just print out their names if imlib2 can successfully load them. Returns false if at least one image failed to load. . -.It Cm --conversion-timeout Ar timeout -. -.Nm -can use ImageMagick to try converting unloadable files into a supportad -file format. -As this can take a long time, it is disabled by default. -Set -.Ar timeout -to a non-negative value to enable it. -A positive value -specifies after how many seconds conversion attempts should be aborted, -zero causes -.Nm -to try indefinitely. -Negative values restore the default by disabling conversion altogether. -. .It Cm --max-dimension Ar width No x Ar height . Only show images with width <= @@ -599,7 +596,9 @@ . Save files to .Ar directory -.Pq only useful with -k . +when using +.Cm --keep-http +or the save_image command. By default, files are saved in the current working directory. . .It Cm -p , --preload @@ -731,21 +730,30 @@ . Start the filelist at .Ar filename . -. -Note that at the moment, -.Ar filename -must match an -.Pq expanded -path in the filelist. -So, if the file to be matched is passed via an absolute path in the filelist, +If no other files or filelists were specifed on the commandline, +.Nm +will first load all files from the directory in which .Ar filename -must be an absolute path. -If the file is passed via a relative path, +resides. +This way, it's possible to look at a specific image and use the next / prev +keys to browse through the directory. +See +.Sx USAGE EXAMPLES +for examples. +. +.Pp +. +Note: If you use relative paths in your filelist, .Ar filename -must be an identical relative path. -This is a known issue. -See also -.Sx USAGE EXAMPLES . +should also be a relative path. +If you use absolute paths, it should also be an absolute path. +. +If +.Nm +cannot find an exact match, it will compare basenames +.Pq filenames without the directory suffix . +This may lead to mismatches if several files in your filelist +have the same basename. . .It Cm -T , --theme Ar theme . @@ -1921,14 +1929,14 @@ View all images in ~/Pictures and below, sorted by width, move an image to ~/image/image_name when enter is pressed . -.It feh --start-at ./foo.jpg \&. +.It feh --start-at ~/Pictures/foo.jpg . -View all images in the current directory, starting with foo.jpg. +View all images in ~/Pictures, starting with foo.jpg. All other images are still in the slideshow and can be viewed normally . -.It feh --start-at foo.jpg * +.It feh --start-at ~/Pictures/foo.jpg ~/Pictures . -Same as above +Same as above. . .It feh --info \&"exifgrep '\&(Model\&|DateTimeOriginal\&|FNumber\&|ISO\&|Flash\&)' %F \&| cut -d \&. -f 4-\&" \&. . @@ -1964,7 +1972,7 @@ It is $MAN_CURL$ in this build . . -.Sh BUGS +.Sh KNOWN BUGS . On systems with giflib 5.1.2, .Nm @@ -1984,6 +1992,12 @@ . .Pp . +While loading images using libcurl, +.Nm +will not react to key or mouse actions. +. +.Pp +. Thumbnail mode is somewhat inefficient, and because of that not nearly as fast as it could be. . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/share/applications/feh.pre new/feh-3.1.1/share/applications/feh.pre --- old/feh-3.0/share/applications/feh.pre 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/share/applications/feh.pre 2018-12-07 22:56:49.000000000 +0100 @@ -4,7 +4,7 @@ GenericName=Image viewer GenericName[en_US]=Image viewer Comment=Fast Imlib2-based Image Viewer -Exec=feh %U +Exec=feh --start-at %f Terminal=false Type=Application Icon=feh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/deps.mk new/feh-3.1.1/src/deps.mk --- old/feh-3.0/src/deps.mk 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/deps.mk 2018-12-07 22:56:49.000000000 +0100 @@ -5,7 +5,7 @@ gib_style.h structs.h menu.h utils.h getopt.h debug.h filelist.o: filelist.c feh.h gib_hash.h gib_list.h gib_imlib.h \ gib_style.h structs.h menu.h utils.h getopt.h debug.h filelist.h \ - options.h + signals.h options.h getopt.o: getopt.c getopt1.o: getopt1.c getopt.h gib_hash.o: gib_hash.c gib_hash.h gib_list.h utils.h debug.h @@ -14,8 +14,8 @@ gib_list.o: gib_list.c gib_list.h utils.h debug.h gib_style.o: gib_style.c gib_style.h gib_list.h utils.h debug.h imlib.o: imlib.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \ - structs.h menu.h utils.h getopt.h debug.h filelist.h winwidget.h \ - options.h + structs.h menu.h utils.h getopt.h debug.h filelist.h signals.h \ + winwidget.h options.h index.o: index.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \ structs.h menu.h utils.h getopt.h debug.h filelist.h winwidget.h \ options.h index.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/filelist.c new/feh-3.1.1/src/filelist.c --- old/feh-3.0/src/filelist.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/filelist.c 2018-12-07 22:56:49.000000000 +0100 @@ -30,6 +30,7 @@ #include "feh.h" #include "filelist.h" +#include "signals.h" #include "options.h" gib_list *filelist = NULL; @@ -37,7 +38,6 @@ int filelist_len = 0; gib_list *current_file = NULL; extern int errno; -extern int sig_exit; /* exit flag from signal handler */ static gib_list *rm_filelist = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/imlib.c new/feh-3.1.1/src/imlib.c --- old/feh-3.0/src/imlib.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/imlib.c 2018-12-07 22:56:49.000000000 +0100 @@ -26,6 +26,7 @@ #include "feh.h" #include "filelist.h" +#include "signals.h" #include "winwidget.h" #include "options.h" @@ -541,6 +542,24 @@ #ifdef HAVE_LIBCURL +static int curl_quit_function(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) +{ + // ignore "unused parameter" warnings + (void)clientp; + (void)dltotal; + (void)dlnow; + (void)ultotal; + (void)ulnow; + if (sig_exit) { + /* + * The user wants to quit feh. Tell libcurl to abort the transfer and + * return control to the main loop, where we can quit gracefully. + */ + return 1; + } + return 0; +} + static char *feh_http_load_image(char *url) { CURL *curl; @@ -583,12 +602,21 @@ #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); #endif + /* + * Do not allow requests to take longer than 30 minutes. + * This should be sufficiently high to accomodate use cases with + * unusually high latencies, while at the sime time avoiding + * feh hanging indefinitely in unattended slideshows. + */ + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1800); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEDATA, sfp); ebuff = emalloc(CURL_ERROR_SIZE); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, ebuff); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curl_quit_function); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); if (opt.insecure_ssl) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); @@ -601,7 +629,9 @@ res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res != CURLE_OK) { - weprintf("open url: %s", ebuff); + if (res != CURLE_ABORTED_BY_CALLBACK) { + weprintf("open url: %s", ebuff); + } unlink(sfn); close(fd); free(sfn); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/options.c new/feh-3.1.1/src/options.c --- old/feh-3.0/src/options.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/options.c 2018-12-07 22:56:49.000000000 +0100 @@ -812,6 +812,19 @@ add_file_to_filelist_recursively(argv[optind++], FILELIST_FIRST); } } + else if (finalrun && !opt.filelistfile && !opt.bgmode) { + if (opt.start_list_at && !path_is_url(opt.start_list_at) && strrchr(opt.start_list_at, '/')) { + char *target_directory = estrdup(opt.start_list_at); + char *filename_start = strrchr(target_directory, '/'); + if (filename_start) { + *filename_start = '\0'; + } + add_file_to_filelist_recursively(target_directory, FILELIST_FIRST); + free(target_directory); + } else { + add_file_to_filelist_recursively(".", FILELIST_FIRST); + } + } else if (finalrun && !opt.filelistfile && !opt.bgmode) add_file_to_filelist_recursively(".", FILELIST_FIRST); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/signals.c new/feh-3.1.1/src/signals.c --- old/feh-3.0/src/signals.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/signals.c 2018-12-07 22:56:49.000000000 +0100 @@ -28,7 +28,7 @@ #include "options.h" void feh_handle_signal(int); -int sig_exit = 0; +volatile int sig_exit = 0; void setup_signal_handlers() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/signals.h new/feh-3.1.1/src/signals.h --- old/feh-3.0/src/signals.h 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/signals.h 2018-12-07 22:56:49.000000000 +0100 @@ -27,5 +27,5 @@ #define SIGNALS_H void setup_signal_handlers(); -extern int sig_exit; +volatile extern int sig_exit; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/slideshow.c new/feh-3.1.1/src/slideshow.c --- old/feh-3.0/src/slideshow.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/slideshow.c 2018-12-07 22:56:49.000000000 +0100 @@ -37,6 +37,24 @@ int success = 0; gib_list *l = filelist, *last = NULL; + /* + * In theory, --start-at FILENAME is simple: Look for a file called + * FILENAME, start the filelist there, done. + * + * In practice, there are cases where this isn't sufficient. For instance, + * a user running 'feh --start-at hello.jpg /tmp' will expect feh to start + * at /tmp/hello.jpg, as if they had used + * 'feh --start-at /tmp/hello.jpg /tmp'. Similarly, XDG Desktop files + * may lead to the invocation 'feh --start-at /tmp/hello.jpg .' in /tmp, + * expecting the behaviour of 'feh --start-at ./hello.jpg .'. + * + * Since a good user experience is not about being technically correct, but + * about delivering the expected behaviour, we do some fuzzy matching + * here. In the worst case, this will cause --start-at to start at the + * wrong file. + */ + + // Try finding an exact filename match first for (; l && opt.start_list_at; l = l->next) { if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) { opt.start_list_at = NULL; @@ -44,6 +62,34 @@ } } + /* + * If it didn't work (opt.start_list_at is still set): Fall back to + * comparing just the filenames without directory prefixes. This may lead + * to false positives, but for now that's just the way it is. + */ + if (opt.start_list_at) { + char *current_filename; + char *start_at_filename = strrchr(opt.start_list_at, '/'); + if (start_at_filename) { + start_at_filename++; // We only care about the part after the '/' + } else { + start_at_filename = opt.start_list_at; + } + for (l = filelist; l && opt.start_list_at; l = l->next) { + current_filename = strrchr(FEH_FILE(l->data)->filename, '/'); + if (current_filename) { + current_filename++; // We only care about the part after the '/' + } else { + current_filename = FEH_FILE(l->data)->filename; + } + if (!strcmp(start_at_filename, current_filename)) { + opt.start_list_at = NULL; + break; + } + } + } + + // If that didn't work either, we're out of luck. if (opt.start_list_at) eprintf("--start-at %s: File not found in filelist", opt.start_list_at); @@ -615,16 +661,24 @@ { char *tmpname; Imlib_Load_Error err; + char *base_dir = ""; + if (opt.output_dir) { + base_dir = estrjoin("", opt.output_dir, "/", NULL); + } if (win->file) { - tmpname = feh_unique_filename("", FEH_FILE(win->file->data)->name); + tmpname = feh_unique_filename(base_dir, FEH_FILE(win->file->data)->name); } else if (mode) { char *tmp; tmp = estrjoin(".", mode, "png", NULL); - tmpname = feh_unique_filename("", tmp); + tmpname = feh_unique_filename(base_dir, tmp); free(tmp); } else { - tmpname = feh_unique_filename("", "noname.png"); + tmpname = feh_unique_filename(base_dir, "noname.png"); + } + + if (opt.output_dir) { + free(base_dir); } if (opt.verbose) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feh-3.0/src/utils.c new/feh-3.1.1/src/utils.c --- old/feh-3.0/src/utils.c 2018-11-09 17:17:58.000000000 +0100 +++ new/feh-3.1.1/src/utils.c 2018-12-07 22:56:49.000000000 +0100 @@ -152,6 +152,7 @@ return 0; } +/* Note: path must end with a trailing / or be an empty string */ /* free the result please */ char *feh_unique_filename(char *path, char *basename) {