MCPcopy
hub / github.com/borgbackup/borg / display_debug_info

Method display_debug_info

src/borg/helpers/passphrase.py:138–161  ·  view source on GitHub ↗
(passphrase)

Source from the content-addressed store, hash-verified

136
137 @staticmethod
138 def display_debug_info(passphrase):
139 def fmt_var(env_var):
140 env_var_value = os.environ.get(env_var)
141 if env_var_value is not None:
142 return f'{env_var} = "{env_var_value}"'
143 else:
144 return f"# {env_var} is not set"
145
146 if os.environ.get("BORG_DEBUG_PASSPHRASE") == "YES":
147 passphrase_info = textwrap.dedent(
148 f"""\
149 Incorrect passphrase!
150 Passphrase used (between double-quotes): "{passphrase}"
151 Same, UTF-8 encoded, in hex: {bin_to_hex(passphrase.encode('utf-8'))}
152 Relevant Environment Variables:
153 {fmt_var("BORG_PASSPHRASE")}
154 {fmt_var("BORG_PASSCOMMAND")}
155 {fmt_var("BORG_PASSPHRASE_FD")}
156 {fmt_var("BORG_OTHER_PASSPHRASE")}
157 {fmt_var("BORG_OTHER_PASSCOMMAND")}
158 {fmt_var("BORG_OTHER_PASSPHRASE_FD")}
159 """
160 )
161 print(passphrase_info, file=sys.stderr)
162
163 @classmethod
164 def new(cls, allow_empty=False):

Callers 2

detectMethod · 0.80

Calls 2

bin_to_hexFunction · 0.85
getMethod · 0.45

Tested by 1