On Mon, Dec 12, 2022 at 9:02 PM All <olp...@yahoo.ca> wrote:

> I wanted to clarify.
>
> In manpage for rdist I see that we can use option -o remove .
> remove  Remove extraneous files.  If a directory is being
>                      updated, any files that exist on the remote host that
> do
>                      not exist in the master directory are removed.  This
> is
>                      useful for maintaining truly identical copies of
>                      directories.
> However, this seems to be the default anyway.
>
> If I specify "install /tmp/" and try to copy /tmp/test.file all the files
> in /tmp/
> on the remote host will be wiped out and only test.file will remain there
> after copy.
> This behaviour seems to fit with "directory update" feature of "remove"
> (like
> if we do "install -o remove /tmp/"). Yet, "remove" was not specified above.
>
> Is my understanding of default behaviour correct?  This how it supposed to
> be working?
>

When reporting an issue, please include precise information about both
 * what your desired end result / goal was, and
 * what you tried, including how you invoked the command and/or the config
used.

If you leave out the former, then we'll be guessing as to why the result
wasn't what you wanted.
If you leave out the latter, then we'll be guessing as to what you did that
didn't work as desired.
...or be prepared to be accepting of people guessing wrong.

ALSO: rdist has been largely superseded by rsync, which has a much more
efficient underlying protocol and, in my experience, a more regular set of
behaviors.  Before committing to rdist and its (limited by history)
behavior, you should consider using rsync instead.


It seems you
 * wanted to copy /tmp/test.file to /tmp/test.file on one or more other
hosts?
 * you tried a distfile like this:
      whatever:  ( /tmp/test.file ) -> HOSTNAME
            install /tmp/;
    ?

You're correct that the latter does not achieve the former.  To achieve the
former, you would need to either
 * leave off the opt_dest_name from the 'install' directive, so that rdist
would know to install the source to
   the exact same path on the target host
 * specify the full target path in the 'install' directive, ala "install
/tmp/test.file"
 * have multiple source files, so that it treated opt_dest_name as a target
directory and not a target path (like cp)


So, what happened with what you _did_ try?  Well, it was taken as a request
install the contents of the file "/tmp/test.file" as a file "/tmp/"!  rdist
is smart enough to know that it can't remove a directory without first
removing its contents, so it tried that and presumably failed.  If it
_could_ remove the contents it would then remove the directory...and then
fail when it tried to create a tempfile with prefix "/tmp/".

Could rdist's behavior be improved?  In some ways, yes, but lots of
sharp corners (e.g., single vs multiple source handling) would remain.
Frankly, if rsync serves your purposes, you should use it instead.


Philip Guenther

Reply via email to