gates / gates (push) Successful in 7m0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qRErfCoiTkvDK9N5XHbzb
26 lines
1.3 KiB
Python
26 lines
1.3 KiB
Python
# Names and MATCH / MISSING / DIFFERENT for each old backup copy of the credentials file. Never a value.
|
|
import glob, os, re, sys
|
|
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/cc-secrets")
|
|
from ccsec import store
|
|
vals = store.load_all()
|
|
for f in sorted(glob.glob(os.path.expanduser("~/.config/credentials.bak-*"))):
|
|
st = os.stat(f); out = []; total = 0
|
|
for n, line in enumerate(open(f, encoding="utf-8").read().split("\n"), 1):
|
|
s = line.strip()
|
|
if not s or s.startswith("#"):
|
|
continue
|
|
m = re.match(r"^(export\s+)?([A-Za-z_][A-Za-z0-9_-]*)=(.*)$", s)
|
|
if not m:
|
|
out.append("line %d: not KEY=VALUE (%d chars)" % (n, len(s))); continue
|
|
total += 1
|
|
name = m.group(2).replace("-", "_")
|
|
try:
|
|
v = store.unwrap(m.group(3), "line %d" % n)
|
|
except store.StoreError:
|
|
out.append("%s: cannot unwrap" % name); continue
|
|
if vals.get(name) != v:
|
|
out.append("%s: %s" % (name, "MISSING from store" if name not in vals else "DIFFERENT from store (an older value?)"))
|
|
print("=== %s: %d bytes, mode %o, %d keys; not matching the store: %s" % (os.path.basename(f), st.st_size, st.st_mode & 0o777, total, "none" if not out else ""))
|
|
for o in out:
|
|
print(" " + o)
|