You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Alex Chaffee <gu...@edamame.stinky.com> on 2000/07/14 10:58:22 UTC

BUG: Exec.java uses NT-specific code, breaks on Win98

We've encountered an Ant bug over in JDOM land.  I'm stumped on how to
fix it.

Briefly, Exec.java assumes that "windows" means "Windows NT" and
invokes System.exec with a command line that breaks on Windows 95/98.

----- Forwarded message from Jason Hunter <jh...@collab.net> -----

The issue is that the Ant Exec.java task uses the "cmd" syntax as a way
of handling change of directory duties:

        if (myos.toLowerCase().indexOf("windows") >= 0) {
            if (!dir.equals(project.resolveFile(".")))
                command = "cmd /c cd " + dir + " && " + command;

This codepath has probably never before been exercised on Win98 because
it seems to occur only when a "cd" is necessary.  The original developer
probably used NT to test, and I did likewise for the jdom-contrib area.

------------------------------

At the very least, it should use the %COMSPEC% environment variable to
identify command.com or cmd.exe as appropriate.  But even that won't
fix it, since "&&" syntax is not supported in command.com.

Good luck! Please let me know if you make any progress fixing this.

 - Alex

Alex Chaffee                       mailto:alex@jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

Re: rmic problem .... nevermind

Posted by Ken Wood <kw...@i2.com>.
I tried it using the last released 'Ant', and no rmic error.

I grabbed the lastest 'Ant', and no rmic error.

So, I must have grabbed a copy of 'Ant' the day
it had an error in the rmic stuff....




Re: BUG: Exec.java uses NT-specific code, breaks on Win98

Posted by gt bradley <gt...@linkline.com>.
If you are looking at this code, I'll like to point out another nit.  (or
bug dealing with M$'s  view of the world).

in *nix the cd command changes the current working directory.
In NT (Win9x?) the cd command changes the current working directory for a
drive specified (or the current drive if not specified).

so if I'm at c:\bin and I cd to to \temp,  the current working directory is
\temp (as expected).
however, if I'm at c:\bin and I cd to d:\temp, then the current working
directory is still c:\bin, (and D's working directory is set to d:\temp).

So to change from c:\bin to d:\temp one must either
d:                 [to change to the d: drive]
cd \temp         [or cd d:\temp]

or
pushd d:\temp    [this will "pick-up" the drive change]

pushd will use the drive specifier, (so I use it a lot in my batch(.cmd)
files)

This was causing me grief with one of the earlier releases of Ant,  I hacked
up a work-around for it, so I'm not sure if it is still a problem....

we use several network drives mounted on NT for development, and test/deploy
on Solaris, so I'm now switching our project to Ant for a common
cross-platform build process.

I hope this is helpful
GT




Alex Chaffee wrote:

> We've encountered an Ant bug over in JDOM land.  I'm stumped on how to
> fix it.
>
> Briefly, Exec.java assumes that "windows" means "Windows NT" and
> invokes System.exec with a command line that breaks on Windows 95/98.
>
> ----- Forwarded message from Jason Hunter <jh...@collab.net> -----
>
> The issue is that the Ant Exec.java task uses the "cmd" syntax as a way
> of handling change of directory duties:
>
>         if (myos.toLowerCase().indexOf("windows") >= 0) {
>             if (!dir.equals(project.resolveFile(".")))
>                 command = "cmd /c cd " + dir + " && " + command;
>
> This codepath has probably never before been exercised on Win98 because
> it seems to occur only when a "cd" is necessary.  The original developer
> probably used NT to test, and I did likewise for the jdom-contrib area.
>
> ------------------------------
>
> At the very least, it should use the %COMSPEC% environment variable to
> identify command.com or cmd.exe as appropriate.  But even that won't
> fix it, since "&&" syntax is not supported in command.com.
>
> Good luck! Please let me know if you make any progress fixing this.
>
>  - Alex
>
> Alex Chaffee                       mailto:alex@jguru.com
> jGuru - Java News and FAQs         http://www.jguru.com/alex/
> Creator of Gamelan                 http://www.gamelan.com/
> Founder of Purple Technology       http://www.purpletech.com/
> Curator of Stinky Art Collective   http://www.stinky.com/


RE: Exec.java uses NT-specific code, breaks on Win98

Posted by Conor MacNeill <co...@m64.com>.
Alex,

I have committed a patch which should restore operation of exec under Win98.
There is an important limitation in this approach - only 9 arguments can be
passed to the command being exec'd. Any additional arguments will be
silently discarded.

I have tested for the presence of the characters "nt" in the OS string for
this patch but I think that may treat Windows 2000 like a Win98 system. Does
anyone know what Windows 2000 reports the OS name as?

Conor


> -----Original Message-----
> From: Conor MacNeill [mailto:conor@m64.com]
> Sent: Saturday, 15 July 2000 9:51
> To: ant-dev@jakarta.apache.org; alex@jguru.com
> Subject: RE: Exec.java uses NT-specific code, breaks on Win98
>
>
> Alex,
>
> If you saw my todo list lately, one of the items was better win98 support
> and I was thinking, in particular, about the Exec task. It is a
> problem that
> has been known for a while. I will try to do something this weekend, but I
> do have a few other things on.
>
> One of the changes I made to the ant.bat driver script recently was to
> remove the NT specific setlocal commands.
>
> If you or anyone else has any other issues with ant on win95/98
> then please
> let me know.
>
> Conor
>
>
> > -----Original Message-----
> > From: Alex Chaffee [mailto:guru@edamame.stinky.com]
> > Sent: Friday, 14 July 2000 18:58
> > To: ant-dev@jakarta.apache.org
> > Subject: BUG: Exec.java uses NT-specific code, breaks on Win98
> >
> >
> > We've encountered an Ant bug over in JDOM land.  I'm stumped on how to
> > fix it.
> >
> > Briefly, Exec.java assumes that "windows" means "Windows NT" and
> > invokes System.exec with a command line that breaks on Windows 95/98.
> >
> > ----- Forwarded message from Jason Hunter <jh...@collab.net> -----
> >
> > The issue is that the Ant Exec.java task uses the "cmd" syntax as a way
> > of handling change of directory duties:
> >
> >         if (myos.toLowerCase().indexOf("windows") >= 0) {
> >             if (!dir.equals(project.resolveFile(".")))
> >                 command = "cmd /c cd " + dir + " && " + command;
> >
> > This codepath has probably never before been exercised on Win98 because
> > it seems to occur only when a "cd" is necessary.  The original developer
> > probably used NT to test, and I did likewise for the jdom-contrib area.
> >
> > ------------------------------
> >
> > At the very least, it should use the %COMSPEC% environment variable to
> > identify command.com or cmd.exe as appropriate.  But even that won't
> > fix it, since "&&" syntax is not supported in command.com.
> >
> > Good luck! Please let me know if you make any progress fixing this.
> >
> >  - Alex
> >
> > Alex Chaffee                       mailto:alex@jguru.com
> > jGuru - Java News and FAQs         http://www.jguru.com/alex/
> > Creator of Gamelan                 http://www.gamelan.com/
> > Founder of Purple Technology       http://www.purpletech.com/
> > Curator of Stinky Art Collective   http://www.stinky.com/
> >
>
>


RE: Exec.java uses NT-specific code, breaks on Win98

Posted by Conor MacNeill <co...@m64.com>.
Alex,

If you saw my todo list lately, one of the items was better win98 support
and I was thinking, in particular, about the Exec task. It is a problem that
has been known for a while. I will try to do something this weekend, but I
do have a few other things on.

One of the changes I made to the ant.bat driver script recently was to
remove the NT specific setlocal commands.

If you or anyone else has any other issues with ant on win95/98 then please
let me know.

Conor


> -----Original Message-----
> From: Alex Chaffee [mailto:guru@edamame.stinky.com]
> Sent: Friday, 14 July 2000 18:58
> To: ant-dev@jakarta.apache.org
> Subject: BUG: Exec.java uses NT-specific code, breaks on Win98
>
>
> We've encountered an Ant bug over in JDOM land.  I'm stumped on how to
> fix it.
>
> Briefly, Exec.java assumes that "windows" means "Windows NT" and
> invokes System.exec with a command line that breaks on Windows 95/98.
>
> ----- Forwarded message from Jason Hunter <jh...@collab.net> -----
>
> The issue is that the Ant Exec.java task uses the "cmd" syntax as a way
> of handling change of directory duties:
>
>         if (myos.toLowerCase().indexOf("windows") >= 0) {
>             if (!dir.equals(project.resolveFile(".")))
>                 command = "cmd /c cd " + dir + " && " + command;
>
> This codepath has probably never before been exercised on Win98 because
> it seems to occur only when a "cd" is necessary.  The original developer
> probably used NT to test, and I did likewise for the jdom-contrib area.
>
> ------------------------------
>
> At the very least, it should use the %COMSPEC% environment variable to
> identify command.com or cmd.exe as appropriate.  But even that won't
> fix it, since "&&" syntax is not supported in command.com.
>
> Good luck! Please let me know if you make any progress fixing this.
>
>  - Alex
>
> Alex Chaffee                       mailto:alex@jguru.com
> jGuru - Java News and FAQs         http://www.jguru.com/alex/
> Creator of Gamelan                 http://www.gamelan.com/
> Founder of Purple Technology       http://www.purpletech.com/
> Curator of Stinky Art Collective   http://www.stinky.com/
>