localedef: Handle symbolic links when generating locale-archive
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
From: Arjun Shankar <arjun@redhat.com>
Whenever locale data for any locale included symbolic links, localedef
would throw the error "incomplete set of locale files" and exclude it
from the generated locale archive. This commit fixes that.
Co-authored-by: Florian Weimer <fweimer@redhat.com>
---
We ran into this in Fedora when we recently switched to packaging
LC_CTYPE as symbolic links (when content was identical) to save space.
---
locale/programs/locarchive.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 2/24/22 16:07, Arjun Shankar wrote:
> Whenever locale data for any locale included symbolic links, localedef
> would throw the error "incomplete set of locale files" and exclude it
> from the generated locale archive. This commit fixes that.
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
>
> Co-authored-by: Florian Weimer <fweimer@redhat.com>
> ---
> We ran into this in Fedora when we recently switched to packaging
> LC_CTYPE as symbolic links (when content was identical) to save space.
> ---
> locale/programs/locarchive.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
> index 45408c26c1..eeb2fa6ffe 100644
> --- a/locale/programs/locarchive.c
> +++ b/locale/programs/locarchive.c
> @@ -1397,7 +1397,7 @@ add_locales_to_archive (size_t nlist, char *list[], bool replace)
> {
> char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
>
> - if (d_type == DT_UNKNOWN)
> + if (d_type == DT_UNKNOWN || d_type == DT_LNK)
OK. In the past we likely only saw DT_UNKNOWN and adjusted the code. We should be
able to process DT_LNK in addition to DT_UNKNOWN. So this looks correct.
> {
> strcpy (stpcpy (stpcpy (fullname, fname), "/"),
> d->d_name);
OK, we use stat64 right after this line on the full path for the symlink to get information
about the target file e.g. symlinked to LC_CTYPE.
@@ -1397,7 +1397,7 @@ add_locales_to_archive (size_t nlist, char *list[], bool replace)
{
char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
- if (d_type == DT_UNKNOWN)
+ if (d_type == DT_UNKNOWN || d_type == DT_LNK)
{
strcpy (stpcpy (stpcpy (fullname, fname), "/"),
d->d_name);