changed debian/source/format to native
This commit is contained in:
parent
e842cb707a
commit
4da7aa6b17
|
@ -1,71 +0,0 @@
|
|||
>From 6a043145ca6e9c55184013841a67b2fef87e44c0 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 21 Sep 2016 23:35:50 -0700
|
||||
Subject: [PATCH] Remove offset pointer optimization in inftrees.c.
|
||||
|
||||
inftrees.c was subtracting an offset from a pointer to an array,
|
||||
in order to provide a pointer that allowed indexing starting at
|
||||
the offset. This is not compliant with the C standard, for which
|
||||
the behavior of a pointer decremented before its allocated memory
|
||||
is undefined. Per the recommendation of a security audit of the
|
||||
zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this tiny optimization was removed, in order
|
||||
to avoid the possibility of undefined behavior.
|
||||
---
|
||||
inftrees.c | 18 ++++++++----------
|
||||
1 file changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
Index: rsync/zlib/inftrees.c
|
||||
===================================================================
|
||||
--- rsync.orig/zlib/inftrees.c
|
||||
+++ rsync/zlib/inftrees.c
|
||||
@@ -54,7 +54,7 @@ unsigned short FAR *work;
|
||||
code FAR *next; /* next available space in table */
|
||||
const unsigned short FAR *base; /* base value table to use */
|
||||
const unsigned short FAR *extra; /* extra bits table to use */
|
||||
- int end; /* use base and extra for symbol > end */
|
||||
+ unsigned match; /* use base and extra for symbol >= match */
|
||||
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
@@ -181,19 +181,17 @@ unsigned short FAR *work;
|
||||
switch (type) {
|
||||
case CODES:
|
||||
base = extra = work; /* dummy value--not used */
|
||||
- end = 19;
|
||||
+ match = 20;
|
||||
break;
|
||||
case LENS:
|
||||
base = lbase;
|
||||
- base -= 257;
|
||||
extra = lext;
|
||||
- extra -= 257;
|
||||
- end = 256;
|
||||
+ match = 257;
|
||||
break;
|
||||
default: /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
- end = -1;
|
||||
+ match = 0;
|
||||
}
|
||||
|
||||
/* initialize state for loop */
|
||||
@@ -216,13 +214,13 @@ unsigned short FAR *work;
|
||||
for (;;) {
|
||||
/* create table entry */
|
||||
here.bits = (unsigned char)(len - drop);
|
||||
- if ((int)(work[sym]) < end) {
|
||||
+ if (work[sym] + 1 < match) {
|
||||
here.op = (unsigned char)0;
|
||||
here.val = work[sym];
|
||||
}
|
||||
- else if ((int)(work[sym]) > end) {
|
||||
- here.op = (unsigned char)(extra[work[sym]]);
|
||||
- here.val = base[work[sym]];
|
||||
+ else if (work[sym] >= match) {
|
||||
+ here.op = (unsigned char)(extra[work[sym] - match]);
|
||||
+ here.val = base[work[sym] - match];
|
||||
}
|
||||
else {
|
||||
here.op = (unsigned char)(32 + 64); /* end of block */
|
|
@ -1,224 +0,0 @@
|
|||
>From 9aaec95e82117c1cb0f9624264c3618fc380cecb Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 21 Sep 2016 22:25:21 -0700
|
||||
Subject: [PATCH] Use post-increment only in inffast.c.
|
||||
|
||||
An old inffast.c optimization turns out to not be optimal anymore
|
||||
with modern compilers, and furthermore was not compliant with the
|
||||
C standard, for which decrementing a pointer before its allocated
|
||||
memory is undefined. Per the recommendation of a security audit of
|
||||
the zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this "optimization" was removed, in order to
|
||||
avoid the possibility of undefined behavior.
|
||||
---
|
||||
inffast.c | 81 +++++++++++++++++++++----------------------------------
|
||||
1 file changed, 31 insertions(+), 50 deletions(-)
|
||||
|
||||
Index: rsync/zlib/inffast.c
|
||||
===================================================================
|
||||
--- rsync.orig/zlib/inffast.c
|
||||
+++ rsync/zlib/inffast.c
|
||||
@@ -10,25 +10,6 @@
|
||||
|
||||
#ifndef ASMINF
|
||||
|
||||
-/* Allow machine dependent optimization for post-increment or pre-increment.
|
||||
- Based on testing to date,
|
||||
- Pre-increment preferred for:
|
||||
- - PowerPC G3 (Adler)
|
||||
- - MIPS R5000 (Randers-Pehrson)
|
||||
- Post-increment preferred for:
|
||||
- - none
|
||||
- No measurable difference:
|
||||
- - Pentium III (Anderson)
|
||||
- - M68060 (Nikl)
|
||||
- */
|
||||
-#ifdef POSTINC
|
||||
-# define OFF 0
|
||||
-# define PUP(a) *(a)++
|
||||
-#else
|
||||
-# define OFF 1
|
||||
-# define PUP(a) *++(a)
|
||||
-#endif
|
||||
-
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
@@ -96,9 +77,9 @@ unsigned start; /* inflate()'s s
|
||||
|
||||
/* copy state to local variables */
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
- in = strm->next_in - OFF;
|
||||
+ in = strm->next_in;
|
||||
last = in + (strm->avail_in - 5);
|
||||
- out = strm->next_out - OFF;
|
||||
+ out = strm->next_out;
|
||||
beg = out - (start - strm->avail_out);
|
||||
end = out + (strm->avail_out - 257);
|
||||
#ifdef INFLATE_STRICT
|
||||
@@ -119,9 +100,9 @@ unsigned start; /* inflate()'s s
|
||||
input data or output space */
|
||||
do {
|
||||
if (bits < 15) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = lcode[hold & lmask];
|
||||
@@ -134,14 +115,14 @@ unsigned start; /* inflate()'s s
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
- PUP(out) = (unsigned char)(here.val);
|
||||
+ *out++ = (unsigned char)(here.val);
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = (unsigned)(here.val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += (unsigned)hold & ((1U << op) - 1);
|
||||
@@ -150,9 +131,9 @@ unsigned start; /* inflate()'s s
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode[hold & dmask];
|
||||
@@ -165,10 +146,10 @@ unsigned start; /* inflate()'s s
|
||||
dist = (unsigned)(here.val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
@@ -196,30 +177,30 @@ unsigned start; /* inflate()'s s
|
||||
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
if (len <= op - whave) {
|
||||
do {
|
||||
- PUP(out) = 0;
|
||||
+ *out++ = 0;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
len -= op - whave;
|
||||
do {
|
||||
- PUP(out) = 0;
|
||||
+ *out++ = 0;
|
||||
} while (--op > whave);
|
||||
if (op == 0) {
|
||||
from = out - dist;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
- from = window - OFF;
|
||||
+ from = window;
|
||||
if (wnext == 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
@@ -230,14 +211,14 @@ unsigned start; /* inflate()'s s
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
- from = window - OFF;
|
||||
+ from = window;
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
@@ -248,35 +229,35 @@ unsigned start; /* inflate()'s s
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
}
|
||||
while (len > 2) {
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
len -= 3;
|
||||
}
|
||||
if (len) {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
if (len > 1)
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
from = out - dist; /* copy direct from output */
|
||||
do { /* minimum length is three */
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
len -= 3;
|
||||
} while (len > 2);
|
||||
if (len) {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
if (len > 1)
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,8 +294,8 @@ unsigned start; /* inflate()'s s
|
||||
hold &= (1U << bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
- strm->next_in = in + OFF;
|
||||
- strm->next_out = out + OFF;
|
||||
+ strm->next_in = in;
|
||||
+ strm->next_out = out;
|
||||
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
||||
strm->avail_out = (unsigned)(out < end ?
|
||||
257 + (end - out) : 257 - (out - end));
|
|
@ -1,29 +0,0 @@
|
|||
>From e54e1299404101a5a9d0cf5e45512b543967f958 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Sat, 5 Sep 2015 17:45:55 -0700
|
||||
Subject: [PATCH] Avoid shifts of negative values inflateMark().
|
||||
|
||||
The C standard says that bit shifts of negative integers is
|
||||
undefined. This casts to unsigned values to assure a known
|
||||
result.
|
||||
---
|
||||
inflate.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: rsync/zlib/inflate.c
|
||||
===================================================================
|
||||
--- rsync.orig/zlib/inflate.c
|
||||
+++ rsync/zlib/inflate.c
|
||||
@@ -1525,9 +1525,10 @@ z_streamp strm;
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
|
||||
+ if (strm == Z_NULL || strm->state == Z_NULL)
|
||||
+ return (long)(((unsigned long)0 - 1) << 16);
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
- return ((long)(state->back) << 16) +
|
||||
+ return (long)(((unsigned long)((long)state->back)) << 16) +
|
||||
(state->mode == COPY ? state->length :
|
||||
(state->mode == MATCH ? state->was - state->length : 0));
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
>From d1d577490c15a0c6862473d7576352a9f18ef811 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 28 Sep 2016 20:20:25 -0700
|
||||
Subject: [PATCH] Avoid pre-decrement of pointer in big-endian CRC calculation.
|
||||
|
||||
There was a small optimization for PowerPCs to pre-increment a
|
||||
pointer when accessing a word, instead of post-incrementing. This
|
||||
required prefacing the loop with a decrement of the pointer,
|
||||
possibly pointing before the object passed. This is not compliant
|
||||
with the C standard, for which decrementing a pointer before its
|
||||
allocated memory is undefined. When tested on a modern PowerPC
|
||||
with a modern compiler, the optimization no longer has any effect.
|
||||
Due to all that, and per the recommendation of a security audit of
|
||||
the zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this "optimization" was removed, in order to
|
||||
avoid the possibility of undefined behavior.
|
||||
---
|
||||
crc32.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
Index: rsync/zlib/crc32.c
|
||||
===================================================================
|
||||
--- rsync.orig/zlib/crc32.c
|
||||
+++ rsync/zlib/crc32.c
|
||||
@@ -278,7 +278,7 @@ local unsigned long crc32_little(crc, bu
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
-#define DOBIG4 c ^= *++buf4; \
|
||||
+#define DOBIG4 c ^= *buf4++; \
|
||||
c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
|
||||
crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
|
||||
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
|
||||
@@ -300,7 +300,6 @@ local unsigned long crc32_big(crc, buf,
|
||||
}
|
||||
|
||||
buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
|
||||
- buf4--;
|
||||
while (len >= 32) {
|
||||
DOBIG32;
|
||||
len -= 32;
|
||||
@@ -309,7 +308,6 @@ local unsigned long crc32_big(crc, buf,
|
||||
DOBIG4;
|
||||
len -= 4;
|
||||
}
|
||||
- buf4++;
|
||||
buf = (const unsigned char FAR *)buf4;
|
||||
|
||||
if (len) do {
|
|
@ -1,29 +0,0 @@
|
|||
Description: Two spelling mistakes in rsync.yo
|
||||
Author: Paul Slootman <paul@debian.org>
|
||||
Forwarded: https://bugzilla.samba.org/show_bug.cgi?id=13734
|
||||
Origin: other
|
||||
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13734
|
||||
Last-Update: 2019-01-01
|
||||
|
||||
Index: rsync/rsync.yo
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.yo
|
||||
+++ rsync/rsync.yo
|
||||
@@ -1324,7 +1324,7 @@ batch-writing option is in effect.
|
||||
|
||||
dit(bf(--checksum-choice=STR)) This option overrides the checksum algoriths.
|
||||
If one algorithm name is specified, it is used for both the transfer checksums
|
||||
-and (assuming bf(--checksum) is specifed) the pre-transfer checksumming. If two
|
||||
+and (assuming bf(--checksum) is specified) the pre-transfer checksumming. If two
|
||||
comma-separated names are supplied, the first name affects the transfer
|
||||
checksums, and the second name affects the pre-transfer checksumming.
|
||||
|
||||
@@ -2334,7 +2334,7 @@ units of 1024.
|
||||
|
||||
The default is human-readable level 1. Each bf(-h) option increases the level
|
||||
by one. You can take the level down to 0 (to output numbers as pure digits) by
|
||||
-specifing the bf(--no-human-readable) (bf(--no-h)) option.
|
||||
+specifying the bf(--no-human-readable) (bf(--no-h)) option.
|
||||
|
||||
The unit letters that are appended in levels 2 and 3 are: K (kilo), M (mega),
|
||||
G (giga), or T (tera). For example, a 1234567-byte file would output as 1.23M
|
|
@ -1,25 +0,0 @@
|
|||
Index: rsync/options.c
|
||||
===================================================================
|
||||
--- rsync.orig/options.c
|
||||
+++ rsync/options.c
|
||||
@@ -2157,6 +2157,7 @@ int parse_arguments(int *argc_p, const c
|
||||
}
|
||||
if (backup_dir) {
|
||||
size_t len;
|
||||
+ make_backups = 1; /* --backup-dir implies --backup */
|
||||
while (*backup_dir == '.' && backup_dir[1] == '/')
|
||||
backup_dir += 2;
|
||||
if (*backup_dir == '.' && backup_dir[1] == '\0')
|
||||
Index: rsync/rsync.yo
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.yo
|
||||
+++ rsync/rsync.yo
|
||||
@@ -792,7 +792,7 @@ in the list so that it has a high enough
|
||||
your rules specify a trailing inclusion/exclusion of '*', the auto-added
|
||||
rule would never be reached).
|
||||
|
||||
-dit(bf(--backup-dir=DIR)) In combination with the bf(--backup) option, this
|
||||
+dit(bf(--backup-dir=DIR)) This implies the bf(--backup) option, and
|
||||
tells rsync to store all backups in the specified directory on the receiving
|
||||
side. This can be used for incremental backups. You can additionally
|
||||
specify a backup suffix using the bf(--suffix) option
|
|
@ -1,117 +0,0 @@
|
|||
This patch adds the --copy-devices option, which will try to copy
|
||||
the data inside a device instead of duplicating the device node.
|
||||
|
||||
To use this patch, run these commands for a successful build:
|
||||
|
||||
patch -p1 <patches/copy-devices.diff
|
||||
./prepare-source
|
||||
./configure (optional if already run)
|
||||
make
|
||||
|
||||
based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
|
||||
Index: rsync/generator.c
|
||||
===================================================================
|
||||
--- rsync.orig/generator.c
|
||||
+++ rsync/generator.c
|
||||
@@ -39,6 +39,7 @@ extern int preserve_acls;
|
||||
extern int preserve_xattrs;
|
||||
extern int preserve_links;
|
||||
extern int preserve_devices;
|
||||
+extern int copy_devices;
|
||||
extern int preserve_specials;
|
||||
extern int preserve_hard_links;
|
||||
extern int preserve_executability;
|
||||
@@ -1657,7 +1658,7 @@ static void recv_generator(char *fname,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (!S_ISREG(file->mode)) {
|
||||
+ if (!(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) {
|
||||
if (solo_file)
|
||||
fname = f_name(file, NULL);
|
||||
rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
|
||||
Index: rsync/options.c
|
||||
===================================================================
|
||||
--- rsync.orig/options.c
|
||||
+++ rsync/options.c
|
||||
@@ -50,6 +50,7 @@ int append_mode = 0;
|
||||
int keep_dirlinks = 0;
|
||||
int copy_dirlinks = 0;
|
||||
int copy_links = 0;
|
||||
+int copy_devices = 0;
|
||||
int preserve_links = 0;
|
||||
int preserve_hard_links = 0;
|
||||
int preserve_acls = 0;
|
||||
@@ -705,6 +706,7 @@ void usage(enum logcode F)
|
||||
rprintf(F," -o, --owner preserve owner (super-user only)\n");
|
||||
rprintf(F," -g, --group preserve group\n");
|
||||
rprintf(F," --devices preserve device files (super-user only)\n");
|
||||
+ rprintf(F," --copy-devices copy device contents as regular file\n");
|
||||
rprintf(F," --specials preserve special files\n");
|
||||
rprintf(F," -D same as --devices --specials\n");
|
||||
rprintf(F," -t, --times preserve modification times\n");
|
||||
@@ -887,6 +889,7 @@ static struct poptOption long_options[]
|
||||
{"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 },
|
||||
{"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 },
|
||||
{"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 },
|
||||
+ {"copy-devices", 0, POPT_ARG_NONE, ©_devices, 0, 0, 0 },
|
||||
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
|
||||
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
|
||||
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
|
||||
@@ -2798,6 +2801,9 @@ void server_options(char **args, int *ar
|
||||
else if (remove_source_files)
|
||||
args[ac++] = "--remove-sent-files";
|
||||
|
||||
+ if (copy_devices)
|
||||
+ args[ac++] = "--copy-devices";
|
||||
+
|
||||
if (preallocate_files && am_sender)
|
||||
args[ac++] = "--preallocate";
|
||||
|
||||
Index: rsync/rsync.c
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.c
|
||||
+++ rsync/rsync.c
|
||||
@@ -33,6 +33,7 @@ extern int preserve_xattrs;
|
||||
extern int preserve_perms;
|
||||
extern int preserve_executability;
|
||||
extern int preserve_times;
|
||||
+extern int copy_devices;
|
||||
extern int am_root;
|
||||
extern int am_server;
|
||||
extern int am_daemon;
|
||||
@@ -410,7 +411,8 @@ int read_ndx_and_attrs(int f_in, int f_o
|
||||
|
||||
if (iflags & ITEM_TRANSFER) {
|
||||
int i = ndx - cur_flist->ndx_start;
|
||||
- if (i < 0 || !S_ISREG(cur_flist->files[i]->mode)) {
|
||||
+ struct file_struct *file = cur_flist->files[i];
|
||||
+ if (i < 0 || !(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) {
|
||||
rprintf(FERROR,
|
||||
"received request to transfer non-regular file: %d [%s]\n",
|
||||
ndx, who_am_i());
|
||||
Index: rsync/sender.c
|
||||
===================================================================
|
||||
--- rsync.orig/sender.c
|
||||
+++ rsync/sender.c
|
||||
@@ -365,6 +365,20 @@ void send_files(int f_in, int f_out)
|
||||
exit_cleanup(RERR_FILEIO);
|
||||
}
|
||||
|
||||
+ /* On Matt's computer, st_size is falsely 0 for most devices.
|
||||
+ * If this happens, try harder to determine the actual device size. */
|
||||
+ if (IS_DEVICE(st.st_mode) && st.st_size == 0) {
|
||||
+ OFF_T off = lseek(fd, 0, SEEK_END);
|
||||
+ if (off == (OFF_T) -1)
|
||||
+ rsyserr(FERROR, errno, "failed to seek to end of %s to determine size", fname);
|
||||
+ else {
|
||||
+ st.st_size = off;
|
||||
+ off = lseek(fd, 0, SEEK_SET);
|
||||
+ if (off != 0)
|
||||
+ rsyserr(FERROR, errno, "failed to seek back to beginning of %s to read it", fname);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (st.st_size) {
|
||||
int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE);
|
||||
mbuf = map_file(fd, st.st_size, read_size, s->blength);
|
|
@ -1,38 +0,0 @@
|
|||
Index: rsync/Makefile.in
|
||||
===================================================================
|
||||
--- rsync.orig/Makefile.in
|
||||
+++ rsync/Makefile.in
|
||||
@@ -164,15 +164,6 @@ configure.sh config.h.in: configure.ac a
|
||||
else \
|
||||
echo "config.h.in has CHANGED."; \
|
||||
fi
|
||||
- @if test -f configure.sh.old -o -f config.h.in.old; then \
|
||||
- if test "$(MAKECMDGOALS)" = reconfigure; then \
|
||||
- echo 'Continuing with "make reconfigure".'; \
|
||||
- else \
|
||||
- echo 'You may need to run:'; \
|
||||
- echo ' make reconfigure'; \
|
||||
- exit 1; \
|
||||
- fi \
|
||||
- fi
|
||||
|
||||
reconfigure: configure.sh
|
||||
./config.status --recheck
|
||||
@@ -181,17 +172,6 @@ reconfigure: configure.sh
|
||||
Makefile: Makefile.in config.status configure.sh config.h.in
|
||||
@if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
|
||||
@./config.status
|
||||
- @if diff Makefile Makefile.old >/dev/null 2>&1; then \
|
||||
- echo "Makefile is unchanged."; \
|
||||
- rm Makefile.old; \
|
||||
- else \
|
||||
- if test "$(MAKECMDGOALS)" = reconfigure; then \
|
||||
- echo 'Continuing with "make reconfigure".'; \
|
||||
- else \
|
||||
- echo "Makefile updated -- rerun your make command."; \
|
||||
- exit 1; \
|
||||
- fi \
|
||||
- fi
|
||||
|
||||
rsync-ssl: $(srcdir)/rsync-ssl.in Makefile
|
||||
sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/rsync-ssl.in >rsync-ssl
|
|
@ -1,13 +0,0 @@
|
|||
Index: rsync/support/rsyncstats
|
||||
===================================================================
|
||||
--- rsync.orig/support/rsyncstats
|
||||
+++ rsync/support/rsyncstats
|
||||
@@ -12,7 +12,7 @@
|
||||
use Getopt::Long;
|
||||
|
||||
# You may wish to edit the next line to customize for your default log file.
|
||||
-$usage_file = "/var/log/rsyncd.log";
|
||||
+$usage_file = "/var/log/rsyncd";
|
||||
|
||||
# Edit the following lines for default report settings.
|
||||
# Entries defined here will be over-ridden by the command line.
|
|
@ -1,15 +0,0 @@
|
|||
Index: rsync/rsync.yo
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.yo
|
||||
+++ rsync/rsync.yo
|
||||
@@ -1970,7 +1970,9 @@ See the bf(--skip-compress) option for t
|
||||
that will not be compressed.
|
||||
|
||||
dit(bf(--compress-level=NUM)) Explicitly set the compression level to use
|
||||
-(see bf(--compress)) instead of letting it default. If NUM is non-zero,
|
||||
+(see bf(--compress)) instead of letting it default. Allowed values for NUM
|
||||
+are between 0 and 9; default when bf(--compress) option is specified is 6.
|
||||
+If NUM is non-zero,
|
||||
the bf(--compress) option is implied.
|
||||
|
||||
dit(bf(--skip-compress=LIST)) Override the list of file suffixes that will
|
|
@ -1,146 +0,0 @@
|
|||
Description: Optionally preserve atimes
|
||||
Origin: https://bugzilla.samba.org/show_bug.cgi?id=7249
|
||||
Last-Update: 2019-10-10
|
||||
Index: rsync/options.c
|
||||
===================================================================
|
||||
--- rsync.orig/options.c
|
||||
+++ rsync/options.c
|
||||
@@ -128,6 +128,7 @@ int delay_updates = 0;
|
||||
long block_size = 0; /* "long" because popt can't set an int32. */
|
||||
char *skip_compress = NULL;
|
||||
item_list dparam_list = EMPTY_ITEM_LIST;
|
||||
+int noatime = 0;
|
||||
|
||||
/** Network address family. **/
|
||||
int default_af_hint
|
||||
@@ -806,6 +807,7 @@ void usage(enum logcode F)
|
||||
rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filenames\n");
|
||||
#endif
|
||||
rprintf(F," --checksum-seed=NUM set block/file checksum seed (advanced)\n");
|
||||
+ rprintf(F," --noatime do not alter atime when opening source files\n");
|
||||
rprintf(F," -4, --ipv4 prefer IPv4\n");
|
||||
rprintf(F," -6, --ipv6 prefer IPv6\n");
|
||||
rprintf(F," --version print version number\n");
|
||||
@@ -1027,6 +1029,7 @@ static struct poptOption long_options[]
|
||||
{"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 },
|
||||
{"no-iconv", 0, POPT_ARG_NONE, 0, OPT_NO_ICONV, 0, 0 },
|
||||
#endif
|
||||
+ {"noatime", 0, POPT_ARG_VAL, &noatime, 1, 0, 0 },
|
||||
{"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 },
|
||||
{"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 },
|
||||
{"8-bit-output", '8', POPT_ARG_VAL, &allow_8bit_chars, 1, 0, 0 },
|
||||
@@ -2807,6 +2810,12 @@ void server_options(char **args, int *ar
|
||||
if (preallocate_files && am_sender)
|
||||
args[ac++] = "--preallocate";
|
||||
|
||||
+ /*
|
||||
+ * Do we want remote atime preservation when we preserve local ones?
|
||||
+ if (noatime)
|
||||
+ args[ac++] = "--noatime";
|
||||
+ */
|
||||
+
|
||||
if (ac > MAX_SERVER_ARGS) { /* Not possible... */
|
||||
rprintf(FERROR, "argc overflow in server_options().\n");
|
||||
exit_cleanup(RERR_MALLOC);
|
||||
Index: rsync/rsync.yo
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.yo
|
||||
+++ rsync/rsync.yo
|
||||
@@ -458,6 +458,7 @@ to the detailed description below for a
|
||||
--protocol=NUM force an older protocol version to be used
|
||||
--iconv=CONVERT_SPEC request charset conversion of filenames
|
||||
--checksum-seed=NUM set block/file checksum seed (advanced)
|
||||
+ --noatime do not alter atime when opening source files
|
||||
-4, --ipv4 prefer IPv4
|
||||
-6, --ipv6 prefer IPv6
|
||||
--version print version number
|
||||
@@ -2659,6 +2660,13 @@ daemon uses the charset specified in its
|
||||
regardless of the remote charset you actually pass. Thus, you may feel free to
|
||||
specify just the local charset for a daemon transfer (e.g. bf(--iconv=utf8)).
|
||||
|
||||
+dit(bf(--noatime)) Use the O_NOATIME open flag on systems that support it.
|
||||
+The effect of this flag is to avoid altering the access time (atime) of the
|
||||
+opened files.
|
||||
+If the system does not support the O_NOATIME flag, this option does nothing.
|
||||
+Currently, systems known to support O_NOATIME are Linux >= 2.6.8 with glibc
|
||||
+>= 2.3.4.
|
||||
+
|
||||
dit(bf(-4, --ipv4) or bf(-6, --ipv6)) Tells rsync to prefer IPv4/IPv6
|
||||
when creating sockets. This only affects sockets that rsync has direct
|
||||
control over, such as the outgoing socket when directly contacting an
|
||||
Index: rsync/syscall.c
|
||||
===================================================================
|
||||
--- rsync.orig/syscall.c
|
||||
+++ rsync/syscall.c
|
||||
@@ -42,6 +42,7 @@ extern int inplace;
|
||||
extern int preallocate_files;
|
||||
extern int preserve_perms;
|
||||
extern int preserve_executability;
|
||||
+extern int noatime;
|
||||
|
||||
#ifndef S_BLKSIZE
|
||||
# if defined hpux || defined __hpux__ || defined __hpux
|
||||
@@ -201,6 +202,10 @@ int do_open(const char *pathname, int fl
|
||||
RETURN_ERROR_IF(dry_run, 0);
|
||||
RETURN_ERROR_IF_RO_OR_LO;
|
||||
}
|
||||
+#ifdef O_NOATIME
|
||||
+ if (noatime)
|
||||
+ flags |= O_NOATIME;
|
||||
+#endif
|
||||
|
||||
return open(pathname, flags | O_BINARY, mode);
|
||||
}
|
||||
Index: rsync/tls.c
|
||||
===================================================================
|
||||
--- rsync.orig/tls.c
|
||||
+++ rsync/tls.c
|
||||
@@ -53,6 +53,7 @@ int preserve_perms = 0;
|
||||
int preserve_executability = 0;
|
||||
int preallocate_files = 0;
|
||||
int inplace = 0;
|
||||
+int noatime = 0;
|
||||
|
||||
#ifdef SUPPORT_XATTRS
|
||||
|
||||
Index: rsync/t_unsafe.c
|
||||
===================================================================
|
||||
--- rsync.orig/t_unsafe.c
|
||||
+++ rsync/t_unsafe.c
|
||||
@@ -33,6 +33,10 @@ int preserve_perms = 0;
|
||||
int preserve_executability = 0;
|
||||
short info_levels[COUNT_INFO], debug_levels[COUNT_DEBUG];
|
||||
|
||||
+/* This is to make syscall.o shut up. */
|
||||
+int noatime = 0;
|
||||
+
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Index: rsync/wildtest.c
|
||||
===================================================================
|
||||
--- rsync.orig/wildtest.c
|
||||
+++ rsync/wildtest.c
|
||||
@@ -32,6 +32,9 @@ int fnmatch_errors = 0;
|
||||
|
||||
int wildmatch_errors = 0;
|
||||
|
||||
+/* This is to make syscall.o shut up. */
|
||||
+int noatime = 0;
|
||||
+
|
||||
typedef char bool;
|
||||
|
||||
int output_iterations = 0;
|
||||
Index: rsync/trimslash.c
|
||||
===================================================================
|
||||
--- rsync.orig/trimslash.c
|
||||
+++ rsync/trimslash.c
|
||||
@@ -30,6 +30,7 @@ int preserve_perms = 0;
|
||||
int preserve_executability = 0;
|
||||
int preallocate_files = 0;
|
||||
int inplace = 0;
|
||||
+int noatime = 0;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
|
@ -1,16 +0,0 @@
|
|||
Fix --prealloc to keep file-size 0 when possible
|
||||
https://git.samba.org/?p=rsync.git;a=commitdiff;h=c2da3809f714d936dec1cab6d5bf8b724b9cd113
|
||||
|
||||
Index: rsync/syscall.c
|
||||
===================================================================
|
||||
--- rsync.orig/syscall.c
|
||||
+++ rsync/syscall.c
|
||||
@@ -467,7 +467,7 @@ int do_utime(const char *fname, time_t m
|
||||
|
||||
OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length)
|
||||
{
|
||||
- int opts = inplace || preallocate_files ? 0 : DO_FALLOC_OPTIONS;
|
||||
+ int opts = inplace || preallocate_files ? DO_FALLOC_OPTIONS : 0;
|
||||
int ret;
|
||||
RETURN_ERROR_IF(dry_run, 0);
|
||||
RETURN_ERROR_IF_RO_OR_LO;
|
|
@ -1,15 +0,0 @@
|
|||
CVE-2016-9840.patch
|
||||
CVE-2016-9841.patch
|
||||
CVE-2016-9842.patch
|
||||
CVE-2016-9843.patch
|
||||
Two-spelling-mistakes-in-rsync.yo.diff
|
||||
backup-dir-implies-backup.diff
|
||||
copy-devices.diff
|
||||
logdir.diff
|
||||
manpage-compress-level.diff
|
||||
noatime.diff
|
||||
prealloc-fix.diff
|
||||
ssh-6-option.diff
|
||||
systemd-unit.diff
|
||||
time-limit.diff
|
||||
disable_reconfigure_req.diff
|
|
@ -1,36 +0,0 @@
|
|||
Index: rsync/main.c
|
||||
===================================================================
|
||||
--- rsync.orig/main.c
|
||||
+++ rsync/main.c
|
||||
@@ -117,6 +117,7 @@ int sender_keeps_checksum = 0;
|
||||
# endif
|
||||
static struct sigaction sigact;
|
||||
#endif
|
||||
+extern int default_af_hint;
|
||||
|
||||
struct pid_status {
|
||||
pid_t pid;
|
||||
@@ -454,6 +455,23 @@ static pid_t do_cmd(char *cmd, char *mac
|
||||
*t++ = '\0';
|
||||
}
|
||||
|
||||
+#ifdef AF_INET
|
||||
+ if (default_af_hint == AF_INET) {
|
||||
+ if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) {
|
||||
+ /* we're using ssh so we can add a -4 option */
|
||||
+ args[argc++] = "-4";
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+#ifdef AF_INET6
|
||||
+ if (default_af_hint == AF_INET6) {
|
||||
+ if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) {
|
||||
+ /* we're using ssh so we can add a -6 option */
|
||||
+ args[argc++] = "-6";
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* check to see if we've already been given '-l user' in
|
||||
* the remote-shell command */
|
||||
for (i = 0; i < argc-1; i++) {
|
|
@ -1,17 +0,0 @@
|
|||
add Documentation tag to systemd unit file;
|
||||
start rsync after network.target.
|
||||
Last-Update: 2019-01-16
|
||||
|
||||
Index: rsync/packaging/systemd/rsync.service
|
||||
===================================================================
|
||||
--- rsync.orig/packaging/systemd/rsync.service
|
||||
+++ rsync/packaging/systemd/rsync.service
|
||||
@@ -1,6 +1,8 @@
|
||||
[Unit]
|
||||
Description=fast remote file copy program daemon
|
||||
+Documentation=man:rsync(1) man:rsyncd.conf(5)
|
||||
ConditionPathExists=/etc/rsyncd.conf
|
||||
+After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/rsync --daemon --no-detach
|
|
@ -1,319 +0,0 @@
|
|||
John Taylor's patch for implementing --time-limit and --stop-at, reworked
|
||||
to be simpler and more efficient by Wayne Davison.
|
||||
|
||||
Do we need configure support for mktime()?
|
||||
|
||||
To use this patch, run these commands for a successful build:
|
||||
|
||||
patch -p1 <patches/time-limit.diff
|
||||
./configure (optional if already run)
|
||||
make
|
||||
|
||||
based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
|
||||
Index: rsync/io.c
|
||||
===================================================================
|
||||
--- rsync.orig/io.c
|
||||
+++ rsync/io.c
|
||||
@@ -59,6 +59,7 @@ extern int preserve_hard_links;
|
||||
extern BOOL extra_flist_sending_enabled;
|
||||
extern BOOL flush_ok_after_signal;
|
||||
extern struct stats stats;
|
||||
+extern time_t stop_at_utime;
|
||||
extern struct file_list *cur_flist;
|
||||
#ifdef ICONV_OPTION
|
||||
extern int filesfrom_convert;
|
||||
@@ -170,11 +171,19 @@ static void check_timeout(BOOL allow_kee
|
||||
* generator might be blocked trying to send checksums, it needs to
|
||||
* know that the receiver is active). Thus, as long as one or the
|
||||
* other is successfully doing work, the generator will not timeout. */
|
||||
- if (!io_timeout)
|
||||
+ if (!io_timeout && !stop_at_utime)
|
||||
return;
|
||||
|
||||
t = time(NULL);
|
||||
|
||||
+ if (stop_at_utime && t >= stop_at_utime) {
|
||||
+ rprintf(FERROR, "run-time limit exceeded\n");
|
||||
+ exit_cleanup(RERR_TIMEOUT);
|
||||
+ }
|
||||
+
|
||||
+ if (!io_timeout)
|
||||
+ return;
|
||||
+
|
||||
if (allow_keepalive) {
|
||||
/* This may put data into iobuf.msg w/o flushing. */
|
||||
maybe_send_keepalive(t, keepalive_flags);
|
||||
Index: rsync/options.c
|
||||
===================================================================
|
||||
--- rsync.orig/options.c
|
||||
+++ rsync/options.c
|
||||
@@ -116,6 +116,7 @@ size_t bwlimit_writemax = 0;
|
||||
int ignore_existing = 0;
|
||||
int ignore_non_existing = 0;
|
||||
int need_messages_from_generator = 0;
|
||||
+time_t stop_at_utime = 0;
|
||||
int max_delete = INT_MIN;
|
||||
OFF_T max_size = -1;
|
||||
OFF_T min_size = -1;
|
||||
@@ -796,6 +797,8 @@ void usage(enum logcode F)
|
||||
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
|
||||
rprintf(F," --list-only list the files instead of copying them\n");
|
||||
rprintf(F," --bwlimit=RATE limit socket I/O bandwidth\n");
|
||||
+ rprintf(F," --stop-at=y-m-dTh:m Stop rsync at year-month-dayThour:minute\n");
|
||||
+ rprintf(F," --time-limit=MINS Stop rsync after MINS minutes have elapsed\n");
|
||||
#ifdef HAVE_SETVBUF
|
||||
rprintf(F," --outbuf=N|L|B set output buffering to None, Line, or Block\n");
|
||||
#endif
|
||||
@@ -825,6 +828,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
|
||||
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
|
||||
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
|
||||
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
|
||||
+ OPT_STOP_AT, OPT_TIME_LIMIT,
|
||||
OPT_SERVER, OPT_REFUSED_BASE = 9000};
|
||||
|
||||
static struct poptOption long_options[] = {
|
||||
@@ -1022,6 +1026,8 @@ static struct poptOption long_options[]
|
||||
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
|
||||
{"contimeout", 0, POPT_ARG_INT, &connect_timeout, 0, 0, 0 },
|
||||
{"no-contimeout", 0, POPT_ARG_VAL, &connect_timeout, 0, 0, 0 },
|
||||
+ {"stop-at", 0, POPT_ARG_STRING, 0, OPT_STOP_AT, 0, 0 },
|
||||
+ {"time-limit", 0, POPT_ARG_STRING, 0, OPT_TIME_LIMIT, 0, 0 },
|
||||
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
|
||||
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
|
||||
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
|
||||
@@ -1814,6 +1820,36 @@ int parse_arguments(int *argc_p, const c
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
+ case OPT_STOP_AT:
|
||||
+ arg = poptGetOptArg(pc);
|
||||
+ if ((stop_at_utime = parse_time(arg)) == (time_t)-1) {
|
||||
+ snprintf(err_buf, sizeof err_buf,
|
||||
+ "invalid --stop-at format: %s\n",
|
||||
+ arg);
|
||||
+ rprintf(FERROR, "ERROR: %s", err_buf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (stop_at_utime < time(NULL)) {
|
||||
+ snprintf(err_buf, sizeof err_buf,
|
||||
+ "--stop-at time is in the past: %s\n",
|
||||
+ arg);
|
||||
+ rprintf(FERROR, "ERROR: %s", err_buf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case OPT_TIME_LIMIT:
|
||||
+ arg = poptGetOptArg(pc);
|
||||
+ if ((stop_at_utime = atol(arg) * 60) <= 0) {
|
||||
+ snprintf(err_buf, sizeof err_buf,
|
||||
+ "invalid --time-limit value: %s\n",
|
||||
+ arg);
|
||||
+ rprintf(FERROR, "ERROR: %s", err_buf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ stop_at_utime += time(NULL);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
/* A large opt value means that set_refuse_options()
|
||||
* turned this option off. */
|
||||
@@ -2618,6 +2654,15 @@ void server_options(char **args, int *ar
|
||||
goto oom;
|
||||
args[ac++] = arg;
|
||||
}
|
||||
+
|
||||
+ if (stop_at_utime) {
|
||||
+ long mins = (stop_at_utime - time(NULL)) / 60;
|
||||
+ if (mins <= 0)
|
||||
+ mins = 1;
|
||||
+ if (asprintf(&arg, "--time-limit=%ld", mins) < 0)
|
||||
+ goto oom;
|
||||
+ args[ac++] = arg;
|
||||
+ }
|
||||
|
||||
if (backup_dir) {
|
||||
args[ac++] = "--backup-dir";
|
||||
Index: rsync/rsync.yo
|
||||
===================================================================
|
||||
--- rsync.orig/rsync.yo
|
||||
+++ rsync/rsync.yo
|
||||
@@ -452,6 +452,8 @@ to the detailed description below for a
|
||||
--password-file=FILE read daemon-access password from FILE
|
||||
--list-only list the files instead of copying them
|
||||
--bwlimit=RATE limit socket I/O bandwidth
|
||||
+ --stop-at=y-m-dTh:m Stop rsync at year-month-dayThour:minute
|
||||
+ --time-limit=MINS Stop rsync after MINS minutes have elapsed
|
||||
--write-batch=FILE write a batched update to FILE
|
||||
--only-write-batch=FILE like --write-batch but w/o updating dest
|
||||
--read-batch=FILE read a batched update from FILE
|
||||
@@ -2593,6 +2595,19 @@ files can show up as being rapidly sent
|
||||
while other can show up as very slow when the flushing of the output buffer
|
||||
occurs. This may be fixed in a future version.
|
||||
|
||||
+dit(bf(--stop-at=y-m-dTh:m)) This option allows you to specify at what
|
||||
+time to stop rsync, in year-month-dayThour:minute numeric format (e.g.
|
||||
+2004-12-31T23:59). You can specify a 2 or 4-digit year. You can also
|
||||
+leave off various items and the result will be the next possible time
|
||||
+that matches the specified data. For example, "1-30" specifies the next
|
||||
+January 30th (at midnight), "04:00" specifies the next 4am, "1"
|
||||
+specifies the next 1st of the month at midnight, and ":59" specifies the
|
||||
+next 59th minute after the hour. If you prefer, you may separate the
|
||||
+date numbers using slashes instead of dashes.
|
||||
+
|
||||
+dit(bf(--time-limit=MINS)) This option allows you to specify the maximum
|
||||
+number of minutes rsync will run for.
|
||||
+
|
||||
dit(bf(--write-batch=FILE)) Record a file that can later be applied to
|
||||
another identical destination with bf(--read-batch). See the "BATCH MODE"
|
||||
section for details, and also the bf(--only-write-batch) option.
|
||||
Index: rsync/util.c
|
||||
===================================================================
|
||||
--- rsync.orig/util.c
|
||||
+++ rsync/util.c
|
||||
@@ -115,6 +115,133 @@ void print_child_argv(const char *prefix
|
||||
rprintf(FCLIENT, " (%d args)\n", cnt);
|
||||
}
|
||||
|
||||
+/* Allow the user to specify a time in the format yyyy-mm-ddThh:mm while
|
||||
+ * also allowing abbreviated data. For instance, if the time is omitted,
|
||||
+ * it defaults to midnight. If the date is omitted, it defaults to the
|
||||
+ * next possible date in the future with the specified time. Even the
|
||||
+ * year or year-month can be omitted, again defaulting to the next date
|
||||
+ * in the future that matches the specified information. A 2-digit year
|
||||
+ * is also OK, as is using '/' instead of '-'. */
|
||||
+time_t parse_time(const char *arg)
|
||||
+{
|
||||
+ const char *cp;
|
||||
+ time_t val, now = time(NULL);
|
||||
+ struct tm t, *today = localtime(&now);
|
||||
+ int in_date, n;
|
||||
+
|
||||
+ memset(&t, 0, sizeof t);
|
||||
+ t.tm_year = t.tm_mon = t.tm_mday = -1;
|
||||
+ t.tm_hour = t.tm_min = t.tm_isdst = -1;
|
||||
+ cp = arg;
|
||||
+ if (*cp == 'T' || *cp == 't' || *cp == ':') {
|
||||
+ cp++;
|
||||
+ in_date = 0;
|
||||
+ } else
|
||||
+ in_date = 1;
|
||||
+ for ( ; ; cp++) {
|
||||
+ if (!isDigit(cp))
|
||||
+ return -1;
|
||||
+
|
||||
+ n = 0;
|
||||
+ do {
|
||||
+ n = n * 10 + *cp++ - '0';
|
||||
+ } while (isDigit(cp));
|
||||
+
|
||||
+ if (*cp == ':')
|
||||
+ in_date = 0;
|
||||
+ if (in_date) {
|
||||
+ if (t.tm_year != -1)
|
||||
+ return -1;
|
||||
+ t.tm_year = t.tm_mon;
|
||||
+ t.tm_mon = t.tm_mday;
|
||||
+ t.tm_mday = n;
|
||||
+ if (!*cp)
|
||||
+ break;
|
||||
+ if (*cp == 'T' || *cp == 't') {
|
||||
+ if (!cp[1])
|
||||
+ break;
|
||||
+ in_date = 0;
|
||||
+ } else if (*cp != '-' && *cp != '/')
|
||||
+ return -1;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (t.tm_hour != -1)
|
||||
+ return -1;
|
||||
+ t.tm_hour = t.tm_min;
|
||||
+ t.tm_min = n;
|
||||
+ if (!*cp)
|
||||
+ break;
|
||||
+ if (*cp != ':')
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ in_date = 0;
|
||||
+ if (t.tm_year < 0) {
|
||||
+ t.tm_year = today->tm_year;
|
||||
+ in_date = 1;
|
||||
+ } else if (t.tm_year < 100) {
|
||||
+ while (t.tm_year < today->tm_year)
|
||||
+ t.tm_year += 100;
|
||||
+ } else
|
||||
+ t.tm_year -= 1900;
|
||||
+ if (t.tm_mon < 0) {
|
||||
+ t.tm_mon = today->tm_mon;
|
||||
+ in_date = 2;
|
||||
+ } else
|
||||
+ t.tm_mon--;
|
||||
+ if (t.tm_mday < 0) {
|
||||
+ t.tm_mday = today->tm_mday;
|
||||
+ in_date = 3;
|
||||
+ }
|
||||
+
|
||||
+ n = 0;
|
||||
+ if (t.tm_min < 0) {
|
||||
+ t.tm_hour = t.tm_min = 0;
|
||||
+ } else if (t.tm_hour < 0) {
|
||||
+ if (in_date != 3)
|
||||
+ return -1;
|
||||
+ in_date = 0;
|
||||
+ t.tm_hour = today->tm_hour;
|
||||
+ n = 60*60;
|
||||
+ }
|
||||
+
|
||||
+ if (t.tm_hour > 23 || t.tm_min > 59
|
||||
+ || t.tm_mon < 0 || t.tm_mon >= 12
|
||||
+ || t.tm_mday < 1 || t.tm_mday > 31
|
||||
+ || (val = mktime(&t)) == (time_t)-1)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (val <= now && in_date) {
|
||||
+ tweak_date:
|
||||
+ switch (in_date) {
|
||||
+ case 3:
|
||||
+ t.tm_mday++;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ if (++t.tm_mon == 12)
|
||||
+ t.tm_mon = 0;
|
||||
+ else
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ t.tm_year++;
|
||||
+ break;
|
||||
+ }
|
||||
+ if ((val = mktime(&t)) == (time_t)-1) {
|
||||
+ if (in_date == 3 && t.tm_mday > 28) {
|
||||
+ t.tm_mday = 1;
|
||||
+ in_date = 2;
|
||||
+ goto tweak_date;
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ if (n) {
|
||||
+ while (val <= now)
|
||||
+ val += n;
|
||||
+ }
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
/* This returns 0 for success, 1 for a symlink if symlink time-setting
|
||||
* is not possible, or -1 for any other error. */
|
||||
int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode)
|
||||
Index: rsync/proto.h
|
||||
===================================================================
|
||||
--- rsync.orig/proto.h
|
||||
+++ rsync/proto.h
|
||||
@@ -367,6 +367,7 @@ void set_nonblocking(int fd);
|
||||
void set_blocking(int fd);
|
||||
int fd_pair(int fd[2]);
|
||||
void print_child_argv(const char *prefix, char **cmd);
|
||||
+time_t parse_time(const char *arg);
|
||||
int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode);
|
||||
int make_path(char *fname, int flags);
|
||||
int full_write(int desc, const char *ptr, size_t len);
|
|
@ -1 +1 @@
|
|||
3.0 (quilt)
|
||||
3.0 (native)
|
||||
|
|
Loading…
Reference in New Issue