Opened 7 years ago
Closed 4 months ago
#55670 closed defect (fixed)
tao @6.4.5: unversioned turd file installed in logdir
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | lockhart (Thomas Lockhart) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | tao |
Description
The port installs an unversioned turd file into its log directory. Ports should not install unversioned files, except for config files and other files the user is expected to edit.
The portfile says:
set logdir ${prefix}/var/log/tao
destroot.keepdirs ${logdir}
xinstall -d -o ${taouser} -m 0755 ${logdir}
This instructs MacPorts to install the file ${prefix}/var/log/tao/.turd_tao
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}${logdir}
xinstall -d -o ${taouser} -m 0755 ${destroot}${logdir}
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 "${logdir}/.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 (1)
comment:1 Changed 4 months ago by jmroot (Joshua Root)
Resolution: | → fixed |
---|---|
Status: | new → closed |
In ddcab5398cb9c34107dc5ba9414b7f7bc9332191/macports-ports (master):