coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ln -s A B fails if symlink B exists and its value is too long


From: Ken Irving
Subject: Re: ln -s A B fails if symlink B exists and its value is too long
Date: Fri, 27 Dec 2013 13:12:32 -0900
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Dec 27, 2013 at 10:03:19AM -0800, Jim Meyering wrote:
> On Thu, Dec 26, 2013 at 7:47 PM, Ken Irving <address@hidden> wrote:
> >
> >     ln -s $(printf '%0.sx' {1..256}) len256
> ...
> 
> Just a note that your printf expression produces a result much longer
> than 256 bytes.
> You can use this to see the 255->256 transition:
> 
>     ...
>     $ rm -f x; env ln -s $(printf '%0*d' 256 0) x; env ln -s a x

I think I'm seeing the expected number of bytes, having found the %0.s 
format string via google.   Could it be 'much longer' due to unicode or
other considerations?  I'm having trouble breaking %0.s down, but I guess
it somehow specifies a max length of 0 bytes so only the x remains, with
the format string repeated 256 times.

    $ printf '%0.sx' {1..256} | wc -c
    256

Your version is better for the purpose, with the target length given
more explicitly.

    $ printf '%0*d' 256 0 | wc -c
    256

I thought there was a bash expansion to produce a run of bytes, but
couldn't find it.

Ken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]