From: Andrew Kingston <andrew@peerless.co.uk>
Subject: Perl submit script issues
   Date: Fri, 15 Jul 2005 03:48:53 -0700
Msg# 989
View Complete Thread (8 articles) | All Threads
Last Next
Hi

We're using quite a heavily customised submit script (that uses the gui)to submit xsi renders from linux workstations to a linux renderfarm. I'm currently updating it so that we can submit from win2k workstations to a linux renderfarm. The scripts are just about working, the problem I have is when running the scripts on a win2k workstation, sometimes it will open up the gui no problem, sometimes I'll get a DOS window open then close & then nothing happens, and sometimes I'll get an error - 16 bit MS-DOS Subsystem. C:\Perl\bin\perl.exe. The NTVDM CPU has encountered an illegal instruction. CS:0fcb IP:210f OP:63 69 66 69 65 Choose 'Close' to terminate the application. I can choose either 'Close' or 'Ignore' - 'Ignore' will just bring up a few similar messages, then the application will close.

If I run other example scripts, or other ones I've customised I don't get any problems, so it must be something to do with this one script. I've tried commenting out certain lines which I though might cause problems, but with no success. I've trawled the internet, but can't find anything that helps. Does anyone have any ideas?

This isn't a show stopper by any means, but it'd be nice to get this script working as well as the others.

Cheers
Andrew

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: Perl submit script issues
   Date: Fri, 15 Jul 2005 09:39:31 -0700
Msg# 990
View Complete Thread (8 articles) | All Threads
Last Next
Andrew Kingston wrote:
sometimes I'll get an error - 16 bit MS-DOS Subsystem.

	Sounds like the "ComSpec" environment variable is somehow
	being changed from the CMD.EXE default to scuzzy old 16 bit COMMAND.COM
	(or similar 16 bit shell), which if changed by the script, will cause
	the script to then be unable to invoke any 32bit apps correctly
	(eg. using system(), backticks, open(), etc)

If I run other example scripts, or other ones I've customised I don't get any problems, so it must be something to do with this one script.

	Make sure it's not a user specific environment problem first;
	open a DOS window via "Start | Run | cmd.exe", and check
	the value of ComSpec:

C:\>set | findstr ComSpec
ComSpec=C:\WINNT\system32\cmd.exe
        ^^^^^^^^^^^^^^^^^^^^^^^^^
C:\>

	If that's set to something other than CMD.EXE, that's bad
	and needs to be fixed.

	If you find that setting to be correct, but invoking the script
	from this DOS shell still fails, eg:

C:\>perl //path/to/your/submit-script.pl

	..then I'd say the script is probably somehow changing ComSpec
	(or #include'ing, require'ing or eval'ing a file that does this)
	then fails when the script tries to later invoke system(), open(),
	or `backticks`.

	If you're still having trouble, send me a copy of the script
	in private email, and I can possibly tell you what the cause is,
	if indeed it is a problem just with this script, and not the others.

	My guess is that some sequence of events in the script leads to
	that variable getting changed, causing errors when it tries to run
	other perl scripts.

I've trawled the internet, but can't find anything that helps.

	groups.google.com might be a better resource in this case
	for the NTVDM error, not sure.

--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)

   From: Andrew Kingston <andrew@peerless.co.uk>
Subject: Re: Perl submit script issues
   Date: Tue, 19 Jul 2005 10:26:26 -0700
Msg# 992
View Complete Thread (8 articles) | All Threads
Last Next
Greg Ercolano wrote:
Andrew Kingston wrote:

sometimes I'll get an error - 16 bit MS-DOS Subsystem.


    Sounds like the "ComSpec" environment variable is somehow
    being changed from the CMD.EXE default to scuzzy old 16 bit COMMAND.COM
    (or similar 16 bit shell), which if changed by the script, will cause
    the script to then be unable to invoke any 32bit apps correctly
    (eg. using system(), backticks, open(), etc)

If I run other example scripts, or other ones I've customised I don't get any problems, so it must be something to do with this one script.


    Make sure it's not a user specific environment problem first;
    open a DOS window via "Start | Run | cmd.exe", and check
    the value of ComSpec:

C:\>set | findstr ComSpec
ComSpec=C:\WINNT\system32\cmd.exe
        ^^^^^^^^^^^^^^^^^^^^^^^^^
C:\>

    If that's set to something other than CMD.EXE, that's bad
    and needs to be fixed.

    If you find that setting to be correct, but invoking the script
    from this DOS shell still fails, eg:

