Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #8605 (closed defect: fixed)

Opened 3 years ago

Last modified 3 weeks ago

BUG: apache2 doesn't leave modified extra config files alone

Reported by: wyuenho@… Owned by: imajes@…
Priority: Normal Milestone: Port Bugs
Component: ports Version:
Keywords: Cc: wyuenho@…, ryandesign@…, toni.viemero@…, jmr@…
Port: apache2, apache20

Description

After I uninstalled apache2, the port also removed those config files under /opt/local/apache2/conf/extra. Aren't these files under extra meant to be changed and left alone?

Change History

Changed 3 years ago by opendarwin-2006@…

Also when upgrading apache2, if you've changed anything in conf/extra, your changes get overwritten. :-/

Changed 3 years ago by dluke@…

  • cc james@… added

The post-destroot file rename -force ${confDir}/httpd.conf ${confDir}/httpd.conf.sample needs to be modified to do the same thing for the other conf files.

Changed 2 years ago by wyuenho@…

This doesn't seem to be happening anymore. Can anyone else confirm this?

Changed 17 months ago by nox@…

  • priority changed from Expected to Normal
  • summary changed from apache2 doesn't leave modified extra config files alone to BUG: apache2 doesn't leave modified extra config files alone
  • version 1.2 deleted
  • milestone set to Port Bugs

Changed 17 months ago by ryandesign@…

  • cc wyuenho@…, ryandesign@… added

Changed 15 months ago by ryandesign@…

  • cc toni.viemero@… added

Has duplicate #12868.

Changed 13 months ago by ryandesign@…

  • cc james@… removed
  • owner changed from macports-tickets@… to imajes@…

Changed 10 months ago by miro.dietiker@…

After some apache uninstall and install again (with other variants) my conf/extra/httpd-vhosts.conf was overwritten completely.

Wouldn't it be better to name all of these conf/extra/* files to *.sample?

unsampled files (cp, mv) are then unmodified by any upgrade or uninstall/reinstall.. The same way as httpd.conf.sample acts.

Thanks for your inputs.

Changed 10 months ago by jmr@…

The squid port handles this by installing only *.conf.default, and creating *.conf in post-activate only if they don't already exist:

post-activate {
	# Make sure initial conf files are present and setup correctly
	foreach f { squid.conf mime.conf } {
		if {![file exists ${prefix}/etc/squid/${f}]} {
			file copy ${prefix}/etc/squid/${f}.default \
				${prefix}/etc/squid/${f}
		}
	}
}

Changed 6 months ago by jmr@…

Has duplicate #15980. This is definitely still a problem.

BTW, for those that have been bitten by this, your old config files should presumably still exist under /opt/local/var/macports/software/apache2 if you haven't yet uninstalled the old inactive version.

Changed 6 months ago by ryandesign@…

No, I do not believe user-modified config files will be found under /opt/local/var/macports/software/apache2 or anywhere else, unless the user explicitly put them there. Users who were unaware of this and did not make other arrangements should check their Time Machine (or other) backups, until the port is fixed.

Changed 6 months ago by ryandesign@…

Sorry, you're right, MacPorts uses hardlinks, the modified configs will be under the old version's directory in /opt/local/var/macports/software/apache2. Sorry for the noise.

Changed 2 months ago by talklists@…

So far, it does not look like anyone is offering up suggestions on how to solve this, other than jmr@, perhaps I can help. As with most other config file software, you do not touch the config files. in apache's case, anything that ends in .conf, and further, anything that was added and is not a part of the initial install, needs to be left untouched.

Apache is pretty nice in that config files are in well known places, so it should be simple to leave them alone. Every now and then, even Apple will write over your *.conf files, and cause trouble, but it has been at least a year since this last happened.

The solution as I see it is that upgrades do not touch *.conf files, period. Major version updates will need to be taken into consideration. As far as I can remember, the config file options do not change over time/versions. So while the 1.3 branch has it's config file, and the 2.x branch certainly was changed, within major versions, they do not change.

Since version 1 and version 2 install in totally different locations, this still remains a non issue. In the rare event that a apache update adds and/or changes functionality to a config file, the port maintainer needs to provide a patch that will change the files in place. Ideally, making a backup as well. More ideal, in my opinion, is to simply provide a patch script and let the user run it locally. If files are to be edited in place, make a backup, and stuff a note in it as to why it exists.

I am a bit paranoid about this, so I move my config files for most everything, like named.conf and httpd.conf and many others, elsewhere. This is not in MacPorts, but in plain OS X that I do this. I then simply link from the standard location, to the new location. If an update wipes a link, no big deal, I can diff the files, and repair. I am yet to run a diff that found a diff, for some reason Apple just likes to replace config files for no reason. Probably easier than excluding them.

OS X Server more or less does not touch your config files, or they update the old ones, to match the new ones, without altering your settings. This can, and has caused issues, but a careful awk can usually do just fine.

Comments?

Changed 2 months ago by ryandesign@…

  • port set to apache2, apache20

There's nothing particularly complicated here to do or explain, it's just nobody has done it yet. The apache2 port already does not overwrite your httpd.conf; now it just needs to also not overwrite your extra conf files.

I don't think it's reasonable to expect MacPorts to upgrade your non-MacPorts-managed conf files though. I wouldn't expect the maintainer to provide an upgrade script either. It is the user's responsibility to inspect the new sample conf files for any changes, and apply them to their own conf file. Or you could suggest to upstream that they should develop and supply an update script with apache2, which the MacPorts port would then of course also provide as soon as it's updated.

Changed 3 weeks ago by jmr@…

  • cc jmr@… added
  • status changed from new to closed
  • resolution set to fixed

Should be fixed by r43973. Remember that your extra conf files will be taken away one last time when the old revision is deactivated. Sorry for the long delay, folks.

Note: See TracTickets for help on using tickets.