Skip to contentSkip to conversation

build initramfs: .hmac symlink not preserved

DISCUSSION John Reiser 2 participants 2 messages Aug 30, 2011 – Aug 31, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Building an initramfs does not preserve symlinks for .hmac files.

For instance on Fedora 16 the symlink
/lib64/.libcrypto.so.10.hmac -> .libcrypto.so.1.0.0d.hmac
becomes a separate regular file:
-----

$ lsinitrd test.img | grep hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 usr/lib64/.libssl.so.1.0.0d.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 usr/lib64/.libssl.so.10.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 lib64/.libcrypto.so.10.hmac
-rw-r--r--   1 root     root           65 Aug 14 22:09 lib64/.libgcrypt.so.11.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 lib64/.libcrypto.so.1.0.0d.hmac
$ ls -l /lib64/.*.hmac
-rw-r--r--. 1 root root 65 Jul 26 04:10 /lib64/.libcrypto.so.1.0.0d.hmac
lrwxrwxrwx. 1 root root 25 Aug 25 10:31 /lib64/.libcrypto.so.10.hmac -> .libcrypto.so.1.0.0d.hmac
-rw-r--r--. 1 root root 65 Aug 14 22:09 /lib64/.libgcrypt.so.11.hmac
$
-----

A message that is not in the archive (sent off-list or not yet received): 4E5D61B1.2040602-Po6cBsTGB2ZWk0Htik3J/[email protected]

#2 lore raw
Quoted 12 lines · John Reiser

Building an initramfs does not preserve symlinks for .hmac files.

For instance on Fedora 16 the symlink

    /lib64/.libcrypto.so.10.hmac ->  .libcrypto.so.1.0.0d.hmac
becomes a separate regular file:
-----
$ lsinitrd test.img | grep hmac
(quoted diff) +0 -5
-rw-r--r--   1 root     root           65 Jul 26 04:10 usr/lib64/.libssl.so.1.0.0d.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 usr/lib64/.libssl.so.10.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 lib64/.libcrypto.so.10.hmac
-rw-r--r--   1 root     root           65 Aug 14 22:09 lib64/.libgcrypt.so.11.hmac
-rw-r--r--   1 root     root           65 Jul 26 04:10 lib64/.libcrypto.so.1.0.0d.hmac
Quoted 7 lines
$ ls -l /lib64/.*.hmac
-rw-r--r--. 1 root root 65 Jul 26 04:10 /lib64/.libcrypto.so.1.0.0d.hmac
lrwxrwxrwx. 1 root root 25 Aug 25 10:31 /lib64/.libcrypto.so.10.hmac ->  .libcrypto.so.1.0.0d.hmac
-rw-r--r--. 1 root root 65 Aug 14 22:09 /lib64/.libgcrypt.so.11.hmac
$
-----

fixed with the attached patch. Thanks!

dracut-functions +2 -2
index c28766e..3edd4c7 100755
@@ -320,7 +320,7 @@ inst_simple() {
     fi
     # install checksum files also
     if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
-        inst_simple "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
+        inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
     fi
     ddebug "Installing $_src"
     cp -pfL "$_src" "${initdir}$target" 
@@ -360,7 +360,7 @@ inst_library() {
     if [[ -L $_src ]]; then
         # install checksum files also
         if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
-            inst_simple "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
+            inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
         fi
         _reallib=$(readlink -f "$_src")
         inst_simple "$_reallib" "$_reallib"