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

removal of subdirs under /usr/local


Section 2.2 of the packaging manual says that the postinst script should
be idempotent.  Section 3.1.2 of the Policy Manual suggests the
following code to remove directories under /usr/local:

rmdir /usr/local/lib/emacs/site-lisp && \
rmdir /usr/local/lib/emacs || \

This is not idempotent if the system fails (or someone sends a signal)
after /usr/local/lib/emacs/site-lisp is removed, but before
/usr/local/lib/emacs is.  Subsequent invocations will never remove
/usr/local/lib/emacs .  I think the following is a better solution:

rmdir /usr/local/lib/emacs/site-lisp /usr/local/lib/emacs || true

If we can't rely on rmdir continuing with the rest of its arguments if
the first removal fails, then it seems that the following should be

rmdir /usr/local/lib/emacs/site-lisp || true
rmdir /usr/local/lib/emacs || true


Reply to: