Thanks to visit codestin.com
Credit goes to github.com

Skip to content

backup creates snapshot even if all source files could not be read #5667

Description

@E-Mans-Application

Output of restic version
restic 0.18.1 compiled with go1.25.1 on windows/amd64

What backend/service did you use to store the repository?
local

Problem description / Steps to reproduce

  • The source path is quoted (in the "backup" command)
  • Backslashes are not escaped and the path has a final backslash.

Correctly escaping the backslashes (or even just removing the trailing backslash) seems to fix the problem.

Example:
restic -r my_repo backup "F:\source\"
restic -r my_repo backup "F:\source\" --exclude-file "path\to\file"

Expected behavior
restic should either report that the command line is ill-formed, or report that the source does not exist before opening the repository.

I would expect something like:

F:\source" --exclude-file path does not exist, skipping
Fatal: all source directories/files do not exist

Actual behavior

restic -r my_repo backup "F:\source\"

no parent snapshot found, will read all files
[0:00] 100.00%  1 / 1 index files loaded
error: CreateFile F:\source": La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.

Files:           0 new,     0 changed,     0 unmodified
Dirs:            1 new,     0 changed,     0 unmodified
Added to the repository: 296 B (255 B stored)

processed 0 files, 0 B in 0:03
snapshot 6f42a439 saved
Warning: at least one source file could not be read

restic -r my_repo backup "F:\source\" --exclude-file "path\to\file"

no parent snapshot found, will read all files
[0:00] 100.00%  2 / 2 index files loaded
error: /F/source" --exclude-file path: CreateFile F:\source" --exclude-file path: La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.

Files:           0 new,     0 changed,     0 unmodified
Dirs:            1 new,     0 changed,     0 unmodified
Added to the repository: 0 B   (0 B   stored)

processed 0 files, 0 B in 0:02
snapshot 70790799 saved
Warning: at least one source file could not be read

Do you have any idea what may have caused this?
It looks like quoted paths are not parsed the same way by restic and by Powershell. This issue seems to be related to #5391.

Did restic help you today? Did it make you happy in any way?
Yes!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions