Skip to content

Commit

Permalink
fix(install): extend hwcaps library handling to libraries under glibc…
Browse files Browse the repository at this point in the history
…-hwcaps/
  • Loading branch information
dtardon authored and johannbg committed Sep 13, 2021
1 parent 591118c commit 10ed204
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ static int cp(const char *src, const char *dst)
static int library_install(const char *src, const char *lib)
{
_cleanup_free_ char *p = NULL;
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
char *q;
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *pppdir = NULL, *clib = NULL;
char *q, *clibdir;
int r, ret = 0;

p = strdup(lib);
Expand All @@ -377,7 +377,8 @@ static int library_install(const char *src, const char *lib)
log_debug("Lib install: '%s'", p);
}

/* Also try to install the same library from one directory above.
/* Also try to install the same library from one directory above
* or from one directory above glibc-hwcaps.
This fixes the case, where only the HWCAP lib would be installed
# ldconfig -p|grep -F libc.so
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
Expand All @@ -398,10 +399,18 @@ static int library_install(const char *src, const char *lib)
return ret;

ppdir = strdup(ppdir);
pppdir = dirname(ppdir);
if (!pppdir)
return ret;

pppdir = strdup(pppdir);
if (!pppdir)
return ret;

strcpy(p, lib);

clib = strjoin(ppdir, "/", basename(p), NULL);
clibdir = streq(basename(ppdir), "glibc-hwcaps") ? pppdir : ppdir;
clib = strjoin(clibdir, "/", basename(p), NULL);
if (dracut_install(clib, clib, false, false, true) == 0)
log_debug("Lib install: '%s'", clib);
/* also install lib.so for lib.so.* files */
Expand Down

0 comments on commit 10ed204

Please sign in to comment.