Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#46733 closed defect (fixed)

Multiple definitons of flock TCL command cause problems, e.g., with restore_ports.tcl

Reported by: mtalexander (Mike Alexander) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.3.99
Keywords: Cc: larryv (Lawrence Velázquez), markemer (Mark Anderson)
Port:

Description

When I ran restore_ports.tcl after upgrading to Yosemite it failed with the error

expected integer but got "-exclusive" obtaining lock on /opt/local/var/macports/registry/.registry.lock
    while executing
"registry::exclusive_lock"
    (procedure "mportexec" line 32)
    invoked from within
"mportexec $workername $install_target"
Unable to execute target 'install' for port 'fftw-3-single': expected integer but got "-exclusive" obtaining lock on /opt/local/var/macports/registry/.registry.lock
    while executing
"install_ports $operationList"
    (file "restore_ports/restore_ports.tcl" line 300)

I tracked this down to the fact that there are two definitions of the flock TCL command installed as part of MacPorts. One is defined in TclX_FlockObjCmd which is in base/vendor/tclx8.4/generic/tclXflock.c. The other is defined in FlockCmd which is in base/src/pextlib1.0/flock.c. Macports seems to want, and get, the latter one. For some reason restore_ports sometimes, but not always, gets the other.

Commenting out the call to TclX_FlockInit in Tclxcmd_Init which is in base/vendor/tclx8.4/generic/tclXinit.c seems to have fixed the problem. Unfortunately this isn't all that easy to do as part of the build since these files are installed unchanged from vendor archives. Perhaps a new archive with the appropriate change needs to be part of the MacPorts package.

Change History (8)

comment:1 Changed 9 years ago by neverpanic (Clemens Lang)

The problem really is the order, in which we load the packages. I'm not sure why it differs randomly on some occasions.

Instead of patching TclX, we should just rename our local copy of flock (that has different semantics from the TclX one). If you want to build a patch, it's in base/src/pextlib1.0/flock.c, I think.

Alternatively, we could get rid of our own implementation and use TclX' flock instead, but that requires rewriting due to the different usage.

comment:2 Changed 9 years ago by larryv (Lawrence Velázquez)

Cc: larryv@… added

Cc Me!

comment:3 Changed 9 years ago by markemer (Mark Anderson)

Cc: emer@… added

Cc Me!

comment:4 Changed 9 years ago by markemer (Mark Anderson)

Same thing happened to me with 10.11 - I'm looking to see if the fixes you describe work. Making a change from flock to flockmp, I'll let you know if it works.

comment:5 Changed 9 years ago by markemer (Mark Anderson)

Totally worked. I'll post a patch tonight.

comment:6 Changed 9 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts Future
Resolution: fixed
Status: newclosed

Fixed in r138165. I'd backport this to the 2.3.x branch, but it seems we're going to do a feature release sooner than that, so I'll leave that be for now.

comment:7 Changed 9 years ago by jmroot (Joshua Root)

The 2.3 series doesn't include TclX, so no backport is necessary.

comment:8 Changed 7 years ago by jmroot (Joshua Root)

Milestone: MacPorts Future
Note: See TracTickets for help on using tickets.