commit:     e0f280f3aa0d52f16f6af2f58b3fdcb3715573a8
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 21 23:15:53 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:23:16 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e0f280f3

Reduce the extent to which render_printable() is used

Presently, there are diagnostic messages in which pathnames are enclosed
by single quotes, and others that use the render_printable() subroutine
to convert to ASCII-constrained JSON, duly enclosing them within double
quotes. Partly address this inconsistency by refraining from calling
render_printable() other than in the following three cases.

1) throwing from normalize() for malformed locale names
2) throwing from read_config() where no locale entries were found
3) throwing from parse_config()

There remains an inconsistency in that the second of these cases
continues to render pathnames as JSON. I have let it be because it is
useful to be able to render the entirety of the @paths array in an
unambiguous fashion.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/locale-gen b/locale-gen
index 33dad6e..146a545 100755
--- a/locale-gen
+++ b/locale-gen
@@ -292,8 +292,8 @@ sub read_config ($prefix, @paths) {
                }
                my @locales = parse_config($fh, $path, \%locale_by, 
\%charmap_by);
                if (my $count = scalar @locales) {
-                       printf "Found %d locale declaration%s in %s.\n",
-                               $count, plural($count), render_printable($path);
+                       printf "Found %d locale declaration%s in '%s'.\n",
+                               $count, plural($count), $path;
                        return @locales;
                }
        }
@@ -491,7 +491,7 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, 
$do_update, @canonic
 
        # Determine the eventual destination path of the archive.
        my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
-       printf "The location of the archive shall be %s.\n", 
render_printable($final_path);
+       print "The location of the archive shall be '$final_path'.\n";
 
        # If --update was specified, make a copy of the existing archive.
        if ($do_update && -e $final_path) {
@@ -616,9 +616,8 @@ sub throw_child_error ($cmd, $status = $?) {
                # have printed a warning, no supplemental diagnostic is needed.
                exit 1;
        } elsif ($status != 0) {
-               my $printable_cmd = render_printable($cmd);
                my $fate = ($status & 0x7F) ? 'interrupted by a signal' : 
'unsuccessful';
-               die "$PROGRAM: Aborting because the execution of $printable_cmd 
was $fate\n";
+               die "$PROGRAM: Aborting because the execution of '$cmd' was 
$fate\n";
        }
 }
 

Reply via email to