Iain, all freebsd packages have versions in the package name.  Try it  
again like the example in the reference and you'll find it works  
fine.  (I am the maintainer of the package code by default right now,  
and I use freebsd exclusively).

Deleting the lines as you've suggested breaks the package tools  
entirely.  It won't upgrade or remove packages at all.

I suppose it should be possible to support version-less packages, but  
as I feel that this is a Really Bad Idea ... I'm certainly not going  
to spend time to code that.  Patches accepted.

On Mar 6, 2008, at 10:22 AM, Iain Patterson wrote:
>    My test case is very simple:
>
>      control:
>        ActionSequence = ( packages )
>        DefaultPkgMgr = ( freebsd )
>        FreeBSDInstallCommand = ( "/usr/sbin/pkg_add -r %s" )
>
>      packages:
>        bash action=install
>
>    So what I expect this to do is go off and retrieve the latest
> version of bash and install it.  In fact what happens is that cfagent
> segfaults.
>
>    Inside FreeBSDPackageCheck():
>
>      strncpy(pkgname, package, CF_BUFSIZE - 1);
>      pkgversion = strrchr(pkgname, '-');
>      *pkgversion = '\0';
>      pkgversion += 1;
>
>      Debug("FreeBSDPackageCheck(): Requested version %s %s of %s\n",
> CMPSENSETEXT[cmp],(version[0] ? version : "ANY"), pkgname);
>
>    I don't know very much about FreeBSD packages as I haven't used
> FreeBSD in some years and I never used packages very much even then so
>   I'm not sure what exactly is supposed to be happening here.  It
> looks like we're trying to support adding packages by version number
> or just grabbing "the latest" which is what I want.  In any event I
> notice that pkgversion is never seen again in the rest of the
> function.  We simply dereference it and crash because strrchr()
> returned 0 and there's nothing TO dereference.
>
>    At time of writing the latest version of bash available is 3.2.25
> so I'll change my rule viz:
>
>      packages:
>        bash-3.2.25 action=install
>
>    This time cfagent doesn't crash but because we ignored the
> pkgversion variable the package that pkg_add tries to retrieve from
> ftp.freebsd.org is bash-3.2.25.tbz.  This fails since the default
> location is ftp://ftp.freebsd.org/.../Latest/ and only has bash.tbz.
>
>    I suppose this might work if you had your own custom package
> repository but out of the box it doesn't.  Even if I override the
> PACKAGESITE location to ftp://ftp.freebsd.org/.../All/ I would need to
> know the exact version number of each package I wanted to install.
>
>    After deleting the lines containing pkgversion in
> FreeBSDPackageCheck() and FreeBSDPackageList() - three lines near the
> top of each function - I was able to run my original rule successfully
> and install bash.
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine

-- 
Jo Rhett
Net Consonance : consonant endings by net philanthropy, open source  
and other randomness


_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to