Homebrew/homebrew — pull request #28376 by jacknagel (2014-04-13 19:00:31+00:00)
Title: Use correct basename when updating dylib IDs

Given

```
-r--r--r-- 1 jacknagel admin 432272 Apr 13 13:50 libreadline.6.3.dylib
lrwxr-xr-x 1 jacknagel admin 21 Apr 13 13:03 libreadline.6.dylib -> libreadline.6.3.dylib
lrwxr-xr-x 1 jacknagel admin 21 Apr 13 13:03 libreadline.dylib -> libreadline.6.3.dylib
```

and

```
$ otool -L libreadline.6.3.dylib
libreadline.6.3.dylib:
/usr/local/Cellar/readline/6.3.3/lib/libreadline.6.dylib (compatibility version 6.0.0, current version 6.3.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
```

we will attempt to update the dylib ID on `libreadline.6.3.dylib`. However we don't look at the existing ID (`/usr/local/Cellar/readline/6.3.3/lib/libreadline.6.dylib`) when doing this, we only use the file path.

The rewritten id is

```
/usr/local/opt/readline/lib/libreadline.6.3.dylib
```
when it should be

```
/usr/local/opt/readline/lib/libreadline.6.dylib
```

This fixes it by using the basename from the original dylib ID.