rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[rdiff-backup-users]


From: ahd71
Subject: [rdiff-backup-users]
Date: Mon, 18 Aug 2008 19:53:35 -0400

****This is an edited version of a previous post****


I'm not a python programmer. However I'm pretty sure that the problem is in the 
following code block were it works with c:\dir but not with c:\.

Anyone with more knowledge that can help to find this 'off-by-one' error? (and 
not break the code for linux syntax such as server::/directory

Thanks /ahd71

def parse_file_desc(file_desc):
        """Parse file description returning pair 
(host_info, filename)

        In other words, address@hidden::/usr/bin/ls 
=>
        ("address@hidden", "/usr/bin/ls").  The
        complication is to allow for quoting of : by a 
\.  If the
        string is not separated by :, then the 
host_info is None.

        """
        def check_len(i):
                if i >= 
len(file_desc):
                      
  raise SetConnectionsException(
                      
          "Unexpected end to file description %s" % 
file_desc)

        host_info_list, i, last_was_quoted = [], 0, 
None
        while 1:
                if i == 
len(file_desc):
                      
  return (None, file_desc)

                if file_desc[i] 
== '\\':
                      
  i = i+1
                      
  check_len(i)
                      
  last_was_quoted = 1
                elif 
(file_desc[i] == ":" and i > 0 and file_desc[i-1] == 
":"
                      
    and not last_was_quoted):
                      
  host_info_list.pop() # Remove last colon from name
                      
  break
                else: 
last_was_quoted = None
                
host_info_list.append(file_desc[i])
                i = i+1

        check_len(i+1)
        return ("".join(host_info_list), 
file_desc[i+1:])



+----------------------------------------------------------------------
|This was sent by address@hidden via Backup Central.
|Forward SPAM to address@hidden
+----------------------------------------------------------------------






reply via email to

[Prev in Thread] Current Thread [Next in Thread]