[PATCH] localedef: improve error message [BZ #16985]

Martin Sebor msebor@gmail.com
Fri Sep 11 21:11:00 GMT 2015


On 09/11/2015 02:27 PM, Roland McGrath wrote:
> I'm not following exactly what the case is.  It looks to me like the only
> cases where construct_output_path can return NULL is when asprintf fails or
> when mkdir fails.  The asprintf case really should just be an immediate
> failure as xmalloc would do.  When mkdir fails, I'm not entirely clear on
> why we don't just die immediately.  I guess the idea is that we can
> diagnose input errors even if we will never succeed in writing the output.
> I wonder how worthwhile that really is.

I haven't looked at the code but based on the description I can
reproduce the poor error message by passing the name of a non-
existent directory as an operand to the command. E.g., like so:

$ localedef -f localedata/charmaps/UTF-8 -i localedata/locales/en_US /foobar
cannot write output files to `(null)': Permission denied

Presumably, after applying the patch the message will reference
the name of the directory that the command cannot write to:

cannot write output files to `/foobar': Permission denied

Martin



More information about the Libc-alpha mailing list