further to this, I'm definitely finding problems with the system(5) in 
fxposix.ri

For a start, I don't understand why the mode argument is allowed to be a 
fie. An integer, a string, or null makes sense, but a file? That's not the 
problem...

You may remember I mentioned that system() seems to be losing the last 
argument from the list. That's confirmed for the first call to system().

The next problem I've just noticed (on Windows) is spurious junk ending up 
on the command line of the called process. However not the first call; the 
2nd, 3rd etc call to system progressively passes junk across.

Here's a dump of caller and callee's ideas of the arguments, printed with 
image() to stderr (and manually broken into shortish lines just for the 
email)


CALLING "c:\\Progra~1\\WacGen\\tools-trunk\\bin.t\\wacro"
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0000.tmp"
"-f" "../genero.4gs/alien.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "FOURGEN=1"

CALLED:
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0000.tmp"
"-f" "../genero.4gs/alien.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer"
------

CALLING "c:\\Progra~1\\WacGen\\tools-trunk\\bin.t\\wacro"
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0001.tmp"
"-f" "../genero.4gs/brw_dump.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "FOURGEN=1"

CALLED:
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0001.tmp"
"-f" "../genero.4gs/brw_dump.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" 
"esources]\"/sand/devel/master/auth/FourJs/resources\"__DEBUG_INIFILE__"
------

CALLING "c:\\Progra~1\\WacGen\\tools-trunk\\bin.t\\wacro"
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0002.tmp"
"-f" "../genero.4gs/caller.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "FOURGEN=1"

CALLED:
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0002.tmp"
"-f" "../genero.4gs/caller.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "ac0001.tmp"
------

CALLING "c:\\Progra~1\\WacGen\\tools-trunk\\bin.t\\wacro"
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0003.tmp"
"-f" "../genero.4gs/chk_cncl.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "FOURGEN=1"

CALLED:
"-c"
"-I" "c:\\Progra~1\\WacGen\\tools-trunk/lib"
"-I" "c:\\Progra~1\\WacGen\\lib-trunk/include"
"-o" "wac0003.tmp"
"-f" "../genero.4gs/chk_cncl.src"
"FORMCOLORS=fourgen" "ROWID_TYPE=integer" "002.tmp"

In the first one, you'll see that the last arg is missing on the called 
side.

The 2nd call is clearly showing junk being passed across, as well as the 
same last argument missing. It looks very much like the sort of strings I'd 
expect to find at the end of my string region, since they're the strings 
I'm working with.

The 3rd one also has a junk arg ("ac0001.tmp") which happens to pass the 
command line rules for the called program, so it just does it's thing.

The 4th and final call fails the whole process because the junk "002.tmp" on 
the command line causes the called program to complain and everything 
terminates. If it was all working properly, I'd expect another 20 odd calls 
to the nested program as it processes all the files in the directory.

In the file fposix.ri at about line 1145, I see a very telling comment:

/*
 * we are subverting the RTT type subsystem here w.r.t. garbage
 * collection but we're going to be doing an exec() so ...
 */

Without having gone much further into the code than that, I'm going to guess 
that, since it won't be doing exec() on Windows, this subversion is guilty 
in some way?

Now that I'm in this far, I'd have to study the rest of the code before I 
can comment further, but maybe I've already given enough information for 
someone to slap their forehead and fix it?

For the record, I've just tested a tiny little test program on UNIX and it 
doesn't appear to be losing my last argument, but when copied across to 
Windows, the last argument "c" disappears. This dumb program is not showing 
junk, but I barely tried to do anything clever enough to cause more string 
allocations - my little scan context is useless due to lack of foresight.

caller.icn:

procedure main()
    cmd := ["callee", "a", "b", "c"]
    system(cmd)

    "this is a string" ? {
        while move(1) do move(1)
    }

    system(cmd)
end


callee.icn:

procedure main(argv)
    writes("CALLEE")
    every writes(" ", image(!argv))
    write()
end



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to