Bug #1704

cpdup bugfix

Added by check+kzu4p100rs0rfx01 about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

I noticed that cpdup sometimes doesn't remove files on the
target that were removed on the source. This is caused by
a failure to reset the "node" variable to NULL in cpdup.c.

This bug was accidentally introduced in cpdup v1.16 by me
when I wrote the ScanDir() and IterateList() functions.
I'm very sorry for that.

Please apply the patch below. It fixes the problem.

Best regards
Oliver

--- cpdup/cpdup.c.orig 2009-12-03 21:55:22.000000000 +0100
+++ cpdup/cpdup.c 2010-03-25 12:24:55.000000000 +0100
@@ -975,12 +975,13 @@

if (!skipdir) {
List *list = malloc(sizeof(List));
- Node *node = NULL;
+ Node *node;
char *name;

if (DirShowOpt)
logstd("Scanning %s ...\n", spath);
InitList(list);
+ node = NULL;
if (ScanDir(list, &SrcHost, spath, &CountSourceReadBytes, 0) == 0) {
while ((name = IterateList(list, &node, 0)) != NULL) {
char *nspath;
@@ -1011,6 +1012,7 @@
*/
if (dpath && ScanDir(list, &DstHost, dpath,
&CountTargetReadBytes, 3) == 0) {
+ node = NULL;
while ((name = IterateList(list, &node, 3)) != NULL) {
/*
* If object does not exist in source or .cpignore

History

#1 Updated by dillon about 4 years ago

:I noticed that cpdup sometimes doesn't remove files on the
:target that were removed on the source. This is caused by
:a failure to reset the "node" variable to NULL in cpdup.c.
:
:This bug was accidentally introduced in cpdup v1.16 by me
:when I wrote the ScanDir() and IterateList() functions.
:I'm very sorry for that.
:
:Please apply the patch below. It fixes the problem.
:
:Best regards
: Oliver

Committed! Thanks Oliver.

-Matt

Also available in: Atom PDF