Greetings,
I implemented a simple common option (-K) for the client tools that if enabled, sets the file descriptor used to output errors to stdout instead of the default (and currently used) stderr.
This is done because when running a batch of commands with the output sent to a file, logs collected are not shown chronologically because the output is split between stdout and stderr. This occurs because both stdout and stderr do not have the same buffer behavior and unfortunately, there is no means within any shell to get them to behave in concert.
Here is an example of the output of ldapmodify saved in a file using the current code:
ldapmodify: Type or value exists (20) ldapmodify: Type or value exists (20) ldapmodify: Type or value exists (20) modifying entry "uid=User01,ou=MyOrganization,o=example.com "
modifying entry "uid=User03,ou=MyOrganization,o=example.com "
modifying entry "uid=User04,ou=MyOrganization,o=example.com "
modifying entry "uid=User03,ou=MyOrganization,o=example.com "
modifying entry "uid=User02,ou=MyOrganization,o=example.com "
modifying entry "uid=User05,ou=MyOrganization,o=example.com "
modifying entry "uid=User21,ou=MyOrganization,o=example.com "
modifying entry "uid=User22,ou=MyOrganization,o=example.com "
Now when instructing ldapmodify to redirect errors to stdout, the following output shows up.
modifying entry "uid=User01,ou=MyOrganization,o=example.com "
modifying entry "uid=User03,ou=MyOrganization,o=example.com " ldapmodify: Type or value exists (20)
modifying entry "uid=User04,ou=MyOrganization,o=example.com " ldapmodify: Type or value exists (20)
modifying entry "uid=User03,ou=MyOrganization,o=example.com "
modifying entry "uid=User02,ou=MyOrganization,o=example.com " ldapmodify: Type or value exists (20)
modifying entry "uid=User05,ou=MyOrganization,o=example.com "
modifying entry "uid=User21,ou=MyOrganization,o=example.com "
modifying entry "uid=User22,ou=MyOrganization,o=example.com "
As you can see, in the first case it is impossible to tell which of the multiple operations failed. With my little feature, now it is possible. Many persons on the web complain about this and I believe that my feature will be well received. Default for errors still remain stderr, so normal usage will remain undisturbed.
The change to the code is very simple. I change common.c and common.h, added the -K options and replaced stderr with errorfp (default to stderr) in many of the tools' source code. Very low risk of breaking anything. I have been using ldapsearch and ldapmodify a lot with my option. Why -K? Because it is one of the rare letters still available in the long list of options.
I would like to submit my changes for review and hopefully, if accepted, that it becomes part of the trunk. However, I do not know how to proceed. Though I am familiar with other configuration management tools, I am not familiar with git, thus if any operation with this tools is required, please provide me examples of commands I should do.
Best regards, Hans Deragon http://www.deragon.biz