[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Finding command size; was Re: FIX for Arg list too long...
From: |
Howard Chu |
Subject: |
RE: Finding command size; was Re: FIX for Arg list too long... |
Date: |
Thu, 30 Nov 2000 13:40:50 -0800 |
> -----Original Message-----
> From: address@hidden [mailto:address@hidden Behalf Of
> Robert Boehne
> To all Gurus:
> Ok, I'm currently working on the implementation of a fix
> for "Arg list too long" errors, but I wonder if anyone
> could give me advice on how to get the size of the
> command that will be used. How about this:
> length=`echo ${some_command} | dd bs=1 of=/dev/null 2>&1 | head -1 | cut
> -d'+' -f1`
> If I get the command length, I would then need to test if it
> is too long, perhaps by adding one character to see if the length
> calculated by the above method has changed
>
> Q: is this portable? My shell scripting book says it is not
> extremely portable, any ideas on how to do this without dd?
Try
length=`expr ${some_command} : ".*"`
Of course, when some_command gets too long, it all falls apart. There's no
way around that.
> Q: Should I just avoid this problem all together by always
> building archive files by adding one object at a time?
>
That could get unbearably slow for big projects...
Maybe just stick with a "reasonable" length, like 512 or 1024, and
leave it at that.
> Q: Are there any platforms that cannot make a shared
> library out of an archive file? (AIX 4.2+ ?)
AIX can do it using the -nogc (no garbage collection) linker option.
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc