safecat implements Dan Bernstein's maildir algorithm, copying standard input safely to a specified directory. With safecat, the user is offered two assurances. First, if safecat returns successfully, then all data is guaranteed to be saved in the destination directory. Second, if a file exists in the destination directory, placed there by safecat, then the file is guaranteed to be complete.

To use safecat, you specify a destination directory, but not a file name. Safecat picks the filename uniquely every time. That way many safecat processes (and other programs) can write to the directory simultaneously. If you want a particular filename, then you just rename the file after safecat completes. In general you should use a single, separate process to do things like renaming, collecting, and deleting files. You can run the process as a daemon, in cron jobs, or from a mail reader.

Please Contribute

If you use safecat and benefit from its existence, please consider expressing your appreciation.

Getting safecat

On April 9, 2006, safecat was updated to version 1.13. Only minor changes in this version: principally updated RPM support courtesy of Vadim Druzhin and Charlie Brady.

Note that safecat is known, at least on some platforms, to truncate files longer than 2GB. I have added conditional code to support large files, at least on Linux, but I still consider it a bit crazy to use this for such large files--that really isn't its function! I'm sure you're really looking for rsync, aren't you?

Changes in version 1.11: fixed a bug in version 1.10 in which garbage could be appended to the PID in the filename. Thanks to Toby Betts and Guy Garnett for pointing out the bug. (Since Toby Betts spotted it first, he won the unofficial $5 bounty for finding safecat bugs.)

Changes in version 1.10: first of all, safecat now conforms to the updated maildir spec (it already conformed in spirit; now the filenames conform exactly). The other major purpose of this release is to counter the errno incompatibility created by the glibc people. Now safecat should build cleanly on current glibc systems like RedHat 9.0 and on UNIX machines. :-)

Updated RPMS were thanks to MJ Pomraning, who cleaned up the outdated spec file originally contributed by Peter Bray. There were also some minor fixes thanks to Peter van Dijk.

Changes in 1.9: bugfix--the timestamp portion of filenames was coming out wrong on Solaris systems, due to an implicit cast from long long to unsigned long. Thanks to Paul Grayson, both for the report and for testing several attempted fixes until things worked correctly.

Changes in 1.8: Support was added for installing to nonstandard places, and an RPM distribution was added. Thanks to Peter Bray.

Accept no substitutes! There is only one safecat! If you like qmail, and appreciate its super reliability, then you'll use the only tool which claims to be just as reliable (unless something terrible happens which is absolutely somebody else's fault). Can't think of a use for safecat? Look at the latest safecat one-liners. Already sold on safecat? Please consider a donation, as a token of your esteem.

Installation

	tar xvzf safecat-VERSION.tar.gz
	cd safecat-VERSION
	make
	make setup check
    

Licensing

Safecat is issued under the BSD license. Some of the source code for safecat was borrowed from Dan Bernstein, who has not specified what license applies to his code. From his public remarks, I am confident that he doesn't care what is done with his code, as long as:

  1. Nobody thinks that Dan is responsible for your project,
  2. Nobody thinks that Dan endorses your use of his code, and
  3. Nobody bothers Dan about problems with your project, including code borrowed from him.

The BSD license, together with the DBD (``Don't Bother Dan'') clause, is included in the safecat distribution. You can also read it here.

Links

If you are interested in learning more about maildir or qmail, you can visit the following sites.

Contact

Send any patches, bugs, complaints, free beer, etc to me. Len Budney lbudney@pobox.com

 

Top


Len Budney
lbudney@pobox.com
Copyright © 1998 - 2004
Page generated: 19:54:49 09-Apr-2006