Eric Blake wrote: > Jim Meyering <jim <at> meyering.net> writes: >> ?? As far as I can see, one cannot remove ASSIGN_STRDUPA, >> since it is not defined anyplace else. >> The code (cp.c, df.c, copy.c) won't compile without it. > > Aargh. Serves me right for deleting without testing. I merely grepped for > strdupa (no other uses) rather than ASSIGN_STRDUPA. I've reverted that > portion > of the patch. Although there's still the issue that ASSIGN_STRDUPA can cause > stack overflow if used on arbitrarily long names; maybe it's worth rewriting > these interfaces to use Bruno's malloca interfaces (alloca for short lengths, > but malloc for long; requires adding a cleanup call, but still provides speed > in the common case of short strings).
IMHO, it's not worth trying to avoid uses of ASSIGN_STRDUPA in cp.c and copy.c, since it's already limited by PATH_MAX. And once cp is rewritten to use fts and fd-relative names, alloca-related limitations will be even less of a problem. Though by then, the offending code will probably be gone.