C:\>perl //path/to/your/submit-script.pl

    ..then I'd say the script is probably somehow changing ComSpec
    (or #include'ing, require'ing or eval'ing a file that does this)
    then fails when the script tries to later invoke system(), open(),
    or `backticks`.

    If you're still having trouble, send me a copy of the script
    in private email, and I can possibly tell you what the cause is,
    if indeed it is a problem just with this script, and not the others.

    My guess is that some sequence of events in the script leads to
    that variable getting changed, causing errors when it tries to run
    other perl scripts.

I've trawled the internet, but can't find anything that helps.


    groups.google.com might be a better resource in this case
    for the NTVDM error, not sure.

I found what was causing the problem. There was a piece of code which a colleague had added (I thought it was from the original example script), which used unix commands (mv, awk, etc which were in the system path because cygwin is installed on all our windows machines). These were then executed using system() in the section around where the script creates defaults, or loads previous settings in to the gui - that's why it worked OK sometimes & not others. If you run the Cygwin awk from a DOS command prompt, you should see something akin to the error I was getting.

Cheers
Andrew

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: Perl submit script issues
   Date: Tue, 19 Jul 2005 10:55:14 -0700
Msg# 993
View Complete Thread (8 articles) | All Threads
Last Next
Andrew Kingston wrote:
I found what was causing the problem. There was a piece of code which a colleague had added (I thought it was from the original example script), which used unix commands (mv, awk, etc which were in the system path because cygwin is installed on all our windows machines). These were then executed using system() in the section around where the script creates defaults, or loads previous settings in to the gui - that's why it worked OK sometimes & not others. If you run the Cygwin awk from a DOS command prompt, you should see something akin to the error I was getting.

	Really?

	Sounds like it might be a 16 bit version of Cygwin, or a 16 bit
	version of perl.

	Perl's system() and DOS (cmd.exe) should be able to invoke 32 bit versions
	of Cygwin (such as mv, awk, etc) just fine..

	I think the problem is deeper; either a 16 bit version of Perl, DOS,
	or Cygwin is involved here..


--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)

   From: Andrew Kingston <andrew@peerless.co.uk>
Subject: Re: Perl submit script issues
   Date: Wed, 20 Jul 2005 06:21:50 -0700
Msg# 996
View Complete Thread (8 articles) | All Threads
Last Next
Greg Ercolano wrote:
Andrew Kingston wrote:

I found what was causing the problem. There was a piece of code which a colleague had added (I thought it was from the original example script), which used unix commands (mv, awk, etc which were in the system path because cygwin is installed on all our windows machines). These were then executed using system() in the section around where the script creates defaults, or loads previous settings in to the gui - that's why it worked OK sometimes & not others. If you run the Cygwin awk from a DOS command prompt, you should see something akin to the error I was getting.


    Really?

    Sounds like it might be a 16 bit version of Cygwin, or a 16 bit
    version of perl.

Perl's system() and DOS (cmd.exe) should be able to invoke 32 bit versions
    of Cygwin (such as mv, awk, etc) just fine..

    I think the problem is deeper; either a 16 bit version of Perl, DOS,
    or Cygwin is involved here..


Sorry - I should have said. I've taken the code which is causing the problem out of the script, as it's not needed any more, so my script is working fine now.

It is strange though. I've found so far it's just the awk command that causes the problem...

I've just been doing a bit more digging & I think I've found what was causing the problem. In \cygwin\bin if you do an ls -l awk.exe, it gives you: lrwxrwxrwx 1 Adminst Users 19 Nov 1 2004 awk.exe -> gawk.exe. If I run gawk.exe at a DOS prompt I don't get any errors, but run awk.exe, and I get the error I've been mentioning. I get the same error whenever I try to run one of the linked Cygwin apps at a DOS prompt - like gunzip.exe & zcat.exe. So it looks like I could put the code back into my script if I needed to as long as I used gawk instead of awk.

Cheers
Andrew

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: Perl submit script issues
   Date: Wed, 20 Jul 2005 12:46:46 -0700
Msg# 997
View Complete Thread (8 articles) | All Threads
Last Next
Andrew Kingston wrote:

I've just been doing a bit more digging & I think I've found what was causing the problem. In \cygwin\bin if you do an ls -l awk.exe, it gives you: lrwxrwxrwx 1 Adminst Users 19 Nov 1 2004 awk.exe -> gawk.exe.

	Huh, I didn't know cygwin somehow implemented symbolic links
	under Windows.

	Maybe underneath it's a 'junction'.. Windows terminology
	for a symlink, which Win32 does support, but junctions can
	only be pointed to files on the same disk currently, not to
	network drives :/

	More info about NTFS junctions here:
	http://support.microsoft.com/default.aspx?scid=kb;EN-US;q205524

If I run gawk.exe at a DOS prompt I don't get any errors, but run awk.exe, and I get the error I've been mentioning.

	Weird.
	It's as if the cygwin symbolic link is the cause.

I get the same error whenever I try to run one of the linked Cygwin apps at a DOS prompt - like gunzip.exe & zcat.exe.

	If you're curious, it might be interesting to make it a copy
	instead of a link, eg:

		cp gawk.exe /temp/awk.exe
		echo 4 | /temp/awk '{ printf("%04d\n"; }'

	..the implication being if that works, it's the symlink for sure.

	Might be a bug in the specific version of cygwin you're using.
	I tried cygwin once, and it was too weird for me. It has too
	many hoops it hops through with those weird pathnames it uses,
	and some of its shells are kinda buggy. So I left it alone,
	and decided to just do everything in perl, and just live with
	DOS as an interactive shell. DOS has been getting better;
	things like tab completion and better commands make it less
	annoying than it used to be.

