While it can be argued that I should be using some other sort of library systems for my DSL the fact remains that it works on Linux with bash but fails on OpenBSD in both ksh and bash.
I have a shell script that loads environment variables (via source) from other shell files. Once all the files are sourced I then run a standalone app that uses the environment to produce a report.
I'm pretty sure that I'm running out of available memory for variables... but how do I determine how much remains?
envtmplis my binary stands for environmental templates. It converts the environment to a golangmap[string]stringand then templates to produce code.
local$ envtmpl --output=./src/zquery/report_Customers.go report.go.envtmpl
./regen.sh[174]: envtmpl: Argument list too long
The argument list is not too long... it has to be the contents of the environment.
UPDATE: I've run your test to see exactly how much "memory" I have available. Seems like I have more than I thought and now I have to reconsider what this error message means Argument list too long when there are two simple arguments. So the question is where is this error really coming from and what does it mean?
obsd66:~/dev/zurvita/zquery$export var=1234578901234456789012345678901234567890123456789012345789012344567890123456789012345678901234567890
obsd66:~$while (( i++ < 10000 )) ;do var=$var$var ; print "i=$i\t" ${#var} ; done
i=1 200
i=2 400
i=3 800
i=4 1600
i=5 3200
i=6 6400
i=7 12800
i=8 25600
i=9 51200
i=10 102400
i=11 204800
i=12 409600
i=13 819200
i=14 1638400
i=15 3276800
i=16 6553600
i=17 13107200
i=18 26214400
i=19 52428800
i=20 104857600
i=21 209715200
i=22 419430400
ksh: internal error: unable to allocate memory
obsd66:~$echo $KSH_VERSION
@(#)PD KSH v5.2.14 99/07/13.2
UPDATE: I replaced my command envtmpl... with exactly ls -l and I received the same error only referencing ls. So it's not environment memory and it's not variable expansion.
UPDATE: I tried ls instead of ls -l with the same results.
UPDATE: getconf ARG_MAX in openbsd produces a number 2x that of my linux machine. Works in linux but not openbsd.