Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the phar symlink point to the binary directory #1288

Closed
wants to merge 1 commit into from
Closed

Conversation

@Ponce
Copy link
Contributor

Ponce commented May 19, 2015

slackware current, php-5.6.8: spotted wrong link /usr/bin/phar.
seems an oversight present also in master.

Or we got a symlink pointing to the build files
@smalyshev

This comment has been minimized.

Copy link
Contributor

smalyshev commented May 20, 2015

I'm not sure this is correct - if phar.phar is installed in $(INSTALL_ROOT)$(bindir) why the link would be in $(bindir)?

@Ponce

This comment has been minimized.

Copy link
Contributor Author

Ponce commented May 21, 2015

because $(INSTALL_ROOT) is used to install file in a temporary location, for example when packaging, while $(bindir) is the location in the filesystem when the package is installed: in Slackware case, the vanilla result installing the package built without the patch is

$ ls -la /usr/bin/phar
lrwxrwxrwx 1 root root 35 mag 8 20:50 /usr/bin/phar -> /tmp/package-php//usr/bin/phar.phar

but there's nothing in /tmp/package-php//usr/bin/phar.phar (the link is broken) and the invocation of phar from the command line fails

$ ls -la /tmp/package-php//usr/bin/phar.phar
/bin/ls: cannot access /tmp/package-php//usr/bin/phar.phar: No such file or directory
$ ls -la /usr/bin/phar.phar
-rwxr-xr-x 1 root root 14823 apr 24 20:32 /usr/bin/phar.phar

that's why when the link is created the destination it should point to ought to be the final one in the filesystem.

@Ponce

This comment has been minimized.

Copy link
Contributor Author

Ponce commented May 21, 2015

driven by the curiosity I've checked how others do: fedora people are forced too fixing this manually when they assemble the package (source http://pkgs.fedoraproject.org/cgit/php.git/plain/php.spec)

(cd $RPM_BUILD_ROOT%{_bindir}; ln -sfn phar.phar phar)

and so opensuse (source https://build.opensuse.org/package/view_file/devel:languages:php/php5/php5.spec)

rm %{buildroot}%{_bindir}/phar
%{__ln_s} -f %{_bindir}/phar.phar %{buildroot}%{_bindir}/phar

@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

Perhaps even a simple (relative link are relative to directory of the link)

  $(LN_S) -f phar.phar $(INSTALL_ROOT)$(bindir)/phar

For downstream packaging link to full path is not correct (can cause some issue in chrooted env, another reason why it is recreated in the fedora .spec file).

@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

@Ponce is there a bug report about this ? (required for NEWS)

@Ponce

This comment has been minimized.

Copy link
Contributor Author

Ponce commented May 21, 2015

I think the reason why is recreated in the fedora .spec file it's because it's broken, as I explained above.
I don't like fedora way because having a link phar in /usr/bin without the full path (/usr/bin/phar.phar) can create problems if someone has another binary called phar.phar in another location that comes first in PATH (~/bin/phar.phar or whatever): this other is called first by the symlink in this case.

regarding the bug report I gotta say I haven't checked...

@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

I think this have to be fixed in all branches (5.5+)

@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

I don't like fedora way because having a link phar in /usr/bin without the full path (/usr/bin/phar.phar) can create problems if someone has another binary called phar.phar in another location that comes first in PATH

No.
As said previously, relative link are relative to link directory. If /usr/bin/phar => phar.phar, "phar" will use /usr/bin/phar.phar and no other scripts.

Example, having ~/bin/phar.phar (echo "Damned") and /usr/bin/phar.phar

$ ll /usr/bin/phar
lrwxrwxrwx. 1 root root 9 15 mai   10:07 /usr/bin/phar -> phar.phar
$ phar.phar 
damned
$ phar
No command given, check /usr/bin/phar help
@Ponce

This comment has been minimized.

Copy link
Contributor Author

Ponce commented May 21, 2015

ah, ok, sorry for the noise. :)

do you want me to do another pull request?

@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

@Ponce yes please, and a bug report

@Ponce

This comment has been minimized.

Copy link
Contributor Author

Ponce commented May 21, 2015

ok, hope I have done everything correctly

#1294
https://bugs.php.net/bug.php?id=69680

@Ponce Ponce closed this May 21, 2015
@remicollet

This comment has been minimized.

Copy link
Contributor

remicollet commented May 21, 2015

ok, hope I have done everything correctly

Yes, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.