So it looks like I could put the code back into my script if I needed to as long as I used gawk instead of awk.

	Yes -- I'd agree.

	It's good you got to the bottom of that; we can all know
	to watch for this.

	FWIW, within your perl script, you should be able to do
	all awk-like stuff within perl, eg. these being equivalent:

		echo 4 | awk '{ printf("%04d\n",$0); }'
		echo 4 | perl -ne '{ printf("%04d\n",$_); }'

	..or better yet, just use perl to do the work.
	I can't think of any situation where one would
	need a perl script to invoke awk externally.. it's
	usually always more efficient to code it all within perl.

	eg. I'd always prefer these perl commands:

		my $padframe = sprintf("%04d", $frame);

	..to these:

		my $padframe = `echo $frame | awk '{ printf("%04d\n",$0); }'`;
		chomp($padframe);


--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)

   From: Andrew Kingston <andrew@peerless.co.uk>
Subject: Re: Perl submit script issues
   Date: Fri, 29 Jul 2005 09:56:47 -0700
Msg# 998
View Complete Thread (8 articles) | All Threads
Last Next
Greg Ercolano wrote:
Andrew Kingston wrote:

I've just been doing a bit more digging & I think I've found what was causing the problem. In \cygwin\bin if you do an ls -l awk.exe, it gives you: lrwxrwxrwx 1 Adminst Users 19 Nov 1 2004 awk.exe -> gawk.exe.


    Huh, I didn't know cygwin somehow implemented symbolic links
    under Windows.

    Maybe underneath it's a 'junction'.. Windows terminology
    for a symlink, which Win32 does support, but junctions can
    only be pointed to files on the same disk currently, not to
    network drives :/

    More info about NTFS junctions here:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q205524

If I run gawk.exe at a DOS prompt I don't get any errors, but run awk.exe, and I get the error I've been mentioning.


    Weird.
    It's as if the cygwin symbolic link is the cause.

Yep. I'm not how Cygwin implements it, but it emulates mounts and links. Apparently any program using linked files will not run properly if started outside of Cygwin. I can't even list the links from a DOS prompt using dir - but they do list if I use the /as switch on dir...


I get the same error whenever I try to run one of the linked Cygwin apps at a DOS prompt - like gunzip.exe & zcat.exe.


    If you're curious, it might be interesting to make it a copy
    instead of a link, eg:

        cp gawk.exe /temp/awk.exe
        echo 4 | /temp/awk '{ printf("%04d\n"; }'

    ..the implication being if that works, it's the symlink for sure.

    Might be a bug in the specific version of cygwin you're using.
    I tried cygwin once, and it was too weird for me. It has too
    many hoops it hops through with those weird pathnames it uses,
    and some of its shells are kinda buggy. So I left it alone,
    and decided to just do everything in perl, and just live with
    DOS as an interactive shell. DOS has been getting better;
    things like tab completion and better commands make it less
    annoying than it used to be.


I don't think it's a bug as it is possible to use awk if started from Cygwin, just not if started from DOS - though if I start the submit script I was getting the original errors with, from a Cygwin shell, I still get the same error... I don't use Cygwin a lot myself either for the same kind of reasons. I do use cwRsync though (a kind of standalone package of Cygwin Rsync) - very useful for backing up data from windows workstations. I tried what you suggested above (copying gawk) & it worked as expected, so it does seem to be a symlink issue.

So it looks like I could put the code back into my script if I needed to as long as I used gawk instead of awk.


    Yes -- I'd agree.

    It's good you got to the bottom of that; we can all know
    to watch for this.

    FWIW, within your perl script, you should be able to do
    all awk-like stuff within perl, eg. these being equivalent:

        echo 4 | awk '{ printf("%04d\n",$0); }'
        echo 4 | perl -ne '{ printf("%04d\n",$_); }'

    ..or better yet, just use perl to do the work.
    I can't think of any situation where one would
    need a perl script to invoke awk externally.. it's
    usually always more efficient to code it all within perl.

Agreed - I'm also much more comfortable using perl, so if I needed to replace my colleagues code I'd do that... as long as I could work out what he was trying to do with awk :)


    eg. I'd always prefer these perl commands:

        my $padframe = sprintf("%04d", $frame);

    ..to these:

        my $padframe = `echo $frame | awk '{ printf("%04d\n",$0); }'`;
        chomp($padframe);



   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: Perl submit script issues
   Date: Fri, 29 Jul 2005 22:36:14 -0700
Msg# 999
View Complete Thread (8 articles) | All Threads
Last Next
Agreed - I'm also much more comfortable using perl, so if I needed to replace my colleagues code I'd do that... as long as I could work out what he was trying to do with awk :)

	I'm pretty good at awk -- if you post the code here,
	I can probably translate it for you. Hope it ain't too large..


--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)