+2018-12-03 Carlos O'Donell <carlos@redhat.com>
+
+ [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 <hongjiu.lu@intel.com>
* sysdeps/x86/cacheinfo.c (intel_check_word): Updated for
/* 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;
#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[] =
{ 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,
/* Enable the warnings. */
set_warnings (arg, true);
break;
+ case OPT_NO_HARD_LINKS:
+ /* Do not hard link to other locales. */
+ hard_links = false;
+ break;
case 'c':
force_output = 1;
break;
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. */
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];
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;
$(build-one-locale)
$(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
- @flags="-c --no-archive"; \
+ @flags="-c --no-archive --no-hard-links"; \
$(build-one-locale)
tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP