Is it safe to compile multiple ports at the same time ?

Vasil Dimov vd at FreeBSD.org
Wed May 17 12:53:11 UTC 2006


On Wed, May 17, 2006 at 08:39:44AM -0500, Wesley Shields wrote:
> On Wed, May 17, 2006 at 09:13:37AM -0300, Fernan Aguero wrote:
> > +----[ Edwin Groothuis <edwin at mavetju.org> (17.May.2006 03:16):
> > |
> > | You have to obtain a lock on the X's Makefile before you are doing
> > | to check if you have this port installed.
> > | 
> > | For example, a dependcy on pkg-config in the directory devel/pkgconfig:
> > | 
> > | - obtain lock on devel/pkgconfig/Makefile
> > | - check if pkg-config exists, and if not, build and install it.
> > | - release lock on devel/pkgconfig/Makefile
> > | 
> > |
> > +----]
> > 
> > Why not
> > 
> > - check if pkg-config exists and only if it doesn't exist,
> >   try to obtain lock on the lock target.
> 
> Because at that point aren't you in a race condition?
> 
> Port A finds out pkg-config doesn't exist.
> Port B finds out pkg-config doesn't exist.
> 
> At this point both ports determine they need to build and install the
> port.
> 
> Port B manages to obtain the lock first, and builds and installs
> pkgconfig.
> Port A waits on Port B to finish.
> Upon finishing Port A obtains the lock and builds and attempts to
> install an already installed port.
> 
> You must obtain the lock early on, like Edwin has stated.
> 

Maybe he meant

- check if pkg-config exists and only if it doesn't exist,
  try to obtain lock on the lock target.
- check if pkg-config exists, and if not, build and install it.
- release lock on devel/pkgconfig/Makefile

this will eventually save unnecessary locking with the cost of checking
twice if the port is installed.

-- 
Vasil Dimov
gro.DSBeerF at dv

Testing can show the presence of bugs, but not their absence.
                -- Edsger W. Dijkstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20060517/88a656ab/attachment.pgp


More information about the freebsd-ports mailing list