Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-24-2014, 03:01 PM
|
#1
|
Member
Registered: Feb 2008
Distribution: Slackware
Posts: 595
Rep:
|
httpd upgrade overwrote /srv/httpd directory with a symlink!
Part warning, part question.
I keep my web server content in /srv/httpd - I have previously asked Pat to consider this more proper location as a new default, but IIRC his opinion was that while /srv/httpd was technically better, /var/www 'aint broke so he wasn't fixing it.
Four days ago I patched up my server and with it upgraded httpd-2.2.17 to httpd-2.2.25. I have discovered to my abject horror that my web server directory was completely overwritten by the symlink back to /var/www (!!).
My warning is that if anyone else uses /srv/httpd or /srv/www for content, to duplicate that content before upgrading httpd.
My question is WHAT THE HELL?!?
Why should upgradepkg EVER be allowed to forcefully overwrite an existing directory with a symlink? Can anyone offer a suggestion of how this occurred so I can submit a patch to fix and stop it happening to anyone else?
Last edited by zordrak; 04-24-2014 at 03:01 PM.
Reason: Readability.
|
|
|
04-24-2014, 03:31 PM
|
#2
|
Senior Member
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367
|
I don't have a 14.1 install handy so I don't know if it is the same but in 14.0's install script there is this:
Code:
# Don't wipe out an existing document root:
if [ ! -L srv/www -a -d srv/www ]; then
mv srv/www srv/www.bak.$$
fi
if [ ! -L srv/httpd -a -d srv/httpd ]; then
mv srv/httpd srv/httpd.bak.$$
fi
It seems it is already trying not to clobber anything.
|
|
1 members found this post helpful.
|
04-24-2014, 03:36 PM
|
#3
|
Member
Registered: Feb 2008
Distribution: Slackware
Posts: 595
Original Poster
Rep:
|
Panic over :-D You're bob-on.
Because of the file dates I had assumed I created that backup ages ago. Now that I look more closely you're exactly right. It's all there. My bad
|
|
|
04-26-2014, 03:05 PM
|
#4
|
LQ Veteran
Registered: May 2008
Posts: 7,043
|
It's good that the doinst.sh moves existing directories out of the way rather than just blindly stomping on them but IMO it'd be much better for it not to clobber existing directories at all. I think I'd favour removing those symlink creations from the httpd.Slackbuild, and putting then in the doinst.sh wrapped in a much safer 'test ! -e' :
if [ ! -e srv/httpd ]; then ; ln -Tsf /var/www srv/httpd ; fi
I'm not entirely sure what would happen under the existing scheme if /srv/httpd was the mountpoint of a separate filesystem but I get the feeling that it might get ugly under the right circumstances (e.g. the mv fails and then the rm -rf in the doinst.sh wipes out the existing contents anyway)
Last edited by GazL; 04-26-2014 at 03:07 PM.
|
|
1 members found this post helpful.
|
04-27-2014, 01:23 AM
|
#5
|
Member
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875
|
It would be better to do the symlink the other way around.
Rational :-
http://www.pathname.com/fhs/pub/fhs-2.3.pdf
Gives /srv as the correct location for data served by the machine, /var/www is historical and only needs to exist for people who haven't caught up with current standards (which are pretty old btw).
|
|
|
04-27-2014, 05:54 AM
|
#6
|
LQ Veteran
Registered: May 2008
Posts: 7,043
|
I disagree. Other UNIX/UNIX-likes still use /var/www so it's not merely "historical". The FHS doesn't say that anything in /srv has to be a directory rather than a symlink. What it does say however is:
Quote:
Distributions must take care not to remove locally placed files in these directories without administrator permission.
|
... and unfortunately that is what is happening here (though more accurately they're being moved rather than removed).
Actually, on reflection, rather than doing what I suggested above, I think the package should just leave the contents of /srv well alone and leave its management entirely in the hands of the sysadmin/user.
|
|
1 members found this post helpful.
|
04-28-2014, 04:09 AM
|
#7
|
Member
Registered: Feb 2008
Distribution: Slackware
Posts: 595
Original Poster
Rep:
|
Given that Slack is following the FHS recommendation to some extent already by allowing apache to reference /srv paths in the default config:
My preference: Pat sucks it up and just moves the default location to /srv/httpd, letting /var/www/ symlink to it.
Whether symlinks are in /srv or in /var: The symlink should be created conditionally IFF there is nothing already in place. A possible option would be to create "/srv/httpd.new -> /var/www" if /srv/httpd already exists (or the other way round if the default location were moved); but whether that's necessary is an exercise for the reader.
|
|
|
04-28-2014, 04:21 AM
|
#8
|
Member
Registered: Oct 2009
Distribution: Slackware
Posts: 534
|
I have to say, I'm a little surprised of this... I don't agree with updates that touch "working directories" like /srv/www and /srv/httpd are supposed to be .. It doesn't matter if backups are made or not (I like that they are).. The packages shouldn't touch them and links should only be created if nothing exists there..
P.S. Just think of what could happen if you upgrade under low disk space conditions..
LE: As for the location, I think /var/www is the best place since there are cases where /var might get mounted separately but it wouldn't make sense to mount /srv for a few MBs of data on a different partition/disk (and leaving them on under / is just careless)..
Last edited by Smokey_justme; 04-28-2014 at 04:35 AM.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 02:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|