The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: "Alan D. Salewski" <ads@salewski.email>
To: "TUHS (The Unix Heritage Society)" <tuhs@tuhs.org>
Subject: [TUHS] Re: Be there a "remote diff" utility?
Date: Wed, 19 Jun 2024 19:20:24 -0400	[thread overview]
Message-ID: <e9c7a62d-5c67-437c-8753-faf7dc185a49@app.fastmail.com> (raw)
In-Reply-To: <20240516195309.GB287325@mit.edu>

On Thu, May 16, 2024, at 15:53, Theodore Ts'o wrote:
> On Thu, May 16, 2024 at 04:34:54PM +1000, Dave Horsfall wrote:
>> Every so often I want to compare files on remote machines, but all I can 
>> do is to fetch them first (usually into /tmp); I'd like to do something 
>> like:
>> 
>>     rdiff host1:file1 host2:file2
>> 
>> Breathes there such a beast?  I see that Penguin/OS has already taken 
>> "rdiff" which doesn't seem to do what I want.
[...]

> In any case, the way I'd suggest that you do this that works as an
> extention to the Unix philosohy of "Everything looks like a file" is
> to use FUSE:
>
> sshfs host1:/ ~/mnt/host1
> sshfs host2:/ ~/mnt/host2
> diff ~/mnt/host1/file1 ~/mnt/host2/file2
>
> Cheers,
>
> 					- Ted

Mentioning this since I just came across it today: Eric S. Raymond
(ESR) has a 'netdiff' tool available here:

     http://www.catb.org/~esr/netdiff/
     https://gitlab.com/esr/netdiff

<quote>
    Perform diff across network links.

    Takes two arguments which may be host:path pairs in the style of
    ssh/scp, make temporary local copies as needed, applies
    diff(1). All options are passed to diff(1).
</quote>

Usage:
    netdiff [diff-options] [host1:]path1 [host2:]path2

It's 56 lines of POSIX shell script that invokes 'scp' behind the
scenes and creates temp files that are fed to 'diff', with some file
name post-processing.

Compared to the one line of shell script mentioned by Arnold:

    diff -u <(ssh host1 cat file1) <(ssh host2 cat file2)

the main benefits I see to 'netdiff' in its current form are that it
encapsulates the mechanism behind a descriptive name that can be
found in the file system, and it has a man page. So it can be found,
used and/or studied by those with larval shell fu.

However, the comments in the 'netdiff' source suggest openness to
supporting different transport mechanisms, which (if added) might
allow using the same command line interface regardless of the
underlying transport being used (scp, ssh, rsync, curl, wget,
whatever), possibly with different transports for each of the
requested files.

Of course, that would not offer a superior user experience to the
'9import', 'sshfs', and NFS approaches also mentioned.

But if there were an 'rf' ("remote file") tool that did just the
transport abstraction portion, then tools such as 'netdiff' could
use it internally, or folks could use it directly:

    diff -u <(rf user@host1:/path/to/file1) <(rf user@host2:/path/to/file2)

The presumption here is that the user has control over some local
configuration that maps user@host pairs to transports (maybe
defaulting to 'ssh' invoking 'cat' on the remote host).

Maybe somebody who needs more than 'ssh' would find value in such a
thing...

-Al

-- 
a l a n   d.   s a l e w s k i
ads@salewski.email
salewski@att.net
https://github.com/salewski

  reply	other threads:[~2024-06-19 23:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  6:34 [TUHS] " Dave Horsfall
2024-05-16  6:51 ` [TUHS] " arnold
2024-05-16  7:33   ` Ralph Corderoy
2024-05-16  8:59     ` George Michaelson
2024-05-16  9:01     ` arnold
2024-05-16 17:08       ` ron minnich
2024-05-16 18:51         ` Skip Tavakkolian
2024-05-16 19:51           ` Marc Donner
2024-05-16 19:53 ` Theodore Ts'o
2024-06-19 23:20   ` Alan D. Salewski [this message]
2024-05-16 12:31 Douglas McIlroy
2024-05-16 17:12 ` Bakul Shah via TUHS
2024-05-16 18:12   ` Rich Salz
2024-05-16 18:38     ` Ben Greenfield via TUHS

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9c7a62d-5c67-437c-8753-faf7dc185a49@app.fastmail.com \
    --to=ads@salewski.email \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).