| Summary: | sha*sum programs list "--color" as an option, but they don't print in color | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Jeff Robins <jeffrobinsSAE> |
| Component: | RPM Packages | Assignee: | Thomas Backlund <tmb> |
| Status: | RESOLVED OLD | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Low | CC: | lewyssmith |
| Version: | 7 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | coreutils | CVE: | |
| Status comment: | |||
| Attachments: | sha256sum --color | ||
|
Description
Jeff Robins
2019-09-07 10:09:07 CEST
https://www.gnu.org/software/coreutils/sha256sum has the documentation. Command-line options are from the md5sum section: https://www.gnu.org/software/coreutils/manual/html_node/md5sum-invocation.html#md5sum-invocation Created attachment 11270 [details]
sha256sum --color
I don't have issues seeing colors in the output.
Okay, so it only shows colors when generating the checksums and not when checking them? I would have figured it would colorize the pass/fail output. Is this something we add to the code? I can't find reference to the colorization anywhere and that's why I didn't know this was the expected behavior. If we do this, then I'd like to modify it so that the pass/fail gets colorized too. This produces no colorized output: sha256sum <input_file> > <output_file> sha256sum --check --color <output_file> Also, the colorized portions are reproducible, but the widths aren't equal. sha256sum puts the colored chunks at mostly 3-bytes long, but one of them is 6-bytes long and one is only 2-byts long. sha512 has chunks 15-Bytes long. Trying this M7 MATE:
The man pages are imprecise about what the --color option does:
--color print with colors
It is a curious addition of doubtful worth, except perhaps as an aid to reading the long checksums; as stated above, GNU makes no reference to it.
I do not think we are bound to any particular behaviour; and I do think the present behaviour is sensible in the context.
$ md5sum --color Mageia-7-rc-x86_64.iso
b3448bcf6c61e3681109a709b3291440 Mageia-7-rc-x86_64.iso
The colours were grouped 6-12-6-6-2
$ sha1sum --color Mageia-7-rc-x86_64.iso
f274600e4655cb411f6acaa10d2176d34af23d46 Mageia-7-rc-x86_64.iso
Grouped 6-6-6-6-6-6-4
$ sha256sum --color Mageia-7-rc-x86_64.iso
f20b223f4aedd01c5d70da35d8629a8f2d75a605caff9e0c3d5ea5e3c20647b6 Mageia-7-rc-x86_64.iso
Grouped 6-6-6-6-6-6-6-6-6-6-4
$ sha512sum --color Mageia-7-rc-x86_64.iso
2b225ffa4d35b076d9619a24411170b97d0962442cc13d19b02f19ba41e3d9358aa0b754eeddcaf580da3cd1cf8d79b144139710b9beee38faf60a975f819554
Grouped 6-6-6-6-6-24-12-12-6-6-6-6-6-12-6-2
So the whole lot are in 6 (or multiple) byte chunks, the trailing bytes in white. The fact of having multiple-6 chunks sometimes is probably due to a random colour selection for 6 bytes landing on the same colour again.
@Jeff : This is not a bug. However:
> I'd like to modify it so that the pass/fail gets colorized too.
This is a decent offer. You need to be very precise about what you propose because these checksum commands have several several different ways of being used, and the output varies accordingly. For example, where the directory contians both the checksum and its host file:
$ ls
DATE.txt Mageia-7-rc-x86_64.iso.md5
Mageia-7-beta2-x86_64.iso.sha1 Mageia-7-rc-x86_64.iso.sha3
Mageia-7-rc-x86_64.idx Mageia-7-rc-x86_64.iso.sha512
Mageia-7-rc-x86_64.iso
$ md5sum -c *.md5
Mageia-7-rc-x86_64.iso: OK
If you really want to do this, you can re-open the bug as an enhancement request and make your proposition.CC:
(none) =>
lewyssmith I request enhancing the checksum programs in the coreutils package to enable colorization of the outputs, such that: 1) Lines the print "OK" print either the entire line or just the "OK" in green 2) Lines that print "FAILED" print wither the entire line or just the "FAILED" in red 3) Lines that print "WARNING" print wither the entire line or just the "WARNING" in yellow Resolution:
INVALID =>
(none) The colorization would depend on the "--color" option being specified on the command line Jeff
Did I misunderstand:
> I'd like to modify it so that the pass/fail gets colorized too.
? which looks like *you* were offering to do the change; and which is why I proposed changing the bug to enhancement request. Are you?
OTOH If you meant "I would like it to be modified..." (as comments 5/6) by existing packagers, then your chances are slim. It is extremely trivial, and the same thing could be asked for ubiquitously; which is clearly not on.
Assigning to tmb anyway for 'coreutils'.Assignee:
bugsquad =>
tmb If tmb doesn't want to or have the time to make the change and we modify this package, then I'll work on it and submit a patch to tmb and see what he wants to do. I'll use it locally, but I don't want to modify his package and I don't have time to finish the packager training so that I can maintain it. I haven't taken a look at the source we use or the source from gnu.org. I would assume we aren't modifying the source of these programs except no one else seems to have any documentation on the "--color" option. That's why my original question asked if we modified the source to add the "--color" option. Mageia 7 is EOL since July 1st 2021. There will not have any further bugfix for this release. You are encouraged to upgrade to Mageia 8 as soon as possible. @reporter, if this bug still apply with Mageia 8, please let us know it. @packager, if you work on the Mageia 7 version of your package, please check the Mageia 8 package if issue is also present. In this case, please fix the Mageia 8 version instead. This bug report will be closed OLD if there is no further notice within 1st September 2021. Hi bug reporter and hi assignee and others involved, Please reopen this bug report if it is still valid for Mageia 8 or 9(cauldron), and change "Version:" in the upper left of this report accordingly. This report is being closed as OLD because it was filed against Mageia 7, for which support ended on June 30th 2021. Thanks, Marja Status:
REOPENED =>
RESOLVED |