pkgsrc-Bugs archive

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

pkg/57546: pkg_add leaves a corrupted mess when interrupted



>Number:         57546
>Category:       pkg
>Synopsis:       pkg_add leaves a corrupted mess when interrupted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 27 12:50:00 +0000 2023
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetBSD Foun
>Environment:
>Description:
Hitting ^C, or losing power, or crashing, while in the middle of pkg_add leaves a mess.

Same is probably true of pkg_delete.
>How-To-Repeat:
1. Run pkg_add on a large package.
2. Hit ^C or yank the power while it's running.
>Fix:
1. Create an intent log, e.g. a sqlite3 database that is itself updated with transactions.
2. Teach pkg_add/delete to separately update and execute the intent log -- `execute' here means add or delete files, run INSTALL or DEINSTALL scripts, and update the legacy pkgdb.  (And rebuild the legacy pkgdb from scratch if that part was interrupted, because I'm not confident in atomicity of Berkeley DB updates.)
3. Audit INSTALL and DEINSTALL scripts for idempotence.



Home | Main Index | Thread Index | Old Index