Listing archive contents replaces invalid UTF-8 bytes with "?" (question mark) #1282

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

What I'm trying to do and why

I'm trying to check, whether files containing non UTF-8 byte sequences in the name are backed up correctly.

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 --path tmp/ --archive latest --destination dest --strip-components 3
/tmp/scratch$ ls dest/
''$'\326''sterreich'
/tmp/scratch$ borgmatic -c config.yaml list --archive latest | tail -n1 | xxd
00000000: 1b5b 3335 6d2d 7277 2d72 2d2d 722d 2d20  .[35m-rw-r--r--
00000010: 686f 7020 2020 2068 6f70 2020 2020 2020  hop    hop
00000020: 2020 2020 2030 2053 6174 2c20 3230 3236       0 Sat, 2026
00000030: 2d30 332d 3037 2032 303a 3331 3a34 3220  -03-07 20:31:42
00000040: 746d 702f 7363 7261 7463 682f 736f 7572  tmp/scratch/sour
00000050: 6365 2f3f 7374 6572 7265 6963 681b 5b30  ce/?sterreich.[0
00000060: 6d0a
hop@pvsvie01a2:/tmp/scratch$ LC_CTYPE=de_AT.iso8859-1 borgmatic -c config.yaml list --archive latest | tail -n1 | xxd
00000000: 1b5b 3335 6d2d 7277 2d72 2d2d 722d 2d20  .[35m-rw-r--r--
00000010: 686f 7020 2020 2068 6f70 2020 2020 2020  hop    hop
00000020: 2020 2020 2030 2053 756e 2c20 3230 3236       0 Sun, 2026
00000030: 2d30 332d 3038 2032 323a 3233 3a30 3620  -03-08 22:23:06
00000040: 746d 702f 7363 7261 7463 682f 736f 7572  tmp/scratch/sour
00000050: 6365 2f3f 7374 6572 7265 6963 681b 5b30  ce/?sterreich.[0
00000060: 6d0a

Actual behavior

Invalid bytes are rendered as ? (ASCII \x3f).

Expected behavior

Invalid bytes should be rendered as is or as they would be extracted, especially when running in a single byte encoding locale.

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 I'm trying to check, whether files containing non UTF-8 byte sequences in the name are backed up correctly. ### 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 --path tmp/ --archive latest --destination dest --strip-components 3 /tmp/scratch$ ls dest/ ''$'\326''sterreich' /tmp/scratch$ borgmatic -c config.yaml list --archive latest | tail -n1 | xxd 00000000: 1b5b 3335 6d2d 7277 2d72 2d2d 722d 2d20 .[35m-rw-r--r-- 00000010: 686f 7020 2020 2068 6f70 2020 2020 2020 hop hop 00000020: 2020 2020 2030 2053 6174 2c20 3230 3236 0 Sat, 2026 00000030: 2d30 332d 3037 2032 303a 3331 3a34 3220 -03-07 20:31:42 00000040: 746d 702f 7363 7261 7463 682f 736f 7572 tmp/scratch/sour 00000050: 6365 2f3f 7374 6572 7265 6963 681b 5b30 ce/?sterreich.[0 00000060: 6d0a hop@pvsvie01a2:/tmp/scratch$ LC_CTYPE=de_AT.iso8859-1 borgmatic -c config.yaml list --archive latest | tail -n1 | xxd 00000000: 1b5b 3335 6d2d 7277 2d72 2d2d 722d 2d20 .[35m-rw-r--r-- 00000010: 686f 7020 2020 2068 6f70 2020 2020 2020 hop hop 00000020: 2020 2020 2030 2053 756e 2c20 3230 3236 0 Sun, 2026 00000030: 2d30 332d 3038 2032 323a 3233 3a30 3620 -03-08 22:23:06 00000040: 746d 702f 7363 7261 7463 682f 736f 7572 tmp/scratch/sour 00000050: 6365 2f3f 7374 6572 7265 6963 681b 5b30 ce/?sterreich.[0 00000060: 6d0a ``` ### Actual behavior Invalid bytes are rendered as `?` (ASCII `\x3f`). ### Expected behavior Invalid bytes should be rendered as is or as they would be extracted, especially when running in a single byte encoding locale. ### 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

I'm pretty sure this is a Borg limitation. Example:

$  borg list repo::flux-2026-03-09T18:38:14.130398 | tail -n1 | xxd
00000000: 2d72 772d 722d 2d72 2d2d 2077 6974 7465  -rw-r--r-- witte
00000010: 6e20 7769 7474 656e 2020 2020 2020 2020  n witten        
00000020: 3020 4d6f 6e2c 2032 3032 362d 3033 2d30  0 Mon, 2026-03-0
00000030: 3920 3138 3a33 363a 3431 2068 6f6d 652f  9 18:36:41 home/
00000040: 7769 7474 656e 2f44 6f77 6e6c 6f61 6473  witten/Downloads
00000050: 2f74 6d70 2f73 6f75 7263 652f 3f73 7465  /tmp/source/?ste
00000060: 7272 6569 6368 0a                        rreich.
$ LC_CTYPE=de_AT.iso8859-1 borg list repo::flux-2026-03-09T18:38:14.130398 | tail -n1 | xxd
00000000: 2d72 772d 722d 2d72 2d2d 2077 6974 7465  -rw-r--r-- witte
00000010: 6e20 7769 7474 656e 2020 2020 2020 2020  n witten        
00000020: 3020 4d6f 6e2c 2032 3032 362d 3033 2d30  0 Mon, 2026-03-0
00000030: 3920 3138 3a33 363a 3431 2068 6f6d 652f  9 18:36:41 home/
00000040: 7769 7474 656e 2f44 6f77 6e6c 6f61 6473  witten/Downloads
00000050: 2f74 6d70 2f73 6f75 7263 652f 3f73 7465  /tmp/source/?ste
00000060: 7272 6569 6368 0a                        rreich.

Let me know if I'm missing something.

I'm pretty sure this is a Borg limitation. Example: ``` $  borg list repo::flux-2026-03-09T18:38:14.130398 | tail -n1 | xxd 00000000: 2d72 772d 722d 2d72 2d2d 2077 6974 7465 -rw-r--r-- witte 00000010: 6e20 7769 7474 656e 2020 2020 2020 2020 n witten 00000020: 3020 4d6f 6e2c 2032 3032 362d 3033 2d30 0 Mon, 2026-03-0 00000030: 3920 3138 3a33 363a 3431 2068 6f6d 652f 9 18:36:41 home/ 00000040: 7769 7474 656e 2f44 6f77 6e6c 6f61 6473 witten/Downloads 00000050: 2f74 6d70 2f73 6f75 7263 652f 3f73 7465 /tmp/source/?ste 00000060: 7272 6569 6368 0a rreich. $ LC_CTYPE=de_AT.iso8859-1 borg list repo::flux-2026-03-09T18:38:14.130398 | tail -n1 | xxd 00000000: 2d72 772d 722d 2d72 2d2d 2077 6974 7465 -rw-r--r-- witte 00000010: 6e20 7769 7474 656e 2020 2020 2020 2020 n witten 00000020: 3020 4d6f 6e2c 2032 3032 362d 3033 2d30 0 Mon, 2026-03-0 00000030: 3920 3138 3a33 363a 3431 2068 6f6d 652f 9 18:36:41 home/ 00000040: 7769 7474 656e 2f44 6f77 6e6c 6f61 6473 witten/Downloads 00000050: 2f74 6d70 2f73 6f75 7263 652f 3f73 7465 /tmp/source/?ste 00000060: 7272 6569 6368 0a rreich. ``` Let me know if I'm missing something.
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#1282
No description provided.