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 20:18:20 -0400

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


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

The problem is strings which ends with a backslash (as the logic thinks that it 
is a escape character). This prohibits the root directory to be used in the 
syntax.

Anyone with more knowledge about python that can help to rewrite the logic? 
(and not break the code for linux syntax such as server::/directory)

This is the first time I ever looked at Python source and I even used the 
debugging features with import pdb and pdb.set_trace() but I'm not 100% 
comfortable to change the code (yet).

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]