[Pm-utils] lockfile creation not really atomic in pm-utils

Victor Lowther victor.lowther at gmail.com
Fri Jan 11 10:19:14 PST 2008

On Jan 11, 2008 12:00 PM, Till Maas <opensource at till.name> wrote:
> On Wed January 9 2008, Victor Lowther wrote:
> > What happens when your device either does not have a hardware clock or
> > the hardware clock has failed?  The more complicated the mechanism to
> > detect and remove a stale lock directory, the more ways in which it
> > can fail, and the more mysterious those failures will be.
> > Unconditionally nuking the lock directory at boot time (or detecting
> > the lock directory, annoying the user with some scary verbiage, and
> > then unconditionally nuking the directory) is pretty much foolproof.
> Hm, ok, I do not have any objections against the patch anymore. Only the need
> for cleaning up /.suspend manually in case of crashes / via an initscript
> should be documented in INSTALL imho.

I plan on writing a script to do so.  I guess I finally have a good
reason to learn to use autotools :/

> > Speaking of code audits, is there a reason that the scripts are bash
> > specific in places?  I would think that strict POSIX sh compatibility
> > would be the way to go for these scripts -- makes using them in
> > embedded systems and the like easier.
> Do you have a good resource on how to convert bash features into POSIX
> compatible commands? I guess bash is used, because it makes lot of stuff
> easier. :-)

My strategy is to have a copy of the bash man page and the POSIX sh
specs (www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html)
open while reading the scripts.
I am mostly finished with bash -> posix sh conversion already, just a
couple of annoyances ( ${foo//-/_} and friends, and converting some of
the array notation into list notation) left.

Once that is done I will look for all the points that the scripts can
fail without cleaning up after themselves.

> Regards,
> Till
> _______________________________________________
> Pm-utils mailing list
> Pm-utils at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pm-utils

More information about the Pm-utils mailing list