Package: librapi2-tools
Version: 0.13.1-1.dh1
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


Hello,

After upgrading from librapi2-tools 0.11.1-2 to 0.13.1-1, quite a few scripts 
that use synce-pcp have reported errors. I've tracked it down to scripts 
that update remote files by copying a local file to the remote device - the 
new synce-pcp checks for the existence of the remote file before copying, and 
aborts if a file exists.

I can see that this is a useful feature, but it's still nice to be able to 
have the old behaviour in certain situations. The best way seemed to be to 
add an option that will cause pcp to overwrite the destination, which I've 
done, as per the attached patch.

If you require any further information, feel free to get in touch and I'll 
be happy to update this report.

All the best,
- -Dave.


- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.27.4 (SMP w/2 CPU cores)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages librapi2-tools depends on:
ii  libc6                         2.9-4      GNU C Library: Shared libraries
ii  libdbus-1-3                   1.2.12-1   simple interprocess messaging syst
ii  libdbus-glib-1-2              0.80-3     simple interprocess messaging syst
ii  libglib2.0-0                  2.18.4-2   The GLib library of C routines
ii  libhal1                       0.5.11-8   Hardware Abstraction Layer - share
ii  librapi2                      0.13.1-1   Make RAPI calls to a Windows Mobil
ii  libsynce0                     0.13-1     Helper library for SynCE, a tool t

librapi2-tools recommends no packages.

librapi2-tools suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCgAGBQJJsXNQAAoJEBIA1yCB7VsRorYP/jkzhU8eiVEY+nQcfv28Af9U
sP+ULE5p741JZk5DfQWgb413fNY3R+esBpOKd6UR6D4rstar456Q+rhWCnNy6yP5
t9G+sBULtLqDZ4i0luy9TG8eYKVNB79gMDTPxTuECg4T/xJj2GGBKKwk6EHdrM+V
Rm9cXPS6UbYXcMfHvVdBesDpZTEz2GRIv9WJWoEnetuA8EUuJII23xMr9jlHaR7U
vXzVI5bvjVpAT1zDXWjbplMgX9AuCEwF9VAm+TsXOcKVlQJPhSOrCopI73cFvgYt
h7V30aC1W/MzWvnyaMwN3FzU8FQhQIshxf5dzDls6Chhlg2yh5+ZPZu/E1C1lNBm
Z4I4KrkRySfmaZ+by6QMBufEPw3NUdLbUgDMaAaRGx8EenLFe7QjMDNNvLCy0jkl
tmGZVa74Qup/UZINkQNOSKBv0Jh2J+gAcPEfD/FFVWpPHHvilQOggC1AWgnd0E2u
zZHvL9Wwy9yIOuTc51NAvaDjcHaFvjAcL4Id5xp2tratTuQMzzas8q2KFl68Jfdn
nssQgAhPe4egADtzAAOiXsWAiizPYe9Iv1Sz9pz1yGwMtYGEuekzyRR8Rcd+Qew6
Odu/C4NmPC83tmUm0yjiwyGRlCwwFgjA7lQnX4F2MVy9qwOAkRZR/k7TFMhYud48
aA+J8NuPv8s8Zd0buYBe
=ag1Q
-----END PGP SIGNATURE-----
diff -ur librapi2-0.13.1-orig/tools/pcp.c librapi2-0.13.1/tools/pcp.c
--- librapi2-0.13.1-orig/tools/pcp.c	2009-01-02 15:14:48.000000000 +0000
+++ librapi2-0.13.1/tools/pcp.c	2009-03-06 19:01:15.000000000 +0000
@@ -12,6 +12,7 @@
 
 char* dev_name = NULL;
 bool recursive = false;
+bool force = false;
 char* prog_name = NULL;
 
 static void show_usage(const char* name)
@@ -22,6 +23,7 @@
 			"\t%s [-r] [-d LEVEL] [-p DEVNAME] [-h] SOURCE DESTINATION\n"
 			"\n"
 			"\t-r           Copy directories recursively\n"
+			"\t-f           Force - replace existing destination files\n"
 			"\t-d LEVEL     Set debug log level\n"
 			"\t                 0 - No logging (default)\n"
 			"\t                 1 - Errors only\n"
@@ -41,7 +43,7 @@
 	int log_level = SYNCE_LOG_LEVEL_ERROR;
 	prog_name = strdup(argv[0]);
 
-	while ((c = getopt(argc, argv, "rd:hp:")) != -1)
+	while ((c = getopt(argc, argv, "rfd:hp:")) != -1)
 	{
 		switch (c)
 		{
@@ -49,6 +51,10 @@
 				recursive = true;
 				break;
 
+			case 'f':
+				force = true;
+				break;
+
 			case 'd':
 				log_level = atoi(optarg);
 				break;
@@ -584,7 +590,7 @@
   } else {
 
     if (does_exist(dest)) {
-      if (!is_dir(dest)) {
+      if (!is_dir(dest) && !force) {
 	fprintf(stderr, "%s: file '%s' already exists\n", prog_name, dest);
 	return false;
       }

Reply via email to