Timeshift fails with misleading error message if timeshift location contains directory named "timeshift"

Issue #375 resolved
prl created an issue

In InfobarTimeshift.ptsCreateHardlink(), the code tries to create hard links to all files (and directories in the timeshift location (MENU>Setup>TV>Timeshift settings>Timeshift location) that satisfy the test filename.startswith("timeshift") and not filename.endswith((".sc", ".del", ".copy")) If there is a directory in the timeshift location whose name satisfies that test, the code tries to hard link the name to anther name. This will always fail.

The reason given in error message in this case is misleading: The file system used for timeshift must support hardlinks. That is not the cause. The cause in this case is that Unix file systems don't support hard links to directories.

Since /media/hdd normally contains a directory called "timeshift" (the default timeshift location", this error is triggered if the user sets the timeshift location to /media/hdd.

Reproduction steps

Ensure that /media/hdd/timeshift exists by using timeshift with the timeshift location set to the default value.

Change MENU>Setup>TV>Timeshift settings>Timeshift location to /media/hdd and restart the GUI or reboot.

The error popup:

Creating hard link to timeshift file failed! The file system used for timeshift must support hardlinks.

will appear as soon as timeshift starts after the restart/reboot.

The test above should include and not os.path.isdir(filename)

Comments (5)

  1. Peter Urbanec

    Fix Bug #375: Timeshift fails with misleading error message if timeshift location contains directory named "timeshift"

    In InfoBarTimeshift.ptsCreateHardlink() be more selective about linking directory entries to pts_livebuffer_* names, in particular only match if the filename starts with "timeshift." (rather than just "timeshift"), is 16 characters long and ends with alphanumerics as the template that creates the filename in lib/service/servicedvb.cpp specifies (mkstemp"timeshift.XXXXXX")).

    In other places that should match the "timeshift.XXXXXX" template, be similarly more selective about the match.

    → <<cset a0e8be8df382>>

  2. Peter Urbanec

    Fix Bug #375: Timeshift fails with misleading error message if timeshift location contains directory named "timeshift"

    Use POSIX Portable Filename character set to test for a filename compatible with mkstemp("...XXXXXX") substitutions for "XXXXXX" instead of the incorrect str.isalnum().

    Put timeshift filename tests into functions to isolate their implementation.

    Add os.path.isfile() tests to timeshift filename tests (replacing not os.path.isdir() in one case).

    Precalculate the timeshift filename paths to eliminate repeated "%" string formatting to derive the filename.

    → <<cset 666fcc084a63>>

  3. Log in to comment