__package_update_index does not update on new installations if --maxage given #63

Closed
opened 2021-11-20 13:23:22 +00:00 by ungleich-gitea · 4 comments

By setup new lxc containers, some default manifests are run (which also runs every time a container gets reconfigured). In these manifests, __package_update_index --maxage $((60 * 60 * 24)) and several __package types get called.

These fail because the package index is not up to date (up to this, no __package_update_index got really executed). By debugging this, the currage explorer echos 0 if it does not find the specific file to stat. After creating a brand new lxc container, the specific file do not exist. Therefor, the gencode-remote exists, because the explorer returned a lower value than the maxage parameter.

In the lxc container installation, no package index update was done, so there is no cache file to stat. In such case, the type should rather assume no index update was done and do an update.

I think this can be solved several ways (but don't know the best):

  1. echoing a "max integer" constant which will always be higher than the maxage parameter (does this exist in a shell env?)
  2. thread the value 0 special and make an index update; theoretical, the type could be executed again as fast as the time difference is still 0, which would be a false positive
  3. echoing a special non-numeric case to indicate this problem (also, this could be -1, which is a slightly better solution than 2.); the gencode-remote must then first check if this case happened before comparing both values as integers
By setup new lxc containers, some default manifests are run (*which also runs every time a container gets reconfigured*). In these manifests, `__package_update_index --maxage $((60 * 60 * 24))` and several `__package` types get called. These fail because the package index is not up to date (up to this, no `__package_update_index` got really executed). By debugging this, the *currage* explorer echos `0` if it does not find the specific file to stat. After creating a brand new lxc container, the specific file do not exist. Therefor, the `gencode-remote` exists, because the explorer returned a lower value than the maxage parameter. In the lxc container installation, no package index update was done, so there is no cache file to stat. In such case, the type should rather assume no index update was done and do an update. I think this can be solved several ways (*but don't know the best*): 1. echoing a "max integer" constant which will always be higher than the maxage parameter (*does this exist in a shell env?*) 2. thread the value `0` special and make an index update; theoretical, the type could be executed again as fast as the time difference is still `0`, which would be a false positive 3. echoing a special non-numeric case to indicate this problem (also, this could be `-1`, which is a slightly better solution than *2.*); the `gencode-remote` must then first check if this case happened before comparing both values as integers
Author
Owner

closed

closed
Author
Owner

mentioned in merge request !858

mentioned in merge request !858
Author
Owner

As @ander stated in chat, nothing more should be done with these special index updating types, because there should be moved to the package installation type. This is already done for the __package_apt type, but not for pacman or apk.

I'll still creating a merge request for it, because it is no big deal (and I've already wrote this), required for __package_pacman and maybe some people will still using this type ;-)

As @ander stated in chat, nothing more should be done with these special index updating types, because there should be moved to the package installation type. This is already done for the `__package_apt` type, but not for *pacman* or *apk*. I'll still creating a merge request for it, because it is no big deal (*and I've already wrote this*), required for `__package_pacman` and maybe some people will still using this type ;-)
Author
Owner

mentioned in commit matze/cdist@358e04b2af

mentioned in commit matze/cdist@358e04b2afa380b63843869f1f57967e0ef8de22
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ungleich-public/cdist#63
No description provided.