Skip to content
Snippets Groups Projects
  • Simon McVittie's avatar
    640fc1af
    pv-runtime: Delete dangling development symlinks to overridden libraries · 640fc1af
    Simon McVittie authored
    
    Some development libraries follow this pattern, and we already delete
    those without needing to use libelf to load the library and find out
    its SONAME:
    
        libfcitx-config.so -> libfcitx-config.so.4
        libfcitx-config.so.4 -> libfcitx-config.so.4.1
        libfcitx-config.so.4.1
    
    However, other libraries follow this pattern, which results in the code
    that uses libelf to find the SONAME being the only way we can figure out
    that the .so symlink needs removing:
    
        libdbus-glib-1.so -> libdbus-glib-1.so.2.2.2
        libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.2.2
        libdbus-glib-1.so.2.2.2
    
    To avoid relying on the libelf code path, which is surprisingly slow
    when run with a cold disk cache, we can do one scan through the
    directory removing regular files and runtime symlinks, and a second
    scan through the directory removing development symlinks that have
    become dangling as a result.
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    640fc1af
    History
    pv-runtime: Delete dangling development symlinks to overridden libraries
    Simon McVittie authored
    
    Some development libraries follow this pattern, and we already delete
    those without needing to use libelf to load the library and find out
    its SONAME:
    
        libfcitx-config.so -> libfcitx-config.so.4
        libfcitx-config.so.4 -> libfcitx-config.so.4.1
        libfcitx-config.so.4.1
    
    However, other libraries follow this pattern, which results in the code
    that uses libelf to find the SONAME being the only way we can figure out
    that the .so symlink needs removing:
    
        libdbus-glib-1.so -> libdbus-glib-1.so.2.2.2
        libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.2.2
        libdbus-glib-1.so.2.2.2
    
    To avoid relying on the libelf code path, which is surprisingly slow
    when run with a cold disk cache, we can do one scan through the
    directory removing regular files and runtime symlinks, and a second
    scan through the directory removing development symlinks that have
    become dangling as a result.
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>