Received: from list by lists.gnu.org with archive (Exim 4.71) id 1esstc-0002xR-Rv for mharc-grub-devel@gnu.org; Mon, 05 Mar 2018 11:23:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1essta-0002vd-Pq for grub-devel@gnu.org; Mon, 05 Mar 2018 11:23:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esstX-0004AR-WD for grub-devel@gnu.org; Mon, 05 Mar 2018 11:23:26 -0500 Received: from boksu.net-space.pl ([185.15.1.105]:38757) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1esstX-00048D-LT for grub-devel@gnu.org; Mon, 05 Mar 2018 11:23:23 -0500 Received: (from localhost user: 'dkiper' uid#4000 fake: STDIN (dkiper@boksu.net-space.pl)) by router-fw-old.local.net-space.pl id S1830301AbeCEQXM (ORCPT ); Mon, 5 Mar 2018 17:23:12 +0100 Date: Mon, 5 Mar 2018 17:23:12 +0100 From: Daniel Kiper To: The development of GNU GRUB Cc: Olaf Hering Subject: Re: [PATCH] grub-install: locale depends on nls Message-ID: <20180305162312.GC27749@router-fw-old.local.net-space.pl> References: <20180227083920.24703-1-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180227083920.24703-1-olaf@aepfle.de> User-Agent: Mutt/1.3.28i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.15.1.105 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 16:23:27 -0000 On Tue, Feb 27, 2018 at 09:39:20AM +0100, Olaf Hering wrote: > With --disable-nls no locales exist. > Avoid runtime error by wrapping install logic inside ENABLE_NLS. > > Signed-off-by: Olaf Hering > --- > util/grub-install-common.c | 108 +++++++++++++++++++++++++-------------------- > 1 file changed, 59 insertions(+), 49 deletions(-) > > --- a/util/grub-install-common.c > +++ b/util/grub-install-common.c > @@ -725,13 +725,69 @@ grub_install_get_platform_platform (enum grub_install_plat platid) > return platforms[platid].platform; > } > > +static void > +grub_install_copy_nls(const char *src, const char *dst) Does not compiler complain that arguments are unused if ENABLE_NLS is not defined? > +{ > +#if (defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS) Is not "#if defined(GRUB_UTIL) && defined(ENABLE_NLS)" sufficient? > + char *dst_locale; > + > + dst_locale = grub_util_path_concat (2, dst, "locale"); > + grub_install_mkdir_p (dst_locale); > + clean_grub_dir (dst_locale); > + > + if (install_locales.is_default) > + { > + char *srcd = grub_util_path_concat (2, src, "po"); > + copy_by_ext (srcd, dst_locale, ".mo", 0); > + copy_locales (dst_locale); > + free (srcd); > + } > + else > + { > + const char *locale_dir = get_localedir (); > + > + for (i = 0; i < install_locales.n_entries; i++) > + { > + char *srcf = grub_util_path_concat_ext (3, src, > + "po", > + install_locales.entries[i], > + ".mo"); > + char *dstf = grub_util_path_concat_ext (2, dst_locale, > + install_locales.entries[i], > + ".mo"); If you move code around please fix the arguments alignment. > + if (grub_install_compress_file (srcf, dstf, 0)) > + { > + free (srcf); > + free (dstf); > + continue; > + } > + free (srcf); > + srcf = grub_util_path_concat_ext (4, > + locale_dir, > + install_locales.entries[i], > + "LC_MESSAGES", > + PACKAGE, > + ".mo"); Ditto. Daniel PS Please CC me next time.