Unable to extract files by --path in certain locales/charmaps #1283

Open
opened 2026-03-09 22:56:03 +00:00 by hop · 1 comment

What I'm trying to do and why

After backing up a file who's filename contains invalid UTF-8 byte sequences, I can't extract it by --path while in a non UTF-8 locale.

Steps to reproduce

/tmp/scratch$ LC_CTYPE=de_AT.utf8
/tmp/scratch$ cat > config.yaml <<EOF
source_directories:
- /tmp/scratch/source
repositories:
- path: /tmp/scratch/repo
keep_within: 1H
EOF

/tmp/scratch$ mkdir source
/tmp/scratch$ touch source/$'\326'sterreich
/tmp/scratch$ borgmatic -c config.yaml repo-create -e none
/tmp/scratch$ borgmatic -c config.yaml
/tmp/scratch$ mkdir dest
/tmp/scratch$ borgmatic -c config.yaml extract --archive latest --destination dest --strip-components 3 --path tmp/scratch/source/$'\326'sterreich
/tmp/scratch$ ls dest/
''$'\326''sterreich'
/tmp/scratch$ LC_CTYPE=de_AT.iso8859-1 borgmatic -c config.yaml extract --archive latest --destination dest --strip-components 3 --path tmp/scratch/source/$'\326'sterreich
Include pattern 'tmp/scratch/source/�sterreich' never matched.
Treating exit code 101 as an error, as per borgmatic defaults
/tmp/scratch/repo: Error running actions for repository
/tmp/scratch/repo: Command 'borg extract --log-json --strip-components 3 /tmp/scratch/repo::pvsvie01a2-2026-03-09T23:42:31.104211 tmp/scratch/source/�sterreich' returned non-zero exit status 101.
/tmp/scratch/config.yaml: Error running configuration
/tmp/scratch/config.yaml: An error occurred

summary:
An error occurred
Error running actions for repository
Include pattern 'tmp/scratch/source/�sterreich' never matched.
Command 'borg extract --log-json --strip-components 3 /tmp/scratch/repo::pvsvie01a2-2026-03-09T23:42:31.104211 tmp/scratch/source/�sterreich' returned non-zero exit status 101.
Error running configuration

Need some help? https://torsion.org/borgmatic/#issues

Actual behavior

No response

Expected behavior

Extract the file, don't use the replacement character for "invalid" bytes.

Other notes / implementation ideas

No response

borgmatic version

2.1.3

borgmatic installation method

No response

Borg version

borg 1.4.3

Python version

Python 3.14.3

Database version (if applicable)

No response

Operating system and version

Linux / ext4 filesystem

### What I'm trying to do and why After backing up a file who's filename contains invalid UTF-8 byte sequences, I can't extract it by `--path` while in a non UTF-8 locale. ### Steps to reproduce /tmp/scratch$ LC_CTYPE=de_AT.utf8 /tmp/scratch$ cat > config.yaml <<EOF source_directories: - /tmp/scratch/source repositories: - path: /tmp/scratch/repo keep_within: 1H EOF /tmp/scratch$ mkdir source /tmp/scratch$ touch source/$'\326'sterreich /tmp/scratch$ borgmatic -c config.yaml repo-create -e none /tmp/scratch$ borgmatic -c config.yaml /tmp/scratch$ mkdir dest /tmp/scratch$ borgmatic -c config.yaml extract --archive latest --destination dest --strip-components 3 --path tmp/scratch/source/$'\326'sterreich /tmp/scratch$ ls dest/ ''$'\326''sterreich' /tmp/scratch$ LC_CTYPE=de_AT.iso8859-1 borgmatic -c config.yaml extract --archive latest --destination dest --strip-components 3 --path tmp/scratch/source/$'\326'sterreich Include pattern 'tmp/scratch/source/�sterreich' never matched. Treating exit code 101 as an error, as per borgmatic defaults /tmp/scratch/repo: Error running actions for repository /tmp/scratch/repo: Command 'borg extract --log-json --strip-components 3 /tmp/scratch/repo::pvsvie01a2-2026-03-09T23:42:31.104211 tmp/scratch/source/�sterreich' returned non-zero exit status 101. /tmp/scratch/config.yaml: Error running configuration /tmp/scratch/config.yaml: An error occurred summary: An error occurred Error running actions for repository Include pattern 'tmp/scratch/source/�sterreich' never matched. Command 'borg extract --log-json --strip-components 3 /tmp/scratch/repo::pvsvie01a2-2026-03-09T23:42:31.104211 tmp/scratch/source/�sterreich' returned non-zero exit status 101. Error running configuration Need some help? https://torsion.org/borgmatic/#issues ### Actual behavior _No response_ ### Expected behavior Extract the file, don't use the replacement character for "invalid" bytes. ### Other notes / implementation ideas _No response_ ### borgmatic version 2.1.3 ### borgmatic installation method _No response_ ### Borg version borg 1.4.3 ### Python version Python 3.14.3 ### Database version (if applicable) _No response_ ### Operating system and version Linux / ext4 filesystem
Owner

Thanks for filing this one. However it looks like another potential Borg limitation:

$ borg extract --log-json --strip-components 5 /home/witten/Downloads/tmp/repo::flux-2026-03-10T11:57:03.331844 home/witten/Downloads/tmp/source/$'\326'sterreich
$ ls *sterreich*
''$'\326''sterreich'
$ LC_CTYPE=de_AT.iso8859-1 borg extract --log-json --strip-components 5 /home/witten/Downloads/tmp/repo::flux-2026-03-10T11:57:03.331844 home/witten/Downloads/tmp/source/$'\326'sterreich
{"type": "log_message", "time": 1773169338.609392, "message": "Include pattern 'home/witten/Downloads/tmp/source/\u00d6sterreich' never matched.", "levelname": "WARNING", "name": "borg.archiver", "msgid": "IncludePatternNeverMatchedWarning"}
Thanks for filing this one. However it looks like another potential Borg limitation: ```bash $ borg extract --log-json --strip-components 5 /home/witten/Downloads/tmp/repo::flux-2026-03-10T11:57:03.331844 home/witten/Downloads/tmp/source/$'\326'sterreich $ ls *sterreich* ''$'\326''sterreich' $ LC_CTYPE=de_AT.iso8859-1 borg extract --log-json --strip-components 5 /home/witten/Downloads/tmp/repo::flux-2026-03-10T11:57:03.331844 home/witten/Downloads/tmp/source/$'\326'sterreich {"type": "log_message", "time": 1773169338.609392, "message": "Include pattern 'home/witten/Downloads/tmp/source/\u00d6sterreich' never matched.", "levelname": "WARNING", "name": "borg.archiver", "msgid": "IncludePatternNeverMatchedWarning"} ```
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1283
No description provided.