Skip to content

Commit a561c24

Browse files
committedJul 13, 2013
Make the -a option a noop
1 parent 7111b40 commit a561c24

File tree

4 files changed

+8
-30
lines changed

4 files changed

+8
-30
lines changed
 

‎ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ xx Yyy 2013: 1.1.15 Miek Gieben <miek@miek.nl>
44
* [rdup-tr] Fix crashes with filename encryption and symlinks (reported by
55
Jakob Fink)
66
* [rdup] Fix the linked list that tracks the child's PIDs.
7+
* [rdup] Drop -a option, it's racy and must proper or not at all.
78

89
19 Jan 2013: 1.1.14 Miek Gieben <miek@miek.nl>
910
* [rdup] check for the existence of ._rdup_. files and parse its contents

‎crawler.c

-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
extern gboolean opt_onefilesystem;
1010
extern gboolean opt_nobackup;
11-
extern gboolean opt_atime;
1211
extern gboolean opt_chown;
1312
extern time_t opt_timestamp;
1413
extern gint opt_verbose;
@@ -304,17 +303,6 @@ dir_crawl(GTree * t, GHashTable * linkhash, GHashTable * userhash,
304303
}
305304
}
306305
closedir(dir);
307-
if (opt_atime) {
308-
/* reset dirs atime */
309-
if (d > 0 && opt_atime) {
310-
struct utimbuf ut;
311-
ut.actime = dirstack[d - 1]->f_atime;
312-
ut.modtime = dirstack[d - 1]->f_mtime;
313-
if (utime(dirstack[d - 1]->f_name, &ut) == -1)
314-
msg(_("Failed to reset atime: '%s\': %s"),
315-
dirstack[d - 1]->f_name, strerror(errno));
316-
}
317-
}
318306

319307
while (d > 0) {
320308
directory = dirstack[--d];

‎gfunc.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
extern gboolean opt_removed;
1818
extern gboolean opt_modified;
1919
extern gboolean opt_skip;
20-
extern gboolean opt_atime;
2120
extern gint opt_verbose;
2221
extern char *opt_format;
2322
extern time_t opt_timestamp;
@@ -175,18 +174,10 @@ static gboolean cat(FILE * fp, char *filename)
175174
*/
176175
static void entry_cat_data(FILE * fp, struct rdup *e)
177176
{
178-
struct utimbuf ut;
179-
ut.actime = e->f_atime;
180-
ut.modtime = e->f_mtime;
181-
182177
if (S_ISREG(e->f_mode) && e->f_lnk == 0) {
183178
if (!cat(fp, e->f_name))
184179
exit(EXIT_FAILURE);
185180

186-
if (opt_atime)
187-
if (utime(e->f_name, &ut) == -1)
188-
msg(_("Failed to reset atime: '%s\': %s"),
189-
e->f_name, strerror(errno));
190181
return;
191182
}
192183
}
@@ -477,6 +468,7 @@ gfunc_backup(gpointer data, gpointer value,
477468
return FALSE;
478469
default: /* INC_DUMP */
479470
if (((struct rdup *)data)->f_ctime >= opt_timestamp) {
471+
fprintf(stderr, "%zd %zd\n", ((struct rdup *)data)->f_ctime, opt_timestamp); /* MIEK */
480472
entry_print(stdout, PLUS, (struct rdup *)data,
481473
opt_format);
482474
#if DEBUG

‎rdup.c

+6-9
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,11 @@ int main(int argc, char **argv)
319319
break;
320320
case 'a':
321321
opt_atime = TRUE;
322-
/* when atime is true, every file is touched during the
323-
* backup (the c_time changes). To make rdup not see these
324-
* files as new in the backup, we must set the timestamp
325-
* file with a timestamp AFTER the backup.
326-
* If we do this we will not see file the are changed
327-
* DURING the backup...
328-
*/
322+
/* -a creates race conditions that can be solved, but using
323+
* higher resolution timestamps, for now disbale this
324+
* feature
325+
*/
326+
msg(_("The option `-a\' is a noop"));
329327
break;
330328
case 'c':
331329
opt_tty = TRUE;
@@ -498,8 +496,7 @@ int main(int argc, char **argv)
498496
stamp, strerror(errno));
499497
exit(EXIT_FAILURE);
500498
}
501-
/* and set the time when rdup was started, only when -a was not given */
502-
if (!opt_atime && utime(stamp, &ut) == -1) {
499+
if (utime(stamp, &ut) == -1) {
503500
msg(_("Failed to reset atime: '%s\': %s"), stamp,
504501
strerror(errno));
505502
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)