Skip to content

Commit

Permalink
Invalidate id cache after script execution
Browse files Browse the repository at this point in the history
It's common for a pre-install script to do something like
    addgroup -S group 2>/dev/null
When apk installs files after this, it sets the owner/group based on id cache
but currently the id cache is stale and doesn't contain the new group at that
point: instead the file will be installed with gid that the build host
happened to have for that group -- on target this might mean a non-existing
group or a completely different group.

We can't know if the script really did modify id cache contents so make sure
to reset the id cache on every script execution.
  • Loading branch information
Jussi Kukkonen authored and kaniini committed Jul 2, 2018
1 parent 5c4b90d commit d609ef3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/package.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ void apk_ipkg_run_script(struct apk_installed_package *ipkg,

if (apk_db_run_script(db, fn, argv) < 0)
goto err;

/* Script may have done something that changes id cache contents */
apk_id_cache_reset(&db->id_cache);

goto cleanup;

err_log:
Expand Down

0 comments on commit d609ef3

Please sign in to comment.