This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.28.9000-347-g8cebd4f

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8cebd4ffe67bf94508809ea0caa02a4f1d52e8b1 (commit)
      from  c22e4c2a1431c5e77bf4288d35bf7629f2f093aa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------;a=commitdiff;h=8cebd4ffe67bf94508809ea0caa02a4f1d52e8b1

commit 8cebd4ffe67bf94508809ea0caa02a4f1d52e8b1
Author: Carlos O'Donell <>
Date:   Mon Nov 26 09:51:51 2018 -0500

    Add --no-hard-links option to localedef (bug 23923)
    Downstream distributions need consistent sets of hardlinks in
    order for rpm to operate effectively. This means that even if
    locales are built with a high level of parallelism that the
    resulting files need to have consistent hardlink counts. The only
    way to achieve this is with a post-install hardlink pass using a
    program like 'hardlink' (shipped in Fedora).
    If the downstream distro wants to post-process the hardlinks then
    the time spent in localedef looking up sibling directories and
    processing hardlinks is wasted effort.
    To optimize the build and install pass we add a --no-hard-links
    option to localedef to avoid doing the hardlink optimziation for
    Tested on x86_64 with 'make localedata/install-locale-files'
    before and after. Without the patch we have files with 100+
    hardlink counts. After the patch and running with --no-hard-links
    all link counts are 1. This patch also alters the convenience
    target 'make localedata/install-locale-files' to use the new
    Signed-off-by: Carlos O'Donell <>

diff --git a/ChangeLog b/ChangeLog
index a11a9c6..d5e7e3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-12-03  Carlos O'Donell  <>
+	[BZ #23923]
+	* locale/programs/localedef.c: Declare boolean hard_links default true.
+	(options): Add --no-hard-links option.
+	(parse_opt): Add OPT_NO_HARD_LINKS case and set hard_links to false.
+	* locale/programs/localedef.h: Declare prototype for hard_links.
+	* locale/programs/locfile.c (write_locale_data): Don't use hard
+	links if hard_links is false.
 2018-12-03  H.J. Lu  <>
 	* sysdeps/x86/cacheinfo.c (intel_check_word): Updated for
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index d718d2e..6c4936b 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -85,6 +85,9 @@ static bool replace_archive;
 /* If true list archive content.  */
 static bool list_archive;
+/* If true create hard links to other locales (default).  */
+bool hard_links = true;
 /* Maximum number of retries when opening the locale archive.  */
 int max_locarchive_open_retry = 10;
@@ -105,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
 #define OPT_BIG_ENDIAN 401
 #define OPT_NO_WARN 402
 #define OPT_WARN 403
+#define OPT_NO_HARD_LINKS 404
 /* Definitions of arguments for argp functions.  */
 static const struct argp_option options[] =
@@ -120,6 +124,8 @@ static const struct argp_option options[] =
   { NULL, 0, NULL, 0, N_("Output control:") },
   { "force", 'c', NULL, 0,
     N_("Create output even if warning messages were issued") },
+  { "no-hard-links", OPT_NO_HARD_LINKS, NULL, 0,
+    N_("Do not create hard links between installed locales") },
   { "prefix", OPT_PREFIX, N_("PATH"), 0, N_("Optional output file prefix") },
   { "posix", OPT_POSIX, NULL, 0, N_("Strictly conform to POSIX") },
   { "quiet", OPT_QUIET, NULL, 0,
@@ -389,6 +395,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       /* Enable the warnings.  */
       set_warnings (arg, true);
+    case OPT_NO_HARD_LINKS:
+      /* Do not hard link to other locales.  */
+      hard_links = false;
+      break;
     case 'c':
       force_output = 1;
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
index 0083fac..e2b39e7 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -118,6 +118,7 @@ extern const char *repertoire_global;
 extern int max_locarchive_open_retry;
 extern bool no_archive;
 extern const char *alias_file;
+extern bool hard_links;
 /* Prototypes for a few program-wide used functions.  */
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 32e5f76..1555231 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -702,7 +702,7 @@ write_locale_data (const char *output_path, int catidx, const char *category,
   size_t cnt, step, maxiov;
   int fd;
   char *fname;
-  const char **other_paths;
+  const char **other_paths = NULL;
   uint32_t header[2];
   size_t n_elem;
   struct iovec vec[3];
@@ -827,9 +827,22 @@ failure while writing data for category `%s'"), category);
   close (fd);
-  /* Compare the file with the locale data files for the same category in
-     other locales, and see if we can reuse it, to save disk space.  */
-  other_paths = siblings (output_path);
+  /* Compare the file with the locale data files for the same category
+     in other locales, and see if we can reuse it, to save disk space.
+     If the user specified --no-hard-links to localedef then hard_links
+     is false, other_paths remains NULL and we skip the optimization
+     below.  The use of --no-hard-links is distribution specific since
+     some distros have post-processing hard-link steps and so doing this
+     here is a waste of time.  Worse than a waste of time in rpm-based
+     distributions it can result in build determinism issues from
+     build-to-build since some files may get a hard link in one pass but
+     not in another (if the files happened to be created in parallel).  */
+  if (hard_links)
+    other_paths = siblings (output_path);
+  /* If there are other paths, then walk the sibling paths looking for
+     files with the same content so we can hard link and reduce disk
+     space usage.  */
   if (other_paths != NULL)
       struct stat64 fname_stat;
diff --git a/localedata/Makefile b/localedata/Makefile
index 0eea396..b245f0f 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -423,7 +423,7 @@ $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
-	@flags="-c --no-archive"; \
+	@flags="-c --no-archive --no-hard-links"; \
 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP


Summary of changes:
 ChangeLog                   |   10 ++++++++++
 locale/programs/localedef.c |   10 ++++++++++
 locale/programs/localedef.h |    1 +
 locale/programs/locfile.c   |   21 +++++++++++++++++----
 localedata/Makefile         |    2 +-
 5 files changed, 39 insertions(+), 5 deletions(-)

GNU C Library master sources

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]