pkg(8) should not silently discard errors when installing new packages

Aperta
#857 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c
Ambito
cli

Direzione di ricerca

Inizia in libpkg/scripts.c, in pkg_script_run(), soprattutto nella gestione di waitpid() per gli script -*INSTALL, e controlla il flag esistente che distingue le nuove installazioni dagli upgrade. Usa la discussione IRC collegata per comprendere la distinzione prevista. Il lavoro è completato quando gli errori degli script delle nuove installazioni non vengono più ignorati silenziosamente e la gestione degli upgrade mantiene il proprio comportamento di rollback.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In 4158cd4 the behavior for all pkg scripts have been changed to silently discard errors but only report them. The reasoning behind this is that when doing an upgrade, such errors may prevent the pkg(8) tools from reverting the system to previous state.

We (FreeNAS) have hit this when we are converting the packaging system to pkgNG. It seems like that we should be more careful handling the errors, specifically, the errors should not be ignored if we are doing a new install.

Original IRC discussion:

16:32 @delphij bapt: am I understanding correctly that pkg(8) would errors from post-install scripts?
16:34 @delphij bapt: in libpkg/scripts.c, pkg_script_run() line 182-184, it checks if the *-{DE,}INSTALL script returns an non-zero status but didn't set ret = EPKG_FATAL, is this intentional?
16:36 @delphij bdrewery: ^^
16:37 * delphij thinks the waitpid() loop should set ret as well
16:41 @bapt delphij: yes intentinal to avoid breaking all the upgrade process
16:41 @bapt suboptimal though
16:41 @bapt don't have a better idea that reporting for now
16:41 @delphij bapt: I think only 'delete' should be ignoring errors...
16:42 @bapt if you are in a middle of an upgrade
16:42 @bapt and the script fail if it returns EPKG_FAIL it will rollback the transaction
16:42 @bapt that is what I want to avoid
16:43 @bapt because you will end up with an inconsistent state on your system
16:43 @bapt but really open to better idea
16:43 @delphij bapt: hrm can't we use a flag instead? e.g. if we are doing "new" installs, errors shouldn't be ignored silently
16:43 @bapt on new install I agree
16:44 @bapt and we do have a flag
16:44 @delphij Craig hit this when converting FreeNAS to use pkgng for packages
16:44 @delphij where he converted existing build scripts to a POST-INSTALL action
16:44 @bapt can you open a tiket with that discussion?
16:44 @delphij sure
16:44 @delphij where should I open it? on github or bugzilla.freebsd.org?
16:44 @bapt it around 2 am I will forgot otherwise
16:44 @bapt honnestly github is prefered
16:45 @delphij ok will do
#16:45 @bapt thanks

Lingua principale
C
Stelle
835
Fork
313
Merge medio
3g 7h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di freebsd/pkg

Tutte le issue di freebsd/pkg

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.