File conflict when upgrading package

Kevin Kofler kevin.kofler at chello.at
Fri Nov 22 14:37:38 UTC 2013


Mattias Ellert wrote:
>   os.execute("rm -rf %{_datadir}/applications/%{name}.desktop")

Ewww… Using os.execute in Lua scriptlets is scary because the whole point of 
writing them in Lua rather than shell is to avoid depending on stuff being 
installed on the file system. Now in this case, you'll likely get away with 
it because your scriptlet runs the rm only if the directory existed to begin 
with, which is not the case in the "initial installation" use case where 
things like rm are unavailable. Still, actually deleting things from within 
Lua would be cleaner (but likely more work to do recursively, sure; it'd 
help if RPM exported some rm_rf or so function to Lua scriptlets).

        Kevin Kofler



More information about the devel mailing list