| 1 | package receiverscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "ioscip-go gomod github.com/golang/go/src go1.25.0 io/" |
| 6 | "io/fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/" |
| 7 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 8 | "sortscip-go gomod github.com/golang/go/src go1.25.0 sort/" |
| 9 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 10 | |
| 11 | "github.com/gokrazy/rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/" |
| 12 | "github.com/gokrazy/rsync/internal/rsyncchecksumscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncchecksum`/" |
| 13 | "github.com/gokrazy/rsync/internal/rsyncoptsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/" |
| 14 | ) |
| 15 | |
| 16 | // rsync/flist.c:flist_sort_and_clean |
| 17 | func sortFileListscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/sortFileList().(fileList []*Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#) { |
| 18 | sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Slicescip-go gomod github.com/golang/go/src go1.25.0 sort/Slice().(fileList, func(i, j int) bool { |
| 19 | return fileList[i].Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. < fileList[j].Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. |
| 20 | }) |
| 21 | } |
| 22 | |
| 23 | // rsync/receiver.c:delete_files |
| 24 | func findInFileListscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/findInFileList().(fileList []*Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#, name string) bool { |
| 25 | i := sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Searchscip-go gomod github.com/golang/go/src go1.25.0 sort/Search().(len(fileList), func(i int) bool { |
| 26 | return fileList[i].Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. >= name |
| 27 | }) |
| 28 | return i < len(fileList) && fileList[i].Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. == name |
| 29 | } |
| 30 | |
| 31 | type Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File# struct { |
| 32 | Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. string |
| 33 | Lengthscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Length. int64 |
| 34 | ModTimescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#ModTime. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time# |
| 35 | Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. int32 |
| 36 | Uidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Uid. int32 |
| 37 | Gidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Gid. int32 |
| 38 | LinkTargetscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#LinkTarget. string |
| 39 | Rdevscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Rdev. int32 |
| 40 | Checksumscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Checksum. [rsyncchecksumscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncchecksum`/.Sizescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncchecksum`/Size.]byte |
| 41 | } |
| 42 | |
| 43 | // FileMode converts from the Linux permission bits to Go’s permission bits. |
| 44 | func (f *Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#) FileModescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#FileMode().() fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode# { |
| 45 | ret := fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#(f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode.) & fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModePermscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModePerm. |
| 46 | |
| 47 | mode := f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. & rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFMTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFMT. |
| 48 | switch mode { |
| 49 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFCHRscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFCHR.: |
| 50 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeCharDevicescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeCharDevice. |
| 51 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFBLKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFBLK.: |
| 52 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeDevicescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeDevice. |
| 53 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFIFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFIFO.: |
| 54 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeNamedPipescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeNamedPipe. |
| 55 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFSOCKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFSOCK.: |
| 56 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeSocketscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeSocket. |
| 57 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFLNKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFLNK.: |
| 58 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeSymlinkscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeSymlink. |
| 59 | case rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFDIRscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFDIR.: |
| 60 | ret |= fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.ModeDirscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/ModeDir. |
| 61 | } |
| 62 | |
| 63 | return ret |
| 64 | } |
| 65 | |
| 66 | // rsync/flist.c:receive_file_entry |
| 67 | func (rt *Transferscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#) receiveFileEntryscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#receiveFileEntry().(flags uint16, last *Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#) (*Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#, error) { |
| 68 | f := &Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#{} |
| 69 | |
| 70 | var l1 int |
| 71 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_NAMEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_NAME. != 0 { |
| 72 | l, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadBytescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadByte().() |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | l1 = int(l) |
| 77 | } |
| 78 | |
| 79 | var l2 int |
| 80 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_LONG_NAMEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_LONG_NAME. != 0 { |
| 81 | l, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 82 | if err != nil { |
| 83 | return nil, err |
| 84 | } |
| 85 | l2 = int(l) |
| 86 | } else { |
| 87 | l, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadBytescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadByte().() |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | l2 = int(l) |
| 92 | } |
| 93 | // linux/limits.h |
| 94 | const PATH_MAX = 4096 |
| 95 | if l2 >= PATH_MAX-l1 { |
| 96 | const lastname = "" |
| 97 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("overflow: flags=0x%x l1=%d l2=%d lastname=%s", |
| 98 | flags, l1, l2, lastname) |
| 99 | } |
| 100 | b := make([]byte, l1+l2) |
| 101 | readb := b |
| 102 | if l1 > 0 { |
| 103 | copy(b, []byte(last.Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name.)) |
| 104 | readb = b[l1:] |
| 105 | } |
| 106 | if _, err := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadFullscip-go gomod github.com/golang/go/src go1.25.0 io/ReadFull().(rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..Readerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#Reader., readb); err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | // TODO: does rsync’s clean_fname() and sanitize_path() combination do |
| 110 | // anything more than Go’s filepath.Clean()? |
| 111 | f.Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(string(b)) |
| 112 | |
| 113 | length, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt64scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt64().() |
| 114 | if err != nil { |
| 115 | return nil, err |
| 116 | } |
| 117 | f.Lengthscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Length. = length |
| 118 | |
| 119 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_TIMEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_TIME. != 0 { |
| 120 | f.ModTimescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#ModTime. = last.ModTimescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#ModTime. |
| 121 | } else { |
| 122 | modTime, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 123 | if err != nil { |
| 124 | return nil, err |
| 125 | } |
| 126 | f.ModTimescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#ModTime. = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Unixscip-go gomod github.com/golang/go/src go1.25.0 time/Unix().(int64(modTime), 0) |
| 127 | } |
| 128 | |
| 129 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_MODEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_MODE. != 0 { |
| 130 | f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. = last.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. |
| 131 | } else { |
| 132 | mode, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 133 | if err != nil { |
| 134 | return nil, err |
| 135 | } |
| 136 | f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. = mode |
| 137 | } |
| 138 | |
| 139 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveUidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveUid. { |
| 140 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_UIDscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_UID. != 0 { |
| 141 | f.Uidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Uid. = last.Uidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Uid. |
| 142 | } else { |
| 143 | uid, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | f.Uidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Uid. = uid |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveGidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveGid. { |
| 152 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_GIDscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_GID. != 0 { |
| 153 | f.Gidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Gid. = last.Gidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Gid. |
| 154 | } else { |
| 155 | gid, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 156 | if err != nil { |
| 157 | return nil, err |
| 158 | } |
| 159 | f.Gidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Gid. = gid |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | mode := f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode. & rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFMTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFMT. |
| 164 | isDev := mode == rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFCHRscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFCHR. || mode == rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFBLKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFBLK. |
| 165 | isSpecial := mode == rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFIFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFIFO. || mode == rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFSOCKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFSOCK. |
| 166 | isLink := mode == rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.S_IFLNKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/S_IFLNK. |
| 167 | |
| 168 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveDevicesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveDevices. && (isDev || isSpecial) { |
| 169 | // TODO(protocol >= 28): rdev/major/minor handling |
| 170 | if flags&rsyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/.XMIT_SAME_RDEV_pre28scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync`/XMIT_SAME_RDEV_pre28. != 0 { |
| 171 | f.Rdevscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Rdev. = last.Rdevscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Rdev. |
| 172 | } else { |
| 173 | rdev, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 174 | if err != nil { |
| 175 | return nil, err |
| 176 | } |
| 177 | f.Rdevscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Rdev. = rdev |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveLinksscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveLinks. && isLink { |
| 182 | length, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 183 | if err != nil { |
| 184 | return nil, err |
| 185 | } |
| 186 | b := make([]byte, length) |
| 187 | if _, err := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadFullscip-go gomod github.com/golang/go/src go1.25.0 io/ReadFull().(rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..Readerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#Reader., b); err != nil { |
| 188 | return nil, err |
| 189 | } |
| 190 | f.LinkTargetscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#LinkTarget. = string(b) |
| 191 | } |
| 192 | |
| 193 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..AlwaysChecksumscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#AlwaysChecksum. { |
| 194 | if _, err := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadFullscip-go gomod github.com/golang/go/src go1.25.0 io/ReadFull().(rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..Readerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#Reader., f.Checksumscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Checksum.[:]); err != nil { |
| 195 | return nil, err |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | return f, nil |
| 200 | } |
| 201 | |
| 202 | // rsync/flist.c:recv_file_list |
| 203 | func (rt *Transferscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#) ReceiveFileListscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#ReceiveFileList().() ([]*Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#, error) { |
| 204 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..Progressscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#Progress. { |
| 205 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintln().(rt.Envscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Env..Stdoutscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncos`/Env#Stdout., "receiving file list...") |
| 206 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprint().(rt.Envscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Env..Stdoutscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncos`/Env#Stdout., "0 files to consider") |
| 207 | } |
| 208 | lastFileEntry := new(Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#) |
| 209 | var fileList []*Filescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File# |
| 210 | for { |
| 211 | b, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadBytescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadByte().() |
| 212 | if err != nil { |
| 213 | return nil, err |
| 214 | } |
| 215 | if b == 0 { |
| 216 | break |
| 217 | } |
| 218 | flags := uint16(b) |
| 219 | // rt.Logger.Printf("flags: %x", flags) |
| 220 | // TODO(protocol >= 28): extended flags |
| 221 | |
| 222 | f, err := rt.receiveFileEntryscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#receiveFileEntry().(flags, lastFileEntry) |
| 223 | if err != nil { |
| 224 | return nil, err |
| 225 | } |
| 226 | lastFileEntry = f |
| 227 | // TODO: include depth in output? |
| 228 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..DebugGTEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#DebugGTE.(rsyncoptsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/.DEBUG_FLISTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/DEBUG_FLIST., 1) { |
| 229 | rt.Loggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Logger..Printfscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/log`/Logger#Printf.("[Receiver] i=%d ? %s mode=%o len=%d uid=%d gid=%d flags=?", |
| 230 | len(fileList), |
| 231 | f.Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Name., |
| 232 | f.Modescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Mode., |
| 233 | f.Lengthscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Length., |
| 234 | f.Uidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Uid., |
| 235 | f.Gidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/File#Gid.) |
| 236 | } |
| 237 | fileList = append(fileList, f) |
| 238 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..Progressscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#Progress. && len(fileList)%100 == 0 { |
| 239 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(rt.Envscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Env..Stdoutscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncos`/Env#Stdout., "\r%d files to consider", len(fileList)) |
| 240 | } |
| 241 | } |
| 242 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..Progressscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#Progress. { |
| 243 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(rt.Envscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Env..Stdoutscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncos`/Env#Stdout., "\r%d files to consider\n", len(fileList)) |
| 244 | } |
| 245 | |
| 246 | sortFileListscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/sortFileList().(fileList) |
| 247 | |
| 248 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveUidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveUid. || rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..PreserveGidscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#PreserveGid. { |
| 249 | // receive the uid/gid list |
| 250 | users, groups, err := rt.RecvIdListscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#RecvIdList().() |
| 251 | if err != nil { |
| 252 | return nil, err |
| 253 | } |
| 254 | rt.Usersscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Users. = users |
| 255 | rt.Groupsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Groups. = groups |
| 256 | } |
| 257 | |
| 258 | // read the i/o error flag |
| 259 | ioErrors, err := rt.Connscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Conn..ReadInt32scip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncwire`/Conn#ReadInt32().() |
| 260 | if err != nil { |
| 261 | return nil, err |
| 262 | } |
| 263 | if rt.Optsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Opts..DebugGTEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/TransferOpts#DebugGTE.(rsyncoptsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/.DEBUG_FLISTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/DEBUG_FLIST., 2) { |
| 264 | rt.Loggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#Logger..Printfscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/log`/Logger#Printf.("ioErrors: %v", ioErrors) |
| 265 | } |
| 266 | rt.IOErrorsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/receiver`/Transfer#IOErrors. = ioErrors |
| 267 | |
| 268 | return fileList, nil |
| 269 | } |