#8605 closed defect (fixed)
BUG: apache2 doesn't leave modified extra config files alone
Reported by: | wyuenho (Jimmy Yuen Ho Wong) | Owned by: | imajes@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | wyuenho (Jimmy Yuen Ho Wong), ryandesign (Ryan Carsten Schmidt), toni.viemero@…, jmroot (Joshua Root) | |
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 (16)
comment:1 Changed 18 years ago by opendarwin-2006@…
comment:2 Changed 18 years ago by danielluke (Daniel J. Luke)
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.
comment:3 Changed 18 years ago by wyuenho (Jimmy Yuen Ho Wong)
This doesn't seem to be happening anymore. Can anyone else confirm this?
comment:4 Changed 17 years ago by nox@…
Milestone: | → Port Bugs |
---|---|
Priority: | Expected → Normal |
Summary: | apache2 doesn't leave modified extra config files alone → BUG: apache2 doesn't leave modified extra config files alone |
Version: | 1.2 |
comment:5 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | wyuenho@… ryandesign@… added |
---|
comment:6 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | toni.viemero@… added |
---|
Has duplicate #12868.
comment:7 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | james@… removed |
---|---|
Owner: | changed from macports-tickets@… to imajes@… |
comment:8 Changed 17 years 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.
comment:9 Changed 17 years ago by jmroot (Joshua Root)
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} } } }
comment:10 Changed 16 years ago by jmroot (Joshua Root)
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.
comment:11 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
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.
comment:12 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
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.
comment:13 Changed 16 years 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?
comment:14 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
Port: | apache2 apache20 added |
---|
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.
comment:15 Changed 16 years ago by jmroot (Joshua Root)
Cc: | jmr@… added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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.
Also when upgrading apache2, if you've changed anything in conf/extra, your changes get overwritten. :-/