For Prolog people who want the low-level details, here is part of the mail I just sent to the SICStus team:
Unless I am misunderstanding something important, SP4.0.3's version of the
system3 library is still not downward-compatible with SP3's system library, and is in fact rather
less downward-compatible than SP4.0.2's system3. The problem is now in system/1.
In SP4.0.2, system/1 is defined as follows:
system(Cmd) :-
system_binary(Binary, DashC),
proc_call(Binary, DashC, Cmd, exit(0)).
so it's possible to make calls like the following, running under Cygwin:
| ?- system('dir > tmp_dir.txt').
1 1 Call: system('dir > tmp_dir.txt') ?
2 2 Call: system3:environ('COMSPEC',_790) ?
2 2 Exit: system3:environ('COMSPEC','C:\\WINDOWS\\system32\\cmd.exe') ?
3 2 Call: system3:process_create('C:\\WINDOWS\\system32\\cmd.exe',['/C','dir > tmp_dir.txt'],system3:[process(_1437)]) ?
3 2 Exit: system3:process_create('C:\\WINDOWS\\system32\\cmd.exe',['/C','dir > tmp_dir.txt'],system3:[process('$process'('$ptr IEDNJP'))]) ?
4 2 Call: system3:process_wait('$process'('$ptr IEDNJP'),exit(0)) ? s
4 2 Exit: system3:process_wait('$process'('$ptr IEDNJP'),exit(0)) ?
1 1 Exit: system('dir > tmp_dir.txt') ?
Under SP4.0.3, system/1 is defined thus:
system(Cmd, Status) :-
shell_exec(Cmd, [], exit(Status)).
and the corresponding call looks like this:
| ?- system('dir > tmp_dir.txt').
1 1 Call: system('dir > tmp_dir.txt') ?
2 2 Call: system3:system('dir > tmp_dir.txt',0) ?
3 3 Call: system3:process_create('dir > tmp_dir.txt',[],system3:[commandline(true),process(_1119)]) ?
3 3 Exit: system3:process_create('dir > tmp_dir.txt',[],system3:[commandline(true),process('$process'('$ptr ALJLOO'))]) ?
4 3 Call: system3:process_wait('$process'('$ptr ALJLOO'),exit(0)) ?
4 3 Fail: system3:process_wait('$process'('$ptr ALJLOO'),exit(0)) ?
2 2 Fail: system3:system('dir > tmp_dir.txt',0) ?
1 1 Fail: system('dir > tmp_dir.txt') ?
The problem, as far as I can see, is that process_create requires the first arg
of process_create to be a program, which it isn't here.
Unfortunately, we have people running Regulus under at least 3.12.5, 4.0.2 and 4.0.3.
Maintaining the code so that it runs under all these different versions is
becoming quite difficult - the operating system interface primitives are
absolutely essential. Advice appreciated.
No comments:
Post a Comment