I've discovered a problem with Pike 7.6.24 (and 7.6.34) when using constant Classname = (program)"Classname.pike" statements:
12:41 ~/fetch KingOfPrussia) pike fetch.pike Incorrect number of arguments.
.. expected behaviour. but:
12:41 ~/fetch KingOfPrussia) cd hui 12:42 ~/fetch/hui KingOfPrussia) pike ../fetch.pike /home/tobij/fetch/ImgJob.pike:1:Error evaluating constant.
Cast "FetchJob.pike" to program failed. /usr/lib/pike/master.pike:1002: master()->cast_to_program("FetchJob.pike",0,0) /home/tobij/fetch/ImgJob: object(/home/tobij/fetch/ImgJob.pike)->__INIT() /usr/lib/pike/master.pike:349: master()->compile_string("static constant FetchJob = (program)"FetchJob.pike";\n\ninherit FetchJob;\n\nstatic Regexp.PCRE fname = Regexp.PCRE("([^/]*)$");\n\nstatic void "+[190],"/home/tobij/fetch/ImgJo b.pike",0,/home/tobij/fetch/ImgJob,0,0) /usr/lib/pike/master.pike:819: master()->low_findprog("/home/tobij/fetch/ImgJob",".pike",0,0) /usr/lib/pike/master.pike:928: master()->findprog("/home/tobij/fetch/ImgJob",".pike",0,0) /usr/lib/pike/master.pike:976: master()->low_cast_to_program("ImgJob","/home/tobij/fetch/fetch.pike",0,0) /usr/lib/pike/master.pike:998: master()->cast_to_program("ImgJob.pike","/home/tobij/fetch/fetch.pike",0) /home/tobij/fetch/fetch.pike:0: object(/home/tobij/fetch/fetch.pike)->FetchJob() /usr/lib/pike/master.pike:349: master()->compile_string("#!/usr/bin/pike\n\n#ifndef NT\n# define NT\t4\n#endif\n\n#define unless(x) if(!(x))\n\nstatic constant Manager = (program)"Manager.pike";\nstatic cons"+[1034],"/home/tobij/fetch/ fetch.pike",0,/home/tobij/fetch/fetch,0,0) /usr/lib/pike/master.pike:819: master()->low_findprog("/home/tobij/fetch/fetch",".pike",0,0) /usr/lib/pike/master.pike:928: master()->findprog("/home/tobij/fetch/fetch",".pike",0,0) /usr/lib/pike/master.pike:964: master()->low_cast_to_program("/home/tobij/fetch/fetch","/usr/lib/pike/master.pike",0,0) /usr/lib/pike/master.pike:998: master()->cast_to_program("/home/tobij/fetch/fetch.pike","/usr/lib/pike/master.pike",0) /home/tobij/fetch/ImgJob.pike:1:Error in constant definition. /home/tobij/fetch/fetch.pike:11:Error evaluating constant.
/home/tobij/fetch/fetch.pike:11:Error in constant definition. Pike: Failed to compile script: Compilation failed.
/usr/lib/pike/master.pike:2650: master()->_main(({"pike","../fetch.pike"}),({"MANPATH=/usr/local/share/"+[216],"SSH_AGENT_PID=6952","HOSTNAME=KingOfPrussia","INTEL_LICENSE_FILE=/opt/i"+[14],"SHELL=/bin/tcsh","TERM=rxvt","HOST=KingOfPrussi a","QTDIR=/usr/qt/3",,,53}))
The program files are deposited at http://public.tobij.de/res/plain/.
The problem might be that ImgJob.pike gets compiled by low_findprog(), and the compiler seems to not supply the 'current_file' argument to it's cast_to_program("FetchJob.pike", ...) call...
Should this behaviour of Pike considered to be a bug, or are my casts illegitimate?
PS: Martin Baehr told me that the problem does not occur with Pike-7.6.13.