5
12
Fork
You've already forked ssh-tools
3

The tool "colordiff" is unnecessary - diff from the package "diffutils" supports color #2

Closed
opened 2024年08月06日 05:24:49 +02:00 by m040601 · 2 comments

First of all, thank you for the work on this interesting and intriguing tool.
I am testing it on Archlinux.

TLDR: I am 99% sure you can remove "colordiff" from "ssh-tools". Please review and confirm

I noticed that the Archlinux official package has "colordiff", https://www.colordiff.org/ as an "optional" dependency for your tool.

optdepends=(
 'colordiff: for diff files'

That got me intrigued.

This seems unnecessary and redundant. "Colordiff" was/is a perl tool needed when diff didnt support color. It seems completely redundant now. diff --color option was added to GNU diffutils 3.4 (2016年08月08日) . By now 99.9% ofl all Linux distros should have it, I guess.

man diff

 --color[=WHEN]
 color output; WHEN is 'never', 'always', or 'auto'; plain
 --color means --color='auto'
 --palette=PALETTE
 the colors to use when --color is active; PALETTE is a
 colon-separated list of terminfo capabilities

I noticed that you have on your code stuff like,

function supports_colordiff() {
 type colordiff &> /dev/null
}

An the call the tool "colordiff" like this

xxxyyyzzz | colordiff

As you say on the man page "ssh-diff":

 Diff Options:
 All options your local diff command supports ( except '-r' ).
 See 'man diff' and 'diff --help' for more information.

So, I made sure to remove the tool "colordiff" from my system. And tried:

ssh-diff --color=always /etc/os-release SOME_SSH_HOST

Seem to work perfectly. So here I conclude the tool "colordiff" is completely irrelevant.

First of all, thank you for the work on this interesting and intriguing tool. I am testing it on Archlinux. TLDR: I am 99% sure you can remove "colordiff" from "ssh-tools". Please review and confirm I noticed that the Archlinux official package has "colordiff", https://www.colordiff.org/ as an "optional" dependency for your tool. ``` optdepends=( 'colordiff: for diff files' ``` That got me intrigued. This seems unnecessary and redundant. "Colordiff" was/is a perl tool needed when diff didnt support color. It seems completely redundant now. diff --color option was added to GNU diffutils 3.4 (2016年08月08日) . By now 99.9% ofl all Linux distros should have it, I guess. man diff ``` --color[=WHEN] color output; WHEN is 'never', 'always', or 'auto'; plain --color means --color='auto' --palette=PALETTE the colors to use when --color is active; PALETTE is a colon-separated list of terminfo capabilities ``` I noticed that you have on your code stuff like, ``` function supports_colordiff() { type colordiff &> /dev/null } ``` An the call the tool "colordiff" like this ``` xxxyyyzzz | colordiff ``` As you say on the man page "ssh-diff": ``` Diff Options: All options your local diff command supports ( except '-r' ). See 'man diff' and 'diff --help' for more information. ``` So, I made sure to remove the tool "colordiff" from my system. And tried: ``` ssh-diff --color=always /etc/os-release SOME_SSH_HOST ``` Seem to work perfectly. So here I conclude the tool "colordiff" is completely irrelevant.
Owner
Copy link

Hi,

I want the ssh-tools to work on many systems as possible.
I will check out if the standard diff command is sufficient for color support on these systems
and remove colordiff as dependency when really not needed.

Thanks for this information, I really appreciate it.

Hi, I want the ssh-tools to work on many systems as possible. I will check out if the standard diff command is sufficient for color support on these systems and remove colordiff as dependency when really not needed. Thanks for this information, I really appreciate it.
Owner
Copy link

Well, I had some time today to check it out.

The only difference (pun intended) between colordiff and diffutils
seems to be that colordiff also highlights the header.

No big reason to keep colordiff in my opinion.

But here are some cases where diffutils is not default or has to be called differently:

Alpine Linux

  • has Busybox diff by default ( no --color )
  • Instead of colordiff as optional dependency it could be diffutils

FreeBSD

  • uses BSD diff by default ( no --color )
  • diffutils is available as package but the command is gdiff
  • has colordiff package

OpenBSD

  • uses BSD diff by default ( no --color )
  • diffutils is available as package gdiff but the command is gdiff
  • has colordiff package

DragonFlyBSD

  • has GNU diff by default

So here I conclude the tool "colordiff" is completely irrelevant.

In most cases it is irrelevant when diffutils is available, but not for some of the BSD systems.
Since colordiff is not a hard dependency and the --color option can be used
if diffutils is available, I won't remove colordiff from the code.
I can drop a hint for packagers somewhere that colordiff is not a required dependency.

Well, I had some time today to check it out. The only difference (pun intended) between colordiff and diffutils seems to be that colordiff also highlights the header. No big reason to keep colordiff in my opinion. But here are some cases where diffutils is not default or has to be called differently: ## Alpine Linux - has Busybox diff by default ( no --color ) - Instead of colordiff as optional dependency it could be diffutils ## FreeBSD - uses BSD diff by default ( no --color ) - diffutils is available as package but the command is gdiff - has colordiff package ## OpenBSD - uses BSD diff by default ( no --color ) - diffutils is available as package gdiff but the command is gdiff - has colordiff package ## DragonFlyBSD - has GNU diff by default > So here I conclude the tool "colordiff" is completely irrelevant. In most cases it is irrelevant when diffutils is available, but not for some of the BSD systems. Since colordiff is not a hard dependency and the --color option can be used if diffutils is available, I won't remove colordiff from the code. I can drop a hint for packagers somewhere that colordiff is not a required dependency.
Sign in to join this conversation.
No Branch/Tag specified
master
1.9
v1.9
v1.8
v1.7
v1.6
v1.5
v1.4
v1.3
v1.2
v1.1
v1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vaporup/ssh-tools#2
Reference in a new issue
vaporup/ssh-tools
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?