Opened 7 years ago

Closed 7 years ago

#55671 closed defect (fixed)

burp @2.0.54: unversioned turd file in etc

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: burp

Description

The port installs an unversioned turd file into its etc directory. Ports should not install unversioned files, except for config files and other files the user is expected to edit.

The portfile says:

destroot.keepdirs ${prefix}/etc/burp/CA-client

This instructs MacPorts to install the file ${prefix}/etc/burp/CA-client/.turd_burp directly, bypassing the destroot. This file is not registered to the port and remains when the port is deactivated. This is not desired.

The purpose of destroot.keepdirs is to prevent MacPorts from deleting what would otherwise be an empty directory during the cleanup that happens after the destroot phase. The cleanup only affects the contents of ${destroot} so there's no need to use destroot.keepdirs for anything that's outside of ${destroot}.

Most everything done in the destroot phase should happen inside ${destroot} so that it is registered to the port. So the above needs to be changed to:

destroot.keepdirs ${destroot}${prefix}/etc/burp/CA-client

This changes the files registered to the port, so its revision should be increased.

After this change, the port will fail to activate for any user who had previously installed the port and therefore has the unversioned turd file on their system. (This coincidentally includes our buildbot workers.) To fix this, a pre-activate block should be added to the port to prevent the activation failure:

pre-activate {
    # Prevent activation failure for upgrades. This can be removed after January 2019.
    foreach filepath "${prefix}/etc/burp/CA-client/.turd_${subport}" {
        if {[file exists ${filepath}] && [registry_file_registered ${filepath}] == "0"} {
            if {[catch {delete ${filepath}}]} {
                ui_warn "Cannot delete ${filepath}; please remove it manually"
            }
        }
    }
}

This block can be removed after everyone has upgraded to the new version. To give everyone time to do that, I'd leave the block in place for one year at least.

Change History (2)

comment:1 Changed 7 years ago by drkp (Dan Ports)

Status: newaccepted

Ugh, I thought that destroot.keepdirs automatically added ${destroot}

Last edited 7 years ago by drkp (Dan Ports) (previous) (diff)

comment:2 Changed 7 years ago by drkp (Dan Ports)

Resolution: fixed
Status: acceptedclosed

In a85edb86e011702f7cbe61a9ae102393bc5d4335/macports-ports:

burp: fix unversioned turd file in /etc
Closes: #55671

Note: See TracTickets for help on using tickets.