According to the man page for htdbm:
NAME htdbm - Manipulate DBM password databases
SYNOPSIS <snipped>
htdbm -l [ -TDBTYPE ] <snipped>
-l Print each of the usernames and comments from the database on stdout.
yet when I execute htdbm I am finding that the output of the command is going to stderr not stdout. I have proved this by trying the following two commands:
$ htdbm -l -TDB passwords > junk; wc junk Dumping records from database -- ./passwords Username Comment <snipped>
0 0 0 junk
$ /usr/bin/htdbm -l -TDB ./passwords >&junk; wc junk 28 37 1034 junk
Note in the first command the output still goes to the screen despite the stdout redirect with ">". In the second command line I added the "&" ito redirect stderr to the file. This time note that there is no htdbm output to the screen and that the file junk now contains the expected data. This is clearly a bug. Does anyone know of a work around to this problem or where I can find a RPM for dbmmanage?
On Sat, 2006-01-21 at 16:21 -0700, Paul R. Ganci wrote:
According to the man page for htdbm:
NAME htdbm - Manipulate DBM password databases
SYNOPSIS <snipped>
htdbm -l [ -TDBTYPE ]
<snipped>
-l Print each of the usernames and comments from the database
on stdout.
yet when I execute htdbm I am finding that the output of the command is going to stderr not stdout. I have proved this by trying the following two commands:
$ htdbm -l -TDB passwords > junk; wc junk Dumping records from database -- ./passwords Username Comment <snipped>
0 0 0 junk
$ /usr/bin/htdbm -l -TDB ./passwords >&junk; wc junk 28 37 1034 junk
Note in the first command the output still goes to the screen despite the stdout redirect with ">". In the second command line I added the "&" ito redirect stderr to the file. This time note that there is no htdbm output to the screen and that the file junk now contains the expected data. This is clearly a bug. Does anyone know of a work around to this problem or where I can find a RPM for dbmmanage?
It may or may not be a bug (it does what you say, but I am not smart enough about it to know if it is a bug or a feature), but this is part of the main httpd (apache) rpm. So there would not be an RPM that specifically fixes this.
There are many different configure switches dealing with stderr and htdbm in apache when compiling it (we compile it exactly as they do upstream).
Doing a little bit more research, there is a switch ( -n ) that allows output to stdout ... maybe you need to use that switch if you want to get output to stdout.
Johnny Hughes wrote:
It may or may not be a bug (it does what you say, but I am not smart enough about it to know if it is a bug or a feature), but this is part
Neither am I. I didn't want to go file a bugzilla report if the code is actually working the way it is supposed to work.
of the main httpd (apache) rpm. So there would not be an RPM that specifically fixes this.
I thought there was a small chance that this was a known problem and that perhaps there was a "test" version of apache with the fix.
Doing a little bit more research, there is a switch ( -n ) that allows output to stdout ... maybe you need to use that switch if you want to get output to stdout.
Yes I was aware of the switch. I left it out of my original post because my impression of the man page was that switch was only used to redirect a command like:
htdbm -nb [ -c ] [ -m | -d | -p | -s ] [ -t ] [ -v ] username password
to stdout as opposed to
htdbm -b [ -TDBTYPE ] [ -c ] [ -m | -d | -p | -s ] [ -t ] [ -v ] filename username password
which actually modifies the database.
I considered it a "test" mode for a particular htdbm usage per the command Synopsis.
In any event I am calling htdbm -l -TDBTYPE from a perl CGI script and just modified that script to redirect stderr ala 2>&1. It just took me a while before the lights came on to what was occurring. I didn't think to try -l -n on the same command so I can give that a shot... that is probably a better solution for the problem if it works. Thanks for the idea Johnny.