php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61951 "make install" script fails when prefix dir is a symbolic link
Submitted: 2012-05-05 11:00 UTC Modified: 2013-10-15 11:54 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: stolen dot data dot net at gmail dot com Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.4.2 OS: Any
Private report: No CVE-ID: None
 [2012-05-05 11:00 UTC] stolen dot data dot net at gmail dot com
Description:
------------
I've been using a symbolic link scheme for the prefix destination dir of 
PHP/Apache/etc. software that I compile myself for over ten years now, to easily 
and quickly switch between releases in case of problems showing up when I move 
to a new version:

# ls -l /usr/opt
drwxr-xr-x   6 root  wheel  512 Mar 20  2011 php536
drwxr-xr-x   6 root  wheel  512 Dec 11 12:44 php538
drwxr-xr-x  16 root  wheel  512 May  5 11:02 php542
lrwxr-xr-x   1 root  wheel    6 May  5 11:02 php -> php542
...

./configure --prefix=/usr/opt/php --other-flags

If something goes wrong, I just shut down the servers, change the symbolical 
link, restart... You get the idea...

It is not a problem with any earlier version of PHP, but as of PHP 5.4.0 
something changed in the "install" portion of the Makefile that breaks this 
handy practice:

# make install
Installing PHP CLI binary:        /usr/opt/php/bin/
Installing PHP CLI man page:      /usr/opt/php/php/man/man1/
mkdir: /usr/opt/php/php: File exists
mkdir: /usr/opt/php/php/man: Too many levels of symbolic links
mkdir: /usr/opt/php/php/man/man1: Too many levels of symbolic links
*** Error code 1

Stop in /usr/opt/php-5.4.2 (line 243 of Makefile).


And when I take a look at what the install script has been doing:

# cd /usr/opt/php
# ls -l
total 4
drwxr-xr-x  2 root  wheel  512 May  5 13:43 bin
lrwxr-xr-x  1 root  wheel    3 May  5 11:02 php -> php


For some reason, when the prefix dir is a symbolic link, the 5.4.x Makefile 
creates a symbolic link to itself inside the prefix dir. Note also that the 
timestamp of the symbolic is identical to the actual symbolic link I make for 
the prefix destination, as if the Makefile tries to copy the directory into 
itself.

The problem is easily solved by entering the prefix dir, removing the broken 
link that the install script creates and just "mkdir php", then resuming "make 
install" again.

This shouldn't be needed, obviously. The script shouldn't fail just because the 
prefix happens to be a symbolic link to an actual destination sitting in the 
same directory - there are no technical complications caused by this handy 
practice.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-07 19:25 UTC] stolen dot data dot net at gmail dot com
Specifically, the PHP Makefile fails when the destination of the symbolic link 
doesn't end with a trailing slash.


This will cause the new Makefile to fail...:

drwxr-xr-x   9 root  wheel  512 May  7 21:21 php542
lrwxr-xr-x   1 root  wheel    7 May  7 21:10 php -> php542


...but the Makefile bug doesn't manifest itself in this case:

drwxr-xr-x   9 root  wheel  512 May  7 21:21 php542
lrwxr-xr-x   1 root  wheel    7 May  7 21:10 php -> php542/


(Note the trailing slash at the end of the symbolic link destination...)
 [2013-10-01 13:59 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2013-10-01 13:59 UTC] mike@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Works fine here.

$ make install
Installing PHP CLI binary:        /tmp/php-5.4/sym/bin/
Installing PHP CLI man page:      /tmp/php-5.4/sym/php/man/man1/
Installing PHP CGI binary:        /tmp/php-5.4/sym/bin/
Installing PHP CGI man page:      /tmp/php-5.4/sym/php/man/man1/
Installing build environment:     /tmp/php-5.4/sym/lib/php/build/
Installing header files:          /tmp/php-5.4/sym/include/php/
Installing helper programs:       /tmp/php-5.4/sym/bin/
  program: phpize
  program: php-config
Installing man pages:             /tmp/php-5.4/sym/php/man/man1/
  page: phpize.1
  page: php-config.1
$ cat config.nice
#! /bin/sh
#
# Created by configure

'/home/mike/src/php-5.4/configure' \
'--cache-file=config.cache' \
'--disable-all' \
'--prefix=/tmp/php-5.4/sym' \
"$@"
$ ls -ld sym
lrwxrwxrwx 1 mike users 4  1. Okt 15:07 sym -> real
$ ls -ld real
drwxr-xr-x 6 mike users 120  1. Okt 15:55 real
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 05:01:27 2024 UTC