Re: busybox mkdir implementation

Jim Meyering <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
Glenn McGrath <[email protected]> wrote:
> There is an implementation of mkdir in busybox, the core of which is
> pretty nice code (if i do sayso myself), it work recursively.
>
> I just quickly skimmed over your ./lib/makepath.c its pretty big.. it
> probably does lots of stuff bb mkdir doesnt need to do, nevertheless i
> think it may be worth your time to look over the following url's

Thanks,
However, I prefer the implementation in makepath.c, because
`mkdir -p' is not subject to file name length or stack size limits.
E.g., this works: mkdir -p $(perl -e 'print "a/" x 40000')
[well, it didn't quite work, but does, now -- fixed in coreutils-4.5.2]

But for busybox, where code size matters, I'm sure your implementation
is fine.

However, when trying this (with busybox-0.60.4)

  busybox mkdir -p $(perl -e 'print "a/" x 10000')

I was surprised to see that it does nothing, yet produces
no diagnostic and exits successfully (0).
strace shows that stat fails with errno == ENAMETOOLONG.

Jim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.