problem with 0.7.[34] which doesn't occur with 0.6.0

Ben Escoto bescoto@stanford.edu
Tue, 14 May 2002 17:33:11 -0700


--==_Exmh_-1972817965P
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-Id: <11522.1021422776.0@folly.Stanford.EDU>

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <11522.1021422776.1@folly.Stanford.EDU>

>>>>> "DG" == dean gaudet <dean-list-rdiff-backup@arctic.org>
>>>>> wrote the following on Tue, 14 May 2002 10:14:48 -0700 (PDT)

  DG> ok this appears to be caused by the "--exclude-filelist
  DG> exclude.list" option ... i tried removing entries from the file,
  DG> and the entries don't matter -- even if i had just "/proc" in
  DG> the file i got the above error.

Apparently the filelist selection options (like --exclude-filelist)
didn't work when the source directory was remote.  Enclosed is a patch
that should fix the problem.


--
Ben Escoto


------- =_aaaaaaaaaa0
Content-Type: text/patch; charset="us-ascii"
Content-ID: <11522.1021422776.2@folly.Stanford.EDU>
Content-Description: rdiff-backup-filelist.patch
Content-Transfer-Encoding: quoted-printable

--- rdiff-backup.old	Tue May 14 17:27:20 2002
+++ rdiff-backup	Tue May 14 17:14:03 2002
@@ -209,14 +209,21 @@
 		else: cls.__dict__[name] =3D re.compile(re_string)
 	postset_regexp_local =3D classmethod(postset_regexp_local)
 =

-	def set_select(cls, dsrpath, tuplelist, quote_mode =3D None):
-		"""Initialize select object using tuplelist"""
+	def set_select(cls, dsrpath, tuplelist, quote_mode, *filelists):
+		"""Initialize select object using tuplelist
+
+		Note that each list in filelists must each be passed as
+		separate arguments, so each is recognized as a file by the
+		connection.  Otherwise we will get an error because a list
+		containing files can't be pickled.
+
+		"""
 		if dsrpath.source:
 			cls.select_source =3D Select(dsrpath, quote_mode)
-			cls.select_source.ParseArgs(tuplelist)
+			cls.select_source.ParseArgs(tuplelist, filelists)
 		else:
 			cls.select_mirror =3D Select(dsrpath, quote_mode)
-			cls.select_mirror.ParseArgs(tuplelist)
+			cls.select_mirror.ParseArgs(tuplelist, filelists)
 	set_select =3D classmethod(set_select)
 =

 =

@@ -1758,6 +1765,13 @@
 	def close(self):
 		return self.connection.VirtualFile.closebyid(self.id)
 =

+	def __iter__(self):
+		"""Iterates lines in file, like normal iter(file) behavior"""
+		while 1:
+			line =3D self.readline()
+			if not line: break
+			yield line
+
 =

 #######################################################################
 #
@@ -3978,7 +3992,7 @@
 			if result is not None: return result
 		return 1
 =

-	def ParseArgs(self, argtuples):
+	def ParseArgs(self, argtuples, filelists):
 		"""Create selection functions based on list of tuples
 =

 		The tuples have the form (option string, additional argument)
@@ -3990,6 +4004,7 @@
 		information is sent over the link.
 =

 		"""
+		filelists_index =3D 0
 		try:
 			for opt, arg in argtuples:
 				if opt =3D=3D "--exclude":
@@ -3997,19 +4012,22 @@
 				elif opt =3D=3D "--exclude-device-files":
 					self.add_selection_func(self.devfiles_get_sf())
 				elif opt =3D=3D "--exclude-filelist":
-					self.add_selection_func(self.filelist_get_sf(arg[1],
-																 0, arg[0]))
+					self.add_selection_func(self.filelist_get_sf(
+						filelists[filelists_index], 0, arg))
+					filelists_index +=3D 1
 				elif opt =3D=3D "--exclude-regexp":
 					self.add_selection_func(self.regexp_get_sf(arg, 0))
 				elif opt =3D=3D "--include":
 					self.add_selection_func(self.glob_get_sf(arg, 1))
 				elif opt =3D=3D "--include-filelist":
-					self.add_selection_func(self.filelist_get_sf(arg[1],
-																 1, arg[0]))
+					self.add_selection_func(self.filelist_get_sf(
+						filelists[filelists_index], 1, arg))
+					filelists_index +=3D 1
 				elif opt =3D=3D "--include-regexp":
 					self.add_selection_func(self.regexp_get_sf(arg, 1))
 				else: assert 0, "Bad selection option %s" % opt
 		except SelectError, e: self.parse_catch_error(e)
