public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] localedef: Handle symbolic links when generating locale-archive
@ 2022-02-24 21:07 Arjun Shankar
  2022-02-24 21:34 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Arjun Shankar @ 2022-02-24 21:07 UTC (permalink / raw)
  To: libc-alpha, Carlos O'Donell; +Cc: Florian Weimer

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(-)

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)
 			{
 			  strcpy (stpcpy (stpcpy (fullname, fname), "/"),
 				  d->d_name);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] localedef: Handle symbolic links when generating locale-archive
  2022-02-24 21:07 [PATCH] localedef: Handle symbolic links when generating locale-archive Arjun Shankar
@ 2022-02-24 21:34 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2022-02-24 21:34 UTC (permalink / raw)
  To: Arjun Shankar, libc-alpha; +Cc: Florian Weimer

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.

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-24 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 21:07 [PATCH] localedef: Handle symbolic links when generating locale-archive Arjun Shankar
2022-02-24 21:34 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).