[arch-general] Does leading slash matter in install scriptlets?

lolilolicon lolilolicon at gmail.com
Wed Aug 7 10:54:33 EDT 2013


On Wed, Aug 7, 2013 at 8:51 PM, Allan McRae <allan at archlinux.org> wrote:
>
> Given it does not matter, there is no preference (at least from me).
>

Effectively true, but conceptually I think I would prefer an explicit
slash, which does not rely on the implicit $PWD == /.
Take again the example from my original email,

post_install() {
    update-desktop-database -q
    gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

Since `update-desktop-database` without a directory specified defaults
to /usr/share/applications, the above is equivalent to,

post_install() {
    update-desktop-database -q /usr/share/applications
    gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

which is not consistent. Therefore, it should be:

post_install() {
    update-desktop-database -q
    gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
}

or, alternatively, consistently remove the leading slash,

post_install() {
    update-desktop-database -q usr/share/applications
    gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

But since a leading slash doesn't sacrifice any flexibility, I prefer
an explicit slash everywhere.


More information about the arch-general mailing list