Home Explore Blog CI



man-pages

88th chunk of `rsync.man`
f206e6ca07173bdcbb7b47f960c6a12225f9c593e6a047260000000100000fdc
 can  use  this  to
       modify  the exclude list if a change in what gets deleted by --delete is
       desired.  A normal user can ignore this detail and just  use  the  shell
       script  as  an  easy way to run the appropriate --read‐batch command for
       the batched data.

       The original batch mode in rsync was based on "rsync+", but  the  latest
       version uses a new implementation.

SYMBOLIC LINKS
       Three basic behaviors are possible when rsync encounters a symbolic link
       in the source directory.

       By default, symbolic links are not transferred at all.  A message "skip‐
       ping non‐regular" file is emitted for any symlinks that exist.

       If  --links  is  specified, then symlinks are added to the transfer (in‐
       stead of being noisily ignored), and the default handling is to recreate
       them with the same target on the destination.  Note that  --archive  im‐
       plies --links.

       If  --copy‐links  is specified, then symlinks are "collapsed" by copying
       their referent, rather than the symlink.

       Rsync can also distinguish "safe" and "unsafe" symbolic links.  An exam‐
       ple where this might be used is a web site mirror that wishes to  ensure
       that  the rsync module that is copied does not include symbolic links to
       /etc/passwd in the public section of  the  site.   Using  --copy‐unsafe‐
       links will cause any links to be copied as the file they point to on the
       destination.   Using  --safe‐links will cause unsafe links to be omitted
       by the receiver.  (Note that you  must  specify  or  imply  --links  for
       --safe‐links to have any effect.)

       Symbolic  links  are  considered  unsafe  if  they are absolute symlinks
       (start with /), empty, or if they contain enough ".." components to  as‐
       cend from the top of the transfer.

       Here’s  a  summary of how the symlink options are interpreted.  The list
       is in order of precedence, so if your combination of options isn’t  men‐
       tioned, use the first line that is a complete subset of your options:

       --copy‐links
              Turn  all  symlinks into normal files and directories (leaving no
              symlinks in the transfer for any other options to affect).

       --copy‐dirlinks
              Turn just symlinks to directories into real directories,  leaving
              all other symlinks to be handled as described below.

       --links --copy‐unsafe‐links
              Turn all unsafe symlinks into files and create all safe symlinks.

       --copy‐unsafe‐links
              Turn  all  unsafe symlinks into files, noisily skip all safe sym‐
              links.

       --links --safe‐links
              The receiver skips creating unsafe symlinks found in the transfer
              and creates the safe ones.

       --links
              Create all symlinks.

       For the effect of --munge‐links, see the  discussion  in  that  option’s
       section.

       Note  that  the  --keep‐dirlinks  option does not effect symlinks in the
       transfer but instead affects how rsync treats a symlink to  a  directory
       that  already  exists  on the receiving side.  See that option’s section
       for a warning.

DIAGNOSTICS
       Rsync occasionally produces error messages that may seem a little  cryp‐
       tic.   The  one that seems to cause the most confusion is "protocol ver‐
       sion mismatch -- is your shell clean?".

       This message is usually caused by your startup scripts or  remote  shell
       facility  producing  unwanted  garbage on the stream that rsync is using
       for its transport.  The way to diagnose this problem is to run your  re‐
       mote shell like this:

           ssh remotehost /bin/true > out.dat

       then  look  at out.dat.  If everything is working correctly then out.dat
       should be a zero length file.  If you are getting the above  error  from
       rsync  then  you  will

Title: Symbolic Link Handling and Diagnostics in Rsync
Summary
This section describes how rsync handles symbolic links, detailing the effects of options like --links, --copy-links, --copy-dirlinks, --safe-links, and --copy-unsafe-links. It explains how these options determine whether symlinks are transferred as links, copied as files, or omitted based on safety criteria (absolute paths, empty links, or paths ascending from the transfer root). The order of precedence of these options is provided. The section also mentions --keep-dirlinks, clarifying its effect on pre-existing symlinks on the receiving side. Finally, the passage addresses a common rsync error message, "protocol version mismatch -- is your shell clean?", explaining its cause (unwanted output from startup scripts or remote shells) and providing a diagnostic method using ssh.