I have been trying to contribute to GNU datamash, but I have not yet received any reply to any of the patches I have sent to the bug-datamash mailing list (first, second, third, fourth, fifth). The patches have not been applied upstream. Thus I publish the patches here, but would prefer them to be applied upstream. GNU datamash contains the decorate tool as well.
The man page of datamash confuses the descriptions of the floor and ceil operations. This small patch fixes this.
IPv4 and IPv6 addresses can be seen as IP addresses. Logs from a dual-stack application, e.g., a web server, may contain either an IPv4 or IPv6 address at a given position in each line. Thus if one wants to sort the log file on the IP address, both IPv4 and IPv6 addresses need to be accepted as sort key and sorted consistently. One approach is to transform one address type into the other before sorting. IPv6 supports the transformation of IPv4 addresses into IPv6 addresses.
There are two common methods for accomodating IPv4 addresses in IPv6: IPv4-Mapped addresses and the deprecated IPv4-Compatible addresses. Both can be used to convert a given IPv4 address to an IPv6 address. Both IPv4-Mapped and IPv4-Compatible IPv6 address ranges are reserved by IANA and always represent IPv4 addresses in a dual stack enabled application. IPv4-Compatible addresses just add 96 leading zero bits to the 32 bit IPv4 address to create a 128 bit IPv6 address. This results in an ambiguity for the unspecified address (all-zero in both IPv4 and IPv6) and the IPv6 localhost address ::1 with the first host address of this network in IPv4 (0.0.0.1). IPv4-Mapped addresses avoid this ambiguity. But since IPv4-Compatible IPv6 addresses can be seen as treating the IP address (both version 4 and version 6) as a specific way to represent an integer value I think it is useful to support this transformation as well.
adds two conversion methods to decorate:
ipv6v4comp. The conversion
logically converts an IPv4 address to an IPv6 address, but the code
actually creates a textual representation of an 128 bit integer from
either an IPv4 or IPv6 address.
Functionality like this was requested for sort from GNU Coreutils in 2011 and in 2015, but not accepted and rejected for GNU Coreutils.
Thus it seems appropriate for decorate to provide this functionality.
In one example in the datamash man page, the (upper case) short
-H is written in lower case, i.e., as
but case is significant for options. This trivial
--help output of both GNU datamash and
decorate mentions a man page, but the man page
name given is not completely correct.
For GNU datamash, the help output gives the command
GNU datamash, but the man program gives an error
message for the GNU part of this command:
$ datamash --help | grep 'man ' man GNU datamash $ man GNU datamash No manual entry for GNU $ man 'GNU datamash' No manual entry for GNU datamash
For decorate, the help output uses
as the man page name:
$ ./decorate --help | grep ' man ' man ./decorate
Using the man invocation given in decorate's help output results in giving the decorate executable to man, instead of the man page, which does work as intended. This small patch fixes this.
A couple of typos in the GNU datamash manual were reported to the mailing list. This patch fixes them.
back to my homepage.