Hi,

The GNU tar documentation states about the --checkpoint-action format
string:

‘%{N}*’
     Pad output with spaces to the Nth column.  If the ‘{N}’ part is
     omitted, the current screen width is assumed.

This does not work right in multibyte locales, when non-ASCII characters
are present on the line, before the padding.

Examples:

$ LC_ALL=ru_RU.UTF-8 tar cf /tmp/all.tar --checkpoint-action="echo=Hit 
[%t]%{50}*|" coreutils-*.tar.gz
...
tar: Hit [Чт 30 окт 2025 13:20:18]           |
...

The vertical bar is in column 45, not column 50.

$ LC_ALL=ru_RU.UTF-8 tar cf /tmp/all.tar --checkpoint-action="echo=Hit 
[%t]%{50}*|" coreutils-*.tar.gz
...
tar: Hit [2025年10月30日 13時21分23秒]      |
...

The vertical bar is in column 38, not column 50.

$ tar --version
tar (GNU tar) 1.35
Copyright (C) 2023 Free Software Foundation, Inc.

To me, it looks like the cause is that in tar/src/checkpoint.c, the
return value of function format_checkpoint_string counts bytes, not
columns. To count columns, it should use the Gnulib module 'mbswidth'.

Bruno




Reply via email to