misc/157835: Do not copy symlinks or through mtree, or via rsync

Vladislav V. Prodan universite at ukr.net
Mon Jun 13 13:00:24 UTC 2011

>Number:         157835
>Category:       misc
>Synopsis:       Do not copy symlinks or through mtree, or via rsync
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 13 13:00:23 UTC 2011
>Originator:     Vladislav V. Prodan
>Release:        FreeBSD 8.2-STABLE amd64
FreeBSD mary-teresa 8.2-STABLE FreeBSD 8.2-STABLE #0: Tue Jun  7 17:56:08 EEST 2011     root at mary-teresa:/usr/obj/usr/src/sys/otrada.3  amd64

You need to copy the skeleton directories without files contained therein, only subdirectories.
Problems arose with the symlinks.
Symlinks are ignored mtree and rsync.

# df -h /tmp
Filesystem    Size    Used   Avail Capacity  Mounted on
zroot/tmp     366G    168k    366G     0%    /tmp
# zfs get all zroot/tmp
NAME       PROPERTY              VALUE                 SOURCE
zroot/tmp  type                  filesystem            -
zroot/tmp  creation              вт янв  1  3:15 2008  -
zroot/tmp  used                  284K                  -
zroot/tmp  available             366G                  -
zroot/tmp  referenced            168K                  -
zroot/tmp  compressratio         1.04x                 -
zroot/tmp  mounted               yes                   -
zroot/tmp  quota                 none                  default
zroot/tmp  reservation           none                  default
zroot/tmp  recordsize            128K                  default
zroot/tmp  mountpoint            /tmp                  local
zroot/tmp  sharenfs              off                   default
zroot/tmp  checksum              fletcher4             inherited from zroot
zroot/tmp  compression           on                    local
zroot/tmp  atime                 on                    default
zroot/tmp  devices               on                    default
zroot/tmp  exec                  on                    local
zroot/tmp  setuid                off                   local
zroot/tmp  readonly              off                   default
zroot/tmp  jailed                off                   default
zroot/tmp  snapdir               hidden                default
zroot/tmp  aclinherit            restricted            default
zroot/tmp  canmount              on                    default
zroot/tmp  xattr                 off                   temporary
zroot/tmp  copies                1                     default
zroot/tmp  version               4                     -
zroot/tmp  utf8only              off                   -
zroot/tmp  normalization         none                  -
zroot/tmp  casesensitivity       sensitive             -
zroot/tmp  vscan                 off                   default
zroot/tmp  nbmand                off                   default
zroot/tmp  sharesmb              off                   default
zroot/tmp  refquota              none                  default
zroot/tmp  refreservation        none                  default
zroot/tmp  primarycache          all                   default
zroot/tmp  secondarycache        all                   default
zroot/tmp  usedbysnapshots       115K                  -
zroot/tmp  usedbydataset         168K                  -
zroot/tmp  usedbychildren        0                     -
zroot/tmp  usedbyrefreservation  0                     -
zroot/tmp  logbias               latency               default
zroot/tmp  dedup                 off                   default
zroot/tmp  mlslabel                                    -
zroot/tmp  sync                  standard              default

Creating a test directory with a symlink:
symlink="ghgh gugh seee udjd"

mkdir -p /tmp/test/All /tmp/test-copy
cd /tmp/test/All

for i in $symlink; do
    mkdir ../$i
    ln -s ../$i $i

Script copying the skeleton directory using mtree:
mkdir -p $to_dir

cd $from_dir/;
mtree -c -d -i -n -k link,uname,gname,mode,flags > $to_dir/dir.txt

mtree -U -f $to_dir/dir.txt -p $to_dir

OR rsync:


rsync  -vraKz --include='*/' --exclude='*' $from_dir $to_dir



More information about the freebsd-bugs mailing list