
grub4dos-chenall - issue #133
Environment variables cannot be defined after many set/resets
What steps will reproduce the problem? I cannot give an example, but with Easy2Boot v1 (uses lots of g4d batch files), I have found that I run out of environment space for variables.
I define a lot of variables (approx 30-50), set them to zero (set FRED=) and use them again, etc.
Eventually I find I cannot define any more varaibles. e.g. set FILE1=sadsdsa set FILE2=dsdddsa set FILE3=saddsdsa
and only FILE1 is set, FILE2 and FILE3 are not set.
Is this a problem with a limited area of memory for variables or maybe there is no garbage collection to get rid of old variables in grub4dos?
If you need a batch file to show the problem, I can try to make one.
Is there a way to force garbage collection of the environment variable space?
The use of insmod also seems to reduce this space (I think)?
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Comment #1
Posted on May 13, 2013 by Happy HippoThe max is 60.
you can use set *
to clear all environment.and using setlocal
to set local environment
eg.
set a=abcd
set b=casdf
set c=asdfsadf
setlocal
set *
set xxxx
Comment #2
Posted on May 13, 2013 by Happy KangarooWhat do you mean by max=60?
e.g set A=1 set B=1 set C=1 set A= set B=
How many varaible have been used now 1 or 3?
Comment #3
Posted on May 13, 2013 by Happy KangarooCan the number of variable be increased to say 200? It would be very useful. e.g. If I have 50 files, I want to hold the names in variables FILE_1=fred.iso FILE_2=doris.iso etc. This means I can only have about 10-20 files and then all variable space is used up? Also, If I type set after adding many variables - only about 30 variables are listed even though I cannot add any more variables using set!
Comment #4
Posted on May 14, 2013 by Happy Hippo2
1
3
current we use 1 sector as variable names.and a name max length is 8. 512/8 = 64,above 60 is use for internal variables. and current is no way to extend.
Why do you need so many variables? for FILE select why not use a MENU? MODBOOT select many file to boot,but only use little variables.
Comment #5
Posted on May 14, 2013 by Happy KangarooI want the user to be able to define his own set of Product Keys for all different Windows OS's. Also, for different languages, all of the menu headings, menu entries, menu footer text, menu colours, background .bmp filename, default entries for each menu are held by variables. This means the user can easily change these settings from a simple 'config' file containing: !BAT set MainMenu= ----- MAIN MENI ---- set AUTOMENU= ------ AUTO MENU ---- set MDEFAULT=1 set AUTODEF=3 set MMCOLOUR=0133 etc.
So it is quite easy to run out of variables when I have 12 different menus! What I do now is make my own 'set' and 'get' code by putting a variable in memory at (md)0xxxxxx and then 'get' it back when I want it.
Is there no easy way to have more variables? Perhaps a 2nd set of 60 variables called %@FRED% %@DORIS% could be supported which use a different 64 sectors somewhere else in memory?
Comment #6
Posted on May 15, 2013 by Happy HippoPlease try this. can set up to max 65,536 variables. use below command to extend. set @extend BASE_ADDR size the BASE_ADDR is the memory start of extended variable. size is how many variables will extended.(MAX is 0xFFFF);
eg.add 10 variables spaces at 0x40000. set @extend 0x40000 10 this need memory (((10+63)>>6) + 10)*512 = 5632.
You must confirm the BASE_ADDR has enough space.
This feature will undocumented..
- grub4dos-0.4.5c-2013-05-15.7z 259.61KB
Comment #7
Posted on May 15, 2013 by Happy KangarooThank you very much for this work! :-) It seems to almost work, but using @extend does not clear the memory area first. So after a reboot I still have variables there from last time, if I run set command. Of course, I could do @extend 0x4000 10 set * at the beginning, but this means I cannot just extend the area inside the program.
Please can the @extend command also clear the memory area first?
I also notice that set @ shows BASE_ADDR:4000,40200,size:10
nice!
Comment #8
Posted on May 16, 2013 by Happy HippoYes!Next.
Comment #9
Posted on May 16, 2013 by Happy HippoThis issue was updated by revision r344.
the extend variables will not work with SETLOCAL/ENDLOCAL,
Comment #10
Posted on May 21, 2013 by Happy HippoComment deleted
Comment #11
Posted on May 21, 2013 by Happy Kangaroothe extend variables will not work with SETLOCAL/ENDLOCAL
Do you mean setlocal/endlocal will only work for the first 60 variables?
Comment #12
Posted on May 23, 2013 by Happy HippoYes,the setlocal/endlocal only save/restore the first 60.
Status: Done
Labels:
Type-Defect
Priority-Medium