coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add --color option to md5sum and shaXsum


From: Florent Monnier
Subject: Re: add --color option to md5sum and shaXsum
Date: Tue, 24 Dec 2013 16:48:40 +0100

On 12/24/2013, Eric Blake wrote:
> On 12/24/2013 05:25 AM, Florent Monnier wrote:
>> Hello,
>>
>> This patch adds a --color option to the commands md5sum and shaXsum.
>> The goal is to make it easier to visually identify similarities in a
>> list of printed checksums.
>
> Thanks for the patch.  Several comments:
>
> The patch is non-trivial in size; you'll need copyright assignment to
> the FSF before we can apply it.  I quit looking at the patch contents
> once I saw the size, so as not to taint myself if we end up needing to
> reimplement it due to copyright reasons.

I don't mind giving copyright assignment to the FSF.

(As long as my name is written somewhere for attribution of what I provided.)


>> It takes action only if stdout is a tty.
>
> Better would be to copy how other coreutils program use --color, such as
> ls.  The option needs to take an optional argument, so that we can do
> things like --color=always to force color codes even when not outputting
> to a tty (great for testing, also good for pipelines).

I am totally fine to rewrite the code to fit any of your requirements.

But before to invest a lot of time rewriting it, I would like to know
if you are interested by such a feature.

I would feel bad if after spending time rewriting it, the decision is
to not integrate it.


> You are missing documentation of the new option in coreutils.texi and a
> mention of the feature in NEWS.  Adding a new test to the testsuite to
> ensure that the option does what you want would also be worthwhile.

If you are interested by the proposed color feature I'll write
everything you'll request.


> Your description did not say WHAT gets colored, and since I didn't read
> the body of the patch myself, I'm curious as to more details on what you
> are coloring.

Each group of 3 octets in the checksums are displayed with a color
matching these 3 octets used as if it was RGB values.
As the terminal has limitations, we just display the closest terminal color.

(3 octets so 6 hexadecimal ascii characters in the terminal)


>                This is one case where a screenshot would help your case
> (although it may be best if you post the screenshot on an image hosting
> service and just post the URL to that location, to minimize list
> bandwidth usage - not everyone likes downloading large images).

Maybe instead of a screen-shot you would accept a term-shot converted
to html with "ansi2html.sh" ?

http://www.linux-nantes.org/~fmonnier/color-dig.html

I just pad with bold at the end if the number of octet is not a multiple of 3
(while RGB needs 3 components).


>> This patch can be applied on the version 8.22 of the coreutils.
>
> We prefer patches that are against the latest coreutils.git.  Please
> read the HACKING document for more details:
> http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING

I will spend as many time as needed to adapt the patch, but maybe you
could tell me if the coreutils team is interested by this feature?

The patch can be applied to the git version as well
as it seems that the file "md5sum.c" is the same:

2c2c51be1a4bfe3cc739c039fdfa8791  coreutils-8.22/src/md5sum.c
2c2c51be1a4bfe3cc739c039fdfa8791  coreutils.git/src/md5sum.c

-- 
Regards
Florent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]