Daiki Ueno wrote: > > The consequence is that in packages that use GNU libtool, such programs will > > print "lt-prog" instead of "prog" in their usage message and other messages. > > This will disturb > > * the hacker who uses the programs before doing "make install", > > * the test suite. > > Sorry, I'm skeptical about this. Would it be useful to test the > getprogname functionality from outside of test-getprogname.c?
Here's what I mean: In the GNU gettext package, currently, after having built it from source, I can do $ cd gettext-tools/src $ ./xgettext --help | head -n 1 Aufruf: ./xgettext [OPTION] [EINGABEDATEI]... When I do the replacements (below) to get rid of the use of the module 'progname', I get $ cd gettext-tools/src $ ./xgettext --help | head -n 1 Aufruf: lt-xgettext [OPTION] [EINGABEDATEI]... As you can see, - The usage message now doesn't show the path of the executable, only its basename. I view this as a regression, because power users often adjust PATH and then occasionally by mistake invoke a program from an unintended location. (This is reiterating my point 1) from https://lists.gnu.org/archive/html/bug-gnulib/2006-01/msg00122.html.) - The basename now starts with "lt-". In summary, I like Pino's 'getprogname' module because it nicely solves the problems he listed in http://lists.gnu.org/archive/html/bug-gnulib/2016-03/msg00048.html. But I disagree with the idea that the 'program_name' module and the set_program_name() function should be deprecated, as expressed in https://lists.gnu.org/archive/html/bug-gnulib/2016-09/msg00007.html Bruno diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index f848d76..4075caa 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -39,7 +39,7 @@ #include "str-list.h" #include "error.h" #include "error-progname.h" -#include "progname.h" +#include "getprogname.h" #include "relocatable.h" #include "basename.h" #include "xerror.h" @@ -342,7 +342,6 @@ main (int argc, char *argv[]) size_t i; /* Set program name for messages. */ - set_program_name (argv[0]); error_print_progname = maybe_print_progname; #ifdef HAVE_SETLOCALE @@ -676,7 +675,7 @@ main (int argc, char *argv[]) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", getprogname (), PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ @@ -801,14 +800,14 @@ xgettext cannot work without keywords to look for")); Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), \ and iconv() does not support this conversion."), xgettext_global_source_encoding, po_charset_utf8, - basename (program_name)); + getprogname ()); xgettext_global_source_iconv = cd; #else error (EXIT_FAILURE, 0, _("\ Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). \ This version was built without iconv()."), xgettext_global_source_encoding, po_charset_utf8, - basename (program_name)); + getprogname ()); #endif } @@ -1030,12 +1029,12 @@ usage (int status) { if (status != EXIT_SUCCESS) fprintf (stderr, _("Try '%s --help' for more information.\n"), - program_name); + getprogname ()); else { printf (_("\ Usage: %s [OPTION] [INPUTFILE]...\n\ -"), program_name); +"), getprogname ()); printf ("\n"); printf (_("\ Extract translatable strings from given input files.\n\