[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Renaming packages: maintscripts

Steve Langasek wrote:
> Ben Hutchings wrote:
> > # in autofs.postinst
> > rm -f /var/lib/dpkg/info/autofs5.postrm
> > (There may be a cleaner way to do this.)
> if postrm=$(dpkg-query -c autofs5 postrm 2>/dev/null); then
> 	rm -f "$postrm"
> fi
> Not sure about cleaner, but that's the supported dpkg interface.

If the "/var/lib/dpkg/info" path is guaranteed not to have any spaces
in it then the first way, the simple rm -f, seems better by way of
being faster.  Because it would avoid the query.  Queries such as
those can take up a lot of cpu and it all adds up.  I hate spending a
lot of time waiting for the machine to spin its wheels unnecessarily.

And in the end does it matter what the answer is if it is going to be
a removal anyway?  It seems to me that it would be enough faster to
just always run the 'rm -f' since it avoids the query.  Since I don't
think that will ever produce a bad result.  (Is there ever a bad
result case?)

Of course if there is a plan to move the /var/lib/dpkg/info path
elsewhere then the path should be obtained dynamically and properly
quoted.  But is that ever really a potential possibility?


Attachment: signature.asc
Description: Digital signature

Reply to: