I believe this is already in the svn
M
Daniel Dehennin wrote:
> Hello,
>
> A little patch to make the expansion of the package names in
> InstallPackagesItem.
>
> Regards.
>
>
> ------------------------------------------------------------------------
>
> --- src/do.c 2007-11-01 22:34:37 +0000
> +++ src/do.c 2007-11-04 17:07:59 +0000
> @@ -2844,9 +2844,7 @@
> continue;
> }
>
> - ExpandVarstring(ptr->name,name,"");
> -
> - snprintf(lock,CF_BUFSIZE-1,"%s_%d_%d",name,ptr->cmp,ptr->action);
> + snprintf(lock,CF_BUFSIZE-1,"%s_%d_%d",ptr->name,ptr->cmp,ptr->action);
>
> if
> (!GetLock(ASUniqueName("packages"),CanonifyName(lock),ptr->ifelapsed,ptr->expireafter,VUQNAME,CFSTARTTIME))
> {
> @@ -2854,13 +2852,13 @@
> continue;
> }
>
> - match = PackageCheck(ptr,name,ptr->pkgmgr, ptr->ver, ptr->cmp);
> + match = PackageCheck(ptr,ptr->name,ptr->pkgmgr, ptr->ver, ptr->cmp);
>
> /* Check for a problem executing the command */
>
> if ((match != 1) && (match != 0))
> {
> - snprintf(OUTPUT,CF_BUFSIZE,"Error: Package manager query failed,
> skipping %s\n", name);
> + snprintf(OUTPUT,CF_BUFSIZE,"Error: Package manager query failed,
> skipping %s\n", ptr->name);
> CfLog(cferror,OUTPUT,"");
> ptr->done = 'y';
> continue;
> @@ -2882,12 +2880,12 @@
>
> if (ptr->action == pkgaction_remove)
> {
> - AppendItem(&pending_pkgs,name,NULL);
> - PackageList(ptr,name,ptr->pkgmgr,ptr->ver,ptr->cmp,&pending_pkgs);
> + AppendItem(&pending_pkgs,ptr->name,NULL);
> +
> PackageList(ptr,ptr->name,ptr->pkgmgr,ptr->ver,ptr->cmp,&pending_pkgs);
> }
> else if (ptr->action == pkgaction_upgrade)
> {
> - UpgradePackage(ptr,name,ptr->pkgmgr,ptr->ver,ptr->cmp);
> + UpgradePackage(ptr,ptr->name,ptr->pkgmgr,ptr->ver,ptr->cmp);
> }
> }
> else
> @@ -2896,7 +2894,7 @@
>
> if (ptr->action == pkgaction_install)
> {
> - AppendItem(&pending_pkgs,name, NULL);
> + AppendItem(&pending_pkgs,ptr->name, NULL);
>
> /* Some package managers operate best doing things one at a time. */
>
>
> --- src/install.c 2007-10-11 09:09:51 +0000
> +++ src/install.c 2007-11-04 17:03:07 +0000
> @@ -5049,6 +5049,7 @@
>
> { struct Package *ptr;
> char buffer[CF_EXPANDSIZE];
> + char expanded_name[CF_EXPANDSIZE];
>
> if ( ! IsInstallable(CLASSBUFF))
> {
> @@ -5066,15 +5067,17 @@
> return;
> }
>
> +ExpandVarstring(name,expanded_name,"");
> +
> Debug1("InstallPackagesItem(%s,%s,%s,%s,%s)\n",
> - name,ver,CMPSENSETEXT[sense],PKGMGRTEXT[mgr],PKGACTIONTEXT[action]);
> +
> expanded_name,ver,CMPSENSETEXT[sense],PKGMGRTEXT[mgr],PKGACTIONTEXT[action]);
>
> if ((ptr = (struct Package *)malloc(sizeof(struct Package))) == NULL)
> {
> FatalError("Memory Allocation failed for InstallPackageItem() #1");
> }
>
> -if ((ptr->name = strdup(name)) == NULL)
> +if ((ptr->name = strdup(expanded_name)) == NULL)
> {
> FatalError("Memory Allocation failed for InstallPackageItem() #2");
> }
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine
--
Mark Burgess
Professor of Network and System Administration
Oslo University College
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272 Email: [EMAIL PROTECTED]
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine