[Bug 10785] New: [PATCH] Add a flag to use numeric sort

samba-bugs at samba.org
2014-08-26T17:01:52Z

Summary: [PATCH] Add a flag to use numeric sort
           Product: rsync
           Version: 3.1.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: rom at rom1v.com
         QAContact: rsync-qa at samba.org


Created attachment 10229
  --> https://bugzilla.samba.org/attachment.cgi?id=10229
the patch

I need to sync a lot of files with non-zero-padded numbered filenames.

I would like them to be transferred in order, to be able to use
"partial"
transfers (it takes a lot of time to transfer the whole data).

My concrete need is to rsync duplicity backups. Let's say I have 21 files.
For
now, they are transferred in that order :

duplicity-full.20140531T230029Z.vol1.difftar.gpg
duplicity-full.20140531T230029Z.vol10.difftar.gpg
duplicity-full.20140531T230029Z.vol11.difftar.gpg
duplicity-full.20140531T230029Z.vol12.difftar.gpg
duplicity-full.20140531T230029Z.vol13.difftar.gpg
duplicity-full.20140531T230029Z.vol14.difftar.gpg
duplicity-full.20140531T230029Z.vol15.difftar.gpg
duplicity-full.20140531T230029Z.vol16.difftar.gpg
duplicity-full.20140531T230029Z.vol17.difftar.gpg
duplicity-full.20140531T230029Z.vol18.difftar.gpg
duplicity-full.20140531T230029Z.vol19.difftar.gpg
duplicity-full.20140531T230029Z.vol2.difftar.gpg
duplicity-full.20140531T230029Z.vol20.difftar.gpg
duplicity-full.20140531T230029Z.vol21.difftar.gpg
duplicity-full.20140531T230029Z.vol3.difftar.gpg
duplicity-full.20140531T230029Z.vol4.difftar.gpg
duplicity-full.20140531T230029Z.vol5.difftar.gpg
duplicity-full.20140531T230029Z.vol6.difftar.gpg
duplicity-full.20140531T230029Z.vol7.difftar.gpg
duplicity-full.20140531T230029Z.vol8.difftar.gpg
duplicity-full.20140531T230029Z.vol9.difftar.gpg

This is not good, because if the transfer is partial, they are not exploitable
(I have to sync all files 10 to 19 ? and 100 to 199, 1000 to 1999 ? before
transferring file 2).

Thus, I added a --numeric-sort (-N) option to rsync, to transfer the files in
the expected order.

Patch attached. Feedbacks welcome.