[MacPorts] #55672: tftp-hpa @5.2: unversioned turd file in var
MacPorts
noreply at macports.org
Thu Jan 11 10:48:45 UTC 2018
#55672: tftp-hpa @5.2: unversioned turd file in var
------------------------+----------------------
Reporter: ryandesign | Owner:
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: | Port: tftp-hpa
------------------------+----------------------
The port installs an unversioned turd file into its var directory. Ports
should not install unversioned files, except for config files and other
files the user is expected to edit.
The portfile says:
{{{
set tftp-root ${prefix}/var/${name}/
}}}
{{{
xinstall -m 777 -d ${tftp-root}
}}}
{{{
destroot.keepdirs ${tftp-root}
}}}
This instructs MacPorts to install the file `${prefix}/var/tftp-hpa
/.turd_tftp-hpa` 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:
{{{
xinstall -m 777 -d ${destroot}${tftp-root}
}}}
{{{
destroot.keepdirs ${destroot}${tftp-root}
}}}
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 "${tftp-root}/.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.
--
Ticket URL: <https://trac.macports.org/ticket/55672>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list