Bug 211623

Summary: [PATCH] Mk/Scripts/do-fetch fails when DISTDIR is symlink
Product: Ports & Packages Reporter: Harald Schmalzbauer <bugzilla.freebsd>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Some People CC: ports-bugs
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch do-fetch.sh to do mkdir DISTDIR only if onexistant none

Description Harald Schmalzbauer 2016-08-06 11:34:35 UTC
Created attachment 173355 [details]
Patch do-fetch.sh to do mkdir DISTDIR only if onexistant

In do-fetch.sh, there's a unconditional 'mkdir -p "${dp_DISTDIR}"'
This doesn't work if ${DISTDIR} exists and is a symbolic link.
I'm not aware of problems with DISTDIR beeing a symlink, so here's a patch which only does 'mkdir' if DISTDIR doesn't exist at all – no checks for read/write permissions suitable at that point, nor if the link is dead.
Further check's shouldn't be affected, if there are any in place (long time ago I included own Makefiles doing such checks because they were missing at that time – haven't checked if that changed during the last 5 years)
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-08-08 12:57:52 UTC
A commit references this bug:

Author: mat
Date: Mon Aug  8 12:57:34 UTC 2016
New revision: 419840
URL: https://svnweb.freebsd.org/changeset/ports/419840

Log:
  Only try to create DISTDIR if it does not exist already.

  It turns out, some people, instead of setting DISTDIR, replace it with a
  symlink pointing to where DISTDIR should be pointing.

  And mkdir -p <symlink> fails.

  PR:		211623
  Reported by:	Harald Schmalzbauer
  Sponsored by:	Absolight

Changes:
  head/Mk/Scripts/do-fetch.sh