Bug 208583 - www/nginx: Uninstall breaks user symlink for LOCALBASE/www/nginx
Summary: www/nginx: Uninstall breaks user symlink for LOCALBASE/www/nginx
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: easy, needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2016-04-06 16:39 UTC by Steven Hartland
Modified: 2017-03-05 10:52 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (osa)
koobs: merge-quarterly?


Attachments
Patch which fixes the issue (552 bytes, patch)
2016-04-06 16:39 UTC, Steven Hartland
koobs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Hartland freebsd_committer freebsd_triage 2016-04-06 16:39:41 UTC
Created attachment 169042 [details]
Patch which fixes the issue

On uninstall the nginx port removes the link %D/www/nginx if it exists.

It expects that it created it but that might not be the case.

The uninstall should check to see if it created the link i.e. it points where it would if it created it, and only then remove it.

I'm thinking something like the attached patch.
Comment 1 VK 2016-09-08 09:20:33 UTC
Maintainer timeout, back to pool.

Personally, I don't understand why is /var/www/nginx even used like that, if it symlinks to nginx-dist by default. The default config maps "localhost" docroot to /var/www/nginx, which is then a symlink to nginx-dist, which contains the warning not to touch or change anything. So what's the point?

If you ask me, I'd use only nginx-dist, as a default "localhost" docroot with that warning kept, and with the "Welcome to nginx" default index.html.

The users should be advised not to use that dir for any purpose, but to change the docroot to whatever else, unless they're okay with default index being present for default "localhost" docroot. They're free to copy over whatever default file from nginx-dist and manage their own docroots.

Flagging with needs-patch too, as I believe above to be the best solution. Will also need one for www/nginx-devel.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2016-09-08 09:27:43 UTC
@Steven, probably want someone with pkg-plist magic knowledge to review this simple change (portmgr? someone with pkgng chops? bapt? (cc'd)

Once reviewed/approved, feel free to assign yourself to commit

If the quarterly branch port is affected, this should also be MFH'd.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2016-09-08 09:28:14 UTC
Comment on attachment 169042 [details]
Patch which fixes the issue

Explicitly record (implicit) maintainer approval (timeout)
Comment 4 Baptiste Daroussin freebsd_committer freebsd_triage 2016-09-08 10:37:08 UTC
Your patch is ok, but there are plenty of other issues in that plist :)

for example:
%%WWWDATA%%@exec mkdir -p -m 755 %D/www/nginx-dist

should be 

@dir(,,555) www/nginx-dist

%%WWWDATA%%@exec if [ ! -d %D/www/nginx/ ] ; then ln -fs %D/www/nginx-dist %D/www/nginx; fi


What happens for for any reason a user using nginx decided that %D/www/nginx should be a file? it gets nuked :( during installation/upgrades

So this test should imho test for absence of any file/directory and only in that case makes a symlink

%%WWWDATA%%@exec chmod a-w %D/www/nginx-dist
This is totally useless given the @dir is done (note the 555 and not the 755 on the @dir

If I manage to find more time to properly test I will commit this Week End along with your patch
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2016-09-08 10:39:25 UTC
@Baptiste Thanks for the quick feedback & review
Comment 6 VK 2016-09-08 12:24:20 UTC
I meant LOCALBASE/www/nginx, sorry for the confusion, my mind was elsewhere...
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2016-09-11 10:42:17 UTC
@Vlad, as per our IRC conversation, did you want to attach a patch removing the unnecessary symlink, thereby precluding the need to run fancy comparison checks to determine whether it points to the original place or not?
Comment 8 Martin Wilke freebsd_committer freebsd_triage 2017-03-05 10:52:42 UTC
Hi,

I close this here since there is no feedback since the latest version. Please feel free to reopen if the problem still exist.