-/* $OpenBSD: extern.h,v 1.45 2023/04/28 10:24:38 claudio Exp $ */
+/* $OpenBSD: extern.h,v 1.46 2023/11/23 11:59:53 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
int numeric_ids; /* --numeric-ids */
int one_file_system; /* -x */
int ignore_times; /* -I */
+ int ignore_dir_times; /* -O */
int size_only; /* --size-only */
int alt_base_mode;
off_t max_size; /* --max-size */
-/* $OpenBSD: fargs.c,v 1.24 2023/04/28 10:24:38 claudio Exp $ */
+/* $OpenBSD: fargs.c,v 1.25 2023/11/23 11:59:53 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* extra options for the receiver (local is sender) */
if (f->mode == FARGS_SENDER) {
+ if (sess->opts->ignore_dir_times)
+ addargs(&args, "-O");
if (sess->opts->size_only)
addargs(&args, "--size-only");
-/* $OpenBSD: main.c,v 1.68 2023/04/28 10:24:38 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.69 2023/11/23 11:59:53 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
{ "no-links", no_argument, &opts.preserve_links, 0 },
{ "no-motd", no_argument, &opts.no_motd, 1 },
{ "numeric-ids", no_argument, &opts.numeric_ids, 1 },
+ { "omit-dir-times", no_argument, &opts.ignore_dir_times, 1 },
{ "owner", no_argument, &opts.preserve_uids, 1 },
{ "no-owner", no_argument, &opts.preserve_uids, 0 },
{ "perms", no_argument, &opts.preserve_perms, 1 },
opts.max_size = opts.min_size = -1;
- while ((c = getopt_long(argc, argv, "aDe:ghIlnoprtVvxz", lopts, &lidx))
+ while ((c = getopt_long(argc, argv, "aDe:ghIlnOoprtVvxz", lopts, &lidx))
!= -1) {
switch (c) {
case 'D':
case 'n':
opts.dry_run = 1;
break;
+ case 'O':
+ opts.ignore_dir_times = 1;
+ break;
case 'o':
opts.preserve_uids = 1;
break;
exit(rc);
usage:
fprintf(stderr, "usage: %s"
- " [-aDgIlnoprtVvx] [-e program] [--address=sourceaddr]\n"
+ " [-aDgIlnOoprtVvx] [-e program] [--address=sourceaddr]\n"
"\t[--contimeout=seconds] [--compare-dest=dir] [--del] [--exclude]\n"
"\t[--exclude-from=file] [--include] [--include-from=file]\n"
"\t[--no-motd] [--numeric-ids] [--port=portnumber]\n"
-.\" $OpenBSD: rsync.1,v 1.33 2023/04/28 10:24:38 claudio Exp $
+.\" $OpenBSD: rsync.1,v 1.34 2023/11/23 11:59:53 job Exp $
.\"
.\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 28 2023 $
+.Dd $Mdocdate: November 23 2023 $
.Dt OPENRSYNC 1
.Os
.Sh NAME
.Nd synchronise local and remote files
.Sh SYNOPSIS
.Nm openrsync
-.Op Fl aDgIlnoprtVvx
+.Op Fl aDgIlnOoprtVvx
.Op Fl e Ar program
.Op Fl -address Ns = Ns Ar sourceaddr
.Op Fl -compare-dest Ns = Ns Ar directory
or
.Fl o
is also given.
+.It Fl O , -omit-dir-times
+Don't set directory modification times to match the source.
+Takes precedence over
+.Fl t .
.It Fl o , -owner
Set the user name to match the source, with similar matching logic as for
.Fl g .
-/* $OpenBSD: uploader.c,v 1.34 2023/04/28 10:24:39 claudio Exp $ */
+/* $OpenBSD: uploader.c,v 1.35 2023/11/23 11:59:53 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
* FIXME: run rsync_set_metadata()?
*/
- if (u->newdir[idx] ||
- (sess->opts->preserve_times &&
- st.st_mtime != f->st.mtime)) {
- tv[0].tv_sec = time(NULL);
- tv[0].tv_nsec = 0;
- tv[1].tv_sec = f->st.mtime;
- tv[1].tv_nsec = 0;
- rc = utimensat(u->rootfd, f->path, tv, 0);
- if (rc == -1) {
- ERR("%s: utimensat", f->path);
- return 0;
+ if (!sess->opts->ignore_dir_times) {
+ if (u->newdir[idx] ||
+ (sess->opts->preserve_times &&
+ st.st_mtime != f->st.mtime)) {
+ tv[0].tv_sec = time(NULL);
+ tv[0].tv_nsec = 0;
+ tv[1].tv_sec = f->st.mtime;
+ tv[1].tv_nsec = 0;
+ rc = utimensat(u->rootfd, f->path, tv, 0);
+ if (rc == -1) {
+ ERR("%s: utimensat", f->path);
+ return 0;
+ }
+ LOG4("%s: updated date", f->path);
}
- LOG4("%s: updated date", f->path);
}
/*