Skip to content

Timestamp is not restored correctly on file paths longer than 256 chars in Windows #1843

@vringel-hms

Description

@vringel-hms

Output of restic version

restic 0.9.1 compiled with go1.10.3 on windows/amd64

How did you run restic exactly?

set RESTIC_PASSWORD=<..>
set RESTIC_REPOSITORY=H:\restic_test
restic restore latest --target c:\Tools\restic\restore --include restic_backup.ps1

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

Mapped Windows file share.
The file restic_backup.ps1 was backed up from a path longer than 256 chars.

Expected behavior

File will be restored with correct timestamp

Actual behavior

File was restored, but the timestamp of file is set to the restore time/date. Restic throws the following error:
ignoring error for \c\Entwicklung\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\restic_backup.ps1: RestoreTimestamps: UtimesNano: The system cannot find the path specified.

After adding the prefix "\\?\" to the path in the --target option, the restore works like expected. The timestamp of the file will be restored correctly.

Steps to reproduce the behavior

Backup a file with a pathname longer than 256 chars and try to restore it using a target directory without using the "\\?\" prefix.

Do you have any idea what may have caused this?

This problem may be a similar problem like the one described in issue #576.

Do you have an idea how to solve the issue?

If available, use a function, that supports pathnames longer than 256 chars to change the timestamp of
restored file.

Did restic help you or made you happy in any way?

Yes, indeed. Restic is an easy to use, powerful backup tool, and even if there are some small issues, it already works very good.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions