fix: write the current answer into an entry the ledger forgot
A desktop entry that was edited in place is left alone once it carries the marker, and the only thing that ever writes it again is the undo a change of flags goes through - which reads the ledger. So an entry the ledger has lost is one nothing looks at any more: it keeps whatever an older version put on its command line, and an update that moves browsers to a different flag moves every browser but that one. The copy taken before the edit is named after the path, not recorded in the ledger, and is still there. A marked entry with no ledger line is now put back from that copy and written again from scratch, which is the same thing the undo would have done, and it lands in the ledger on the way out. Only entries edited in place need this. A generated entry is built from the source entry every time and is right by construction, and a flag file has its block rewritten whenever the contents differ.
This commit is contained in:
1 parent
dcdf2c1df3
commit
2ea64d0603
2 files changed
+24
-2
No files matched your search
+14
-2
@@ -423,9 +423,21 @@ mca_desktop_apply() {
|
||||
# a shortcut to.
|
||||
_mca_entry_patch_inplace() {
|
||||
local file="$1" gate="$2"
|
||||
local id prog packaging=native content backup kind
|
||||
local id prog packaging=native content backup kind copy
|
||||
|
||||
grep -q "^$MCA_MARK_INPLACE=" "$file" 2>/dev/null && return 0
|
||||
# Already ours, and normally that is the end of it: what is in there is what
|
||||
# this version put there. Not so for a file the ledger has no record of -
|
||||
# nothing would ever look at that one again, neither the undo a change of
|
||||
# flags goes through nor this, which leaves a marked file alone, and it would
|
||||
# keep an answer from an older version for good. The copy taken before the
|
||||
# edit is named after the path and is still there, so the file goes back to
|
||||
# what it was and is written again below.
|
||||
if grep -q "^$MCA_MARK_INPLACE=" "$file" 2>/dev/null; then
|
||||
mca_ledger_has "$file" && return 0
|
||||
copy="$MCA_BACKUPDIR/$(mca_backup_name "$file")"
|
||||
[[ -f $copy ]] || return 0
|
||||
cp -p -- "$copy" "$file" 2>/dev/null || return 0
|
||||
fi
|
||||
|
||||
_mca_desktop_read "$file"
|
||||
[[ -n $DE_EXEC ]] || return 0
|
||||
|
||||
Reference in new issue
Block a user