[squeak-dev] 3.11.3.2135 for Unix

Eliot Miranda eliot.miranda at gmail.com
Fri Sep 18 02:33:51 UTC 2009


On Thu, Sep 17, 2009 at 7:16 PM, Markus Lampert <markuslampert at yahoo.com> wrote:
>
> Ian,
>
> your changes work (for me), if you add the following loop:
>
> ...
> bindir="`dirname \"$0\"`"
> bindir="`canonic \"${bindir}\"`"
> while test -L "${bindir}"; do
>  bindir="`canonic \"${bindir}\"`"
> done
> ...
>
> The '-L' could also be a '-h'. Unfortunately I only have access to Linux, so I don't know about the portability of this. My problem here seems to be that I have a link to a link ...
>
> Eliot,
>
> tried your implementation and ran into the same problem, it only resolves the first layer. So I guess do_readlink would have to be run in a loop to resolve the whole cascade.

Oops, didn't pay enough attention first time around.  The attached
takes a -f flag to follow links.  Its not bery tested.  It also makes
the -s option more useful, enclosing paths that contain separators and
other characters meaningful to the shell in quotes, but it doesn't
bother to escape embedded quotes correctly.

>
> I realize that this is probably not the place for this discussion. Where should I have posted initially?

The vm discussion list vm-dev at lists.squeakfoundation.org.  But no biggie.

>
> Have fun,
> Markus
>
>
>
> >
> >From: Eliot Miranda <eliot.miranda at gmail.com>
> >To: The general-purpose Squeak developers list <squeak-dev at lists.squeakfoundation.org>
> >Sent: Thursday, September 17, 2009 2:22:04 PM
> >Subject: Re: [squeak-dev] 3.11.3.2135 for Unix
> >
> >Hi Ian,
> >
> >
> >    if it'll help you're welcome to add the attached to Squeak under the MIT license.  I wrote it for my own use years ago and it is all my own work, etc, etc.  Its pretty portable and more flexible than e.g. the Mac OS readlink.
> >
> >
> >On Thu, Sep 17, 2009 at 1:57 PM, Ian Piumarta <piumarta at gmail.com> wrote:
> >
> >>>Hi Markus,
> >>
> >>>>Unfortunately GNU/Linux doesn't agree with the rest of the world about the flags (including -f) understood by readlink (and Solaris doesn't have it at all) so your suggestion isn't going to work.
> >>
> >>>>How about this instead?
> >>
> >>>>readlink="`which readlink`"
> >>>>test -x "${readlink}" || readlink=echo
> >>
> >>>>canonic () {(
> >>>>    cd  "`dirname     \"$1\"`"
> >>>>    dir="`basename    \"$1\"`"
> >>>>    cd  "`${readlink} \"${dir}\"`"
> >>>>    pwd
> >>>>)}
> >>
> >>>>bindir="`dirname \"$0\"`"
> >>>>bindir="`canonic \"${bindir}\"`"
> >>>>prefix="`dirname \"${bindir}\"`"
> >>>>[...rest of file the same...]
> >>
> >>>>Cheers,
> >>>>Ian
> >>
> >>
> >>
> >
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readlink.c
Type: application/octet-stream
Size: 2652 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090917/0f17695d/readlink.obj


More information about the Squeak-dev mailing list