A little tool to access gdbm files from shell.
# $Header: /CVSROOT/dbm/DESCRIPTION,v 1.6 2008-05-19 09:47:25 tino Exp $
# $Log: DESCRIPTION,v $
# Revision 1.6 2008-05-19 09:47:25 tino
# find now returns 1 if nothing found
#
# Revision 1.5 2007-04-07 19:07:33 tino
# typo
#
# Revision 1.4 2007/04/07 19:03:58 tino
# Output pipe breaks now shall terminate DBM correctly
#
# Revision 1.3 2007/01/18 18:11:40 tino
# Prep new dist
#
# Revision 1.2 2006/04/11 23:26:00 tino
# commit for dist
#
# Revision 1.1 2004/12/13 23:57:54 tino
# added
If you have an Online Virus Scanner under Windows, never use
options -t, -q or -a. With these options and a Virus Scanner you will
observe strange things to happen. Under Linux (or Unix) there is no
such problem.
If a DBM process cannot lock a DBM file, it enters a rapid open/close
busy cycle (GDBM is lacking support for blocking locks) until the
timeout occurs. This triggers a race condition with Online Virus
Protection Solutions for Windows such that it becomes unlikely that
DBM can get a successful lock on the DBM file.
Note that DBM works as designed, this is no bug of DBM.
However the incompatibility in the Virus Protection cannot be fixed
without rendering them nearly useless. So the bug is in the idea of
Online Virus Protection. This means: Under Windows you currently
cannot have both: DBM processes concurrently accessing a DBM file and
an Online Filesystem Antivirus.
If only a single DBM process accesses a DBM file (so you do not need a
timeout option at all), then you do not need to worry about.
Note that DBM is deprecated, but I have no time to create a
replacement
DBM began as a quick hack just to access gdbm files from the
commandline. And it still is evolving as a quick hack.
It now has some batch and filter functions to be used in shell pipes,
but it is very little tested for now.
When you compile it, just ignore the error that make cannot cd into
"tino". That's ugly, but as it's just a quickhack no tinolib shall be
required to compile it, and thus the current version of tinolib is not
part of this distribution. Also note that there currently is no
tinolib distribution, as it's far from beeing ready. For now it just
comes with other of my sources.
Short example what DBM can do for you, a JPG file checker:
./dbm create db.ok
./dbm create db.fail
find / -type f -name '*.jpg' -print |
./dbm filter db.ok |
./dbm filter db.fail |
sort |
while read -r a
do
if djpeg "$a" >/dev/null
then
./dbm insert DB/ok "$a" 1
else
./dbm insert DB/fail "$a" 1
fi
done
The "sort" is a hack to "buffer" the output, such that the database
files are closed when the loop runs such that the insert can be
writer. You don't need this anymore if you give '-a-1' to each
of the dbm commands.