Bug 222737 - make install creates recursive symbolic links
Summary: make install creates recursive symbolic links
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Wolfram Schneider
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-02 12:07 UTC by Wolfram Schneider
Modified: 2017-10-07 09:10 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfram Schneider freebsd_committer freebsd_triage 2017-10-02 12:07:39 UTC
If you run `make install' twice for the web pages, then you will get broken symlinks for the security patches:

export DESTDIR=$(mktemp -d); 

WEB_ONLY=YES make install; egrep -rl wosch $DESTDIR >/dev/null 
====> Creating symlinks in /tmp/tmp.cro8qBGF/data/security/patches
tcp47.patch -> SA-04:04/tcp47.patch
tcp47.patch.asc -> SA-04:04/tcp47.patch.asc
tcp52.patch -> SA-04:04/tcp52.patch
tcp52.patch.asc -> SA-04:04/tcp52.patch.asc
SA-10-05 -> SA-10:05
SA-04:09/kadmind.patch -> kadmin.patch
SA-04:09/kadmind.patch.asc -> kadmin.patch.asc
SA-02:40/kadmin.patch -> kadmind.patch
SA-02:40/kadmin.patch.asc -> kadmind.patch.asc
SA-00:23/ip_options.diff -> ip-options.diff
SA-00:23/ip_options.diff.asc -> ip-options.diff.asc

WEB_ONLY=YES make install; egrep -rl wosch $DESTDIR >/dev/null 
====> Creating symlinks in /tmp/tmp.cro8qBGF/data/security/patches
tcp47.patch -> SA-04:04/tcp47.patch
tcp47.patch.asc -> SA-04:04/tcp47.patch.asc
tcp52.patch -> SA-04:04/tcp52.patch
tcp52.patch.asc -> SA-04:04/tcp52.patch.asc
SA-10-05 -> SA-10:05
SA-04:09/kadmind.patch -> kadmin.patch
SA-04:09/kadmind.patch.asc -> kadmin.patch.asc
SA-02:40/kadmin.patch -> kadmind.patch
SA-02:40/kadmin.patch.asc -> kadmind.patch.asc
SA-00:23/ip_options.diff -> ip-options.diff
SA-00:23/ip_options.diff.asc -> ip-options.diff.asc
egrep: /tmp/tmp.cro8qBGF/data/security/patches/SA-10:05/SA-10:05: Too many levels of symbolic links
egrep: /tmp/tmp.cro8qBGF/data/security/patches/SA-10-05/SA-10:05: Too many levels of symbolic links
Comment 1 Wolfram Schneider freebsd_committer freebsd_triage 2017-10-02 12:19:51 UTC
I think the problem is in 

doc/en_US.ISO8859-1/htdocs/security/patches/Makefile

f16141f111f (bz 2012-09-17 08:42:56 +0000 19) SYMLINKS+=        SA-10:05 SA-10-05

so, SA-10-05 will be symlinked itself.

Bjoern?
Comment 2 Wolfram Schneider freebsd_committer freebsd_triage 2017-10-06 13:58:30 UTC
Actually, I think the error is that the SYMLINK features which works only for files and not for a directory. The semantic of `ln -fs' is special if you run it for directories twice, e.g.


mkdir from
ln -sf from to
find . -name from -or -name to
./to
./from

now run it again
ln -sf from to

find . -name from -or -name to
./to
./from
./from/from

ls -l from
total 1
lrwxrwxr-x  1 wosch  devel  4 Oct  6 13:54 from -> from


Proposed fix: in share/mk/web.site.mk 
we need to delete the target first before we call ln -fs
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-10-07 09:03:24 UTC
A commit references this bug:

Author: wosch
Date: Sat Oct  7 09:03:10 UTC 2017
New revision: 51070
URL: https://svnweb.freebsd.org/changeset/doc/51070

Log:
  we need to delete the target symlink first before we can create it

  This solved the issue with symlinks to directories.  The semantic
  of `ln -fs' is special if you run it for directories twice, e.g.

  mkdir from
  ln -sf from to
  find . -name from -or -name to
  ./to
  ./from

  now run it again
  ln -sf from to

  find . -name from -or -name to
  ./to
  ./from
  ./from/from

  ls -l from
  total 1
  lrwxrwxr-x  1 wosch  devel  4 Oct  6 13:54 from -> from

  PR: 222737

Changes:
  head/share/mk/web.site.mk