Skip to content

Conversation

@thiell
Copy link

@thiell thiell commented May 14, 2025

This ensures that UTF-8 file names are handled correctly by libarchive.

Without setlocale():

$ touch foo/bår
$ dtar -c --preserve-owner --preserve-times --preserve-perms --bufsize 16MB --chunksize 64MB -f /tmp/testenc3.tar foo
[2025-05-13T17:59:24] Walking /abc/foo
[2025-05-13T17:59:26] Walked 2 items in 2.015 secs (0.993 items/sec) ...
[2025-05-13T17:59:26] Walked 2 items in 2.015 seconds (0.993 items/sec)
[2025-05-13T17:59:26] Writing archive to /tmp/testenc3.tar
[2025-05-13T17:59:26] Items: 2
[2025-05-13T17:59:26]   Directories: 1
[2025-05-13T17:59:26]   Files: 1
[2025-05-13T17:59:26]   Links: 0
[2025-05-13T17:59:26] Data: 0.000 B (0.000 B per file)
[2025-05-13T17:59:26] Sorted 2 items in 0.015 seconds (137.712 items/sec)
[2025-05-13T17:59:26] [0] [mpifileutils-v0.12/mpifileutils/src/common/mfu_flist_archive.c:345] ERROR: archive_write_header(): Can't translate pathname 'foo/bår' to UTF-8
[2025-05-13T17:59:26] Truncating archive
[2025-05-13T17:59:26] Gathering index
[2025-05-13T17:59:26] Writing index as last entry in /tmp/testenc3.tar
[2025-05-13T17:59:26] Writing entry headers
[2025-05-13T17:59:26] [0] [mpifileutils-v0.12/mpifileutils/src/common/mfu_flist_archive.c:345] ERROR: archive_write_header(): Can't translate pathname 'foo/bår' to UTF-8
[2025-05-13T17:59:26] [0] [mpifileutils-v0.12/mpifileutils/src/common/mfu_flist_archive.c:527] ERROR: Failed to encode header for `/abc/foo/bår'
[2025-05-13T17:59:26] Copying file data
[2025-05-13T17:59:26] Started:   May-13-2025, 17:59:26
[2025-05-13T17:59:26] Completed: May-13-2025, 17:59:26
[2025-05-13T17:59:26] Seconds: 0.022
[2025-05-13T17:59:26] Archive size: 6.500 KiB
[2025-05-13T17:59:26] Rate: 300.788 KiB/s (6656 bytes in 0.022 seconds)

With setlocale():

$ touch foo/bår
$ dtar -c --preserve-owner --preserve-times --preserve-perms --bufsize 16MB --chunksize 64MB -f /tmp/testenc4.tar foo
[2025-05-13T17:59:42] Walking /abc/foo
[2025-05-13T17:59:42] Walked 2 items in 0.266 secs (7.515 items/sec) ...
[2025-05-13T17:59:42] Walked 2 items in 0.266 seconds (7.511 items/sec)
[2025-05-13T17:59:42] Writing archive to /tmp/testenc4.tar
[2025-05-13T17:59:42] Items: 2
[2025-05-13T17:59:42]   Directories: 1
[2025-05-13T17:59:42]   Files: 1
[2025-05-13T17:59:42]   Links: 0
[2025-05-13T17:59:42] Data: 0.000 B (0.000 B per file)
[2025-05-13T17:59:42] Sorted 2 items in 0.007 seconds (286.076 items/sec)
[2025-05-13T17:59:42] Truncating archive
[2025-05-13T17:59:42] Gathering index
[2025-05-13T17:59:42] Writing index as last entry in /tmp/testenc4.tar
[2025-05-13T17:59:42] Writing entry headers
[2025-05-13T17:59:42] Copying file data
[2025-05-13T17:59:42] Started:   May-13-2025, 17:59:42
[2025-05-13T17:59:42] Completed: May-13-2025, 17:59:42
[2025-05-13T17:59:42] Seconds: 0.012
[2025-05-13T17:59:42] Archive size: 6.500 KiB
[2025-05-13T17:59:42] Rate: 563.669 KiB/s (6656 bytes in 0.012 seconds)

This ensures that UTF-8 file names are handled correctly by libarchive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant