What do you mean by "those lists are discrete." AppendItem is called in
CheckPackages immediately preceeding PackageList and it appends the item
with the package name onto pending_pkgs. The variable pending_pkgs is
passed by address to PackageList.
Here are the calls that pass pending_pkgs down to FreBSDPackageList
------------------------------------------------------------------------
>From CheckPackages in do.c line 2885
AppendItem(&pending_pkgs,name,NULL);
PackageList(ptr,name,ptr->pkgmgr,ptr->ver,ptr->cmp,&pending_pkgs);
------------------------------------------------------------------------
This is not package manager specific, it is executed for all package
managers when the remove action is specified in the input file. Every
time PackageList is invoked, pending_pkgs should have one item
containing the package name . . .
The PackageList function receives the pointer to pending_pkgs as "struct
Item **pklist".
------------------------------------------------------------------------
>From PacakgeList in package.c line 132
int PackageList(struct Package *ptr,char* package, enum pkgmgrs pkgmgr,
char *version,enum cmpsense cmp, struct Item **pkglist)
------------------------------------------------------------------------
PackageList passes it, untouched, to each of the package manager
specific functions including FreeBSDPackageList
------------------------------------------------------------------------
>From PackageList in package.c line 153
match = FreeBSDPackageList(package, version, cmp, pkglist);
------------------------------------------------------------------------
After FreeBSDPackageList executes the pkg_info command, it adds an item
to the list pkglist, for each line of the command output, with
AppendItem.
------------------------------------------------------------------------
>From FreeBSDPackageList in package.c line 1901
while (!feof (pp))
{
*VBUFF = '\0';
ReadLine (line, CF_BUFSIZE - 1, pp);
Debug("PackageList: read line %s\n",line);
if( strlen(line) > 1 )
{
snprintf(OUTPUT,CF_BUFSIZE,"Package to remove: %s\n",line);
AppendItem(pkglist,line,"");
}
}
------------------------------------------------------------------------
I can't see a way that the item with the package name cannot be on the
pkglist when FreeBSDPackageList gets it.
This actually seems like a problem for remove, because further down, in
CheckPackages, ProcessPendingPackages is called based on if the list
pending_pkgs has an element on it. Even if PackageList didn't find any
versions that match, the first element would still be on the list.
Am I missing something?
Craig J. Martin, Sr. Systems/Applications Engineer | Travelocity | *W:
682.605.6374 | *M: 972.365.2038 | Loc: B1-268
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine