Opened 13 years ago

Closed 13 years ago

#29952 closed defect (fixed)

'port -f activate' doesn't move aside broken symlinks

Reported by: jon.hermansen@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.0.0
Component: base Version: 1.9.99
Keywords: Cc:
Port:

Description

In this case, installing apache2 with some variants bails like so:

x ./opt/local/apache2/bin/rotatelogs
x ./Library/LaunchDaemons/
x ./Library/LaunchDaemons/org.macports.apache2.plist
Error: Target org.macports.activate returned: Image error: /Library/LaunchDaemons/org.macports.apache2.plist already exists and does not belong to a registered port.  Unable to activate port apache2. Use 'port -f activate apache2' to force the activation.
DEBUG: Backtrace: Image error: /Library/LaunchDaemons/org.macports.apache2.plist already exists and does not belong to a registered port.  Unable to activate port apache2. Use 'port -f activate apache2' to force the activation.
    invoked from within
"throw registry::image-error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port [$port name]. Use 'p..."
    ("foreach" body line 47)
    invoked from within
"foreach file $imagefiles {
                set srcfile "${extracted_dir}${file}"

                # To be able to install links, we test if we can lst..."
    invoked from within
"registry::write {
            foreach file $imagefiles {
                set srcfile "${extracted_dir}${file}"

                # To be able to instal..."
    invoked from within
"try {
        registry::write {
            foreach file $imagefiles {
                set srcfile "${extracted_dir}${file}"

                # To be ..."
    (procedure "_activate_contents" line 21)
    invoked from within
"_activate_contents $requested"
    (procedure "portimage::activate" line 57)
    invoked from within
"registry_activate $subport $version $revision $portvariants [array get user_options]"
    (procedure "portactivate::activate_main" line 4)
    invoked from within
"$procedure $targetname"
Warning: the following items did not execute (for apache2): org.macports.activate
Log for apache2 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_apache2/apache2/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>

I try to force the activation:

[jhermansen@yawn ~]$ sudo port -f activate apache2
--->  Computing dependencies for apache2
--->  Activating apache2 @2.2.19_0+eventmpm+openldap+universal
Error: Target org.macports.activate returned: error renaming "/tmp/mpextractQh1B5Qei/Library/LaunchDaemons/org.macports.apache2.plist" to "/Library/LaunchDaemons/org.macports.apache2.plist": file already exists
Log for apache2 is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_apache2_2.2.19_0+eventmpm+openldap+universal/apache2/main.log
Warning: Failed to execute portfile from registry for apache2 @2.2.19_0+eventmpm+openldap+universal
--->  Activating apache2 @2.2.19_0+eventmpm+openldap+universal
Error: port activate failed: error renaming "/tmp/mpextractRde4HE1a/Library/LaunchDaemons/org.macports.apache2.plist" to "/Library/LaunchDaemons/org.macports.apache2.plist": file already exists

which doesn't work. This does:

[jhermansen@yawn ~]$ sudo rm /Library/LaunchDaemons/org.macports.apache2.plist
[jhermansen@yawn ~]$ sudo port -f activate apache2
--->  Computing dependencies for apache2
--->  Activating apache2 @2.2.19_0+eventmpm+openldap+universal
--->  Cleaning apache2

Change History (2)

comment:1 Changed 13 years ago by jon.hermansen@…

Also, I don't recall seeing this issue on 1.9.2. Must be new.

comment:2 Changed 13 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.0.0
Resolution: fixed
Status: newclosed
Summary: 'port -f activate' doesn't force file overwrite'port -f activate' doesn't move aside broken symlinks

AFAICT this would have happened in 1.9 as well. Fixed, r79864.

Note: See TracTickets for help on using tickets.