[arch-general] Less Modified Files from Updates.

Ralph Corderoy ralph at inputplus.co.uk
Fri May 11 13:24:02 UTC 2018


Hi,

After a `pacman -Su', I run this ~/bin/oldpkg script

    #! /bin/sh

    sudo lsof -n +c0 |
    sed -n '1{p;d}; /DEL/{p;d}; / (deleted)$/{p;d}' |
    g -v ' /(SYSV00000000|dev/shm/org\.chromium\.......|memfd:pulseaudio|tmp/#[0-9]{5,7})\>' |
    sed '1{h; d}; 2{x; G}'

to show open files that are deleted.  This helps spot things like
Postfix needing a restart, or xfce4-terminal running with old libraries,
that kind of thing.  A lot of the time I can selectively restart things,
log out and back in, etc., to avoid a reboot.

Quite often, these three data files appear,

    /usr/share/icons/gnome/icon-theme.cache
    /usr/share/icons/hicolor/icon-theme.cache
    /usr/share/mime/mime.cache

triggered by /usr/share/libalpm/hooks.  Based on the updated packages,
I'm guessing a lot of the time the before and after content is the same,
but the file has been re-created and moved in place of the old one
anyway.

A cmp(1) could avoid the unnecessary churn, though I see it's more
complex when an external command is exec'd rather than the re-build done
directly.  Even so, things like update-mime-database(1) used in
update-mime-database.hook has a `-n' option that looks like it might
often avoid the new inode.

    -n  Only update if MIME-DIR/packages/ or a file in that directory is
        newer than MIME-DIR/version.  This is useful for package pre-
        and post-installation scripts.

Can churn be reduced?  Or am I on the wrong track it detecting what
needs to take note of new files?

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy


More information about the arch-general mailing list