+		assert filelists_index =3D=3D len(filelists)
 =

 		self.parse_last_excludes()
 		self.parse_rbdir_exclude()
@@ -4411,8 +4429,6 @@
 			child_list.append(childrp)
 		return child_list
 =

-
-
 MakeClass(FilenameMapping)
 =

 =

@@ -5695,6 +5711,7 @@
 		self.remote_cmd, self.remote_schema =3D None, None
 		self.force =3D None
 		self.select_opts, self.select_mirror_opts =3D [], []
+		self.select_files =3D []
 =

 	def parse_cmdlineoptions(self):
 		"""Parse argument list and set global preferences"""
@@ -5718,8 +5735,8 @@
 			  "restore-as-of=3D", "resume", "resume-window=3D", "server",
 			  "terminal-verbosity=3D", "test-server", "verbosity",
 			  "version", "windows-mode", "windows-time-format"])
-		except getopt.error:
-			self.commandline_error("Error parsing commandline options")
+		except getopt.error, e:
+			self.commandline_error("Bad commandline options: %s" % str(e))
 =

 		for opt, arg in optlist:
 			if opt =3D=3D "-b" or opt =3D=3D "--backup-mode": self.action =3D "bac=
kup"
@@ -5736,20 +5753,24 @@
 			elif opt =3D=3D "--exclude-device-files":
 				self.select_opts.append((opt, arg))
 			elif opt =3D=3D "--exclude-filelist":
-				self.select_opts.append((opt, (arg, sel_fl(arg))))
+				self.select_opts.append((opt, arg))
+				self.select_files.append(sel_fl(arg))
 			elif opt =3D=3D "--exclude-filelist-stdin":
 				self.select_opts.append(("--exclude-filelist",
-										 ("standard input", sys.stdin)))
+										 "standard input"))
+				self.select_files.append(sys.stdin)
 			elif opt =3D=3D "--exclude-mirror":
 				self.select_mirror_opts.append(("--exclude", arg))
 			elif opt =3D=3D "--exclude-regexp": self.select_opts.append((opt, arg)=
)
 			elif opt =3D=3D "--force": self.force =3D 1
 			elif opt =3D=3D "--include": self.select_opts.append((opt, arg))
 			elif opt =3D=3D "--include-filelist":
-				self.select_opts.append((opt, (arg, sel_fl(arg))))
+				self.select_opts.append((opt, arg))
+				self.select_files.append(sel_fl(arg))
 			elif opt =3D=3D "--include-filelist-stdin":
 				self.select_opts.append(("--include-filelist",
-										 ("standard input", sys.stdin)))
+										 "standard input"))
+				self.select_files.append(sys.stdin)
 			elif opt =3D=3D "--include-regexp":
 				self.select_opts.append((opt, arg))
 			elif opt =3D=3D "-l" or opt =3D=3D "--list-increments":
@@ -5908,7 +5929,8 @@
 =

 	def backup_init_select(self, rpin, rpout):
 		"""Create Select objects on source and dest connections"""
-		rpin.conn.Globals.set_select(DSRPath(1, rpin), self.select_opts)
+		rpin.conn.Globals.set_select(DSRPath(1, rpin), self.select_opts,
+									 None, *self.select_files)
 		rpout.conn.Globals.set_select(DSRPath(None, rpout),
 									  self.select_mirror_opts, 1)
 =

@@ -6059,8 +6081,9 @@
 		the restore operation isn't.
 =

 		"""
-		Globals.set_select(DSRPath(1, rpin), self.select_mirror_opts) =

-		Globals.set_select(DSRPath(None, rpout), self.select_opts)
+		Globals.set_select(DSRPath(1, rpin), self.select_mirror_opts, None)
+		Globals.set_select(DSRPath(None, rpout), self.select_opts, None,
+						   *self.select_files)
 =

 	def restore_get_root(self, rpin):
 		"""Return (mirror root, index) and set the data dir

------- =_aaaaaaaaaa0--

--==_Exmh_-1972817965P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Exmh version 2.5 01/15/2001

iD8DBQE84azF+owuOvknOnURAuezAJ0XpQzAXRrBVNmH92MQWfKi3lHbvQCfWljJ
Hf98n0tCDFC8sZIrxhYIY0A=
=pPNa
-----END PGP SIGNATURE-----

--==_Exmh_-1972817965P--