ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Geis <matthew.g...@instill.com>
Subject bug in vss task (with fix)
Date Tue, 21 Nov 2000 17:02:31 GMT

Hi,
This is my first post to this group, so this topic may have already been
raised.  However, from the age of the files in CVS, I'm guessing it actually
hasn't been brought up.

I encountered a bug when using the VSS task to check out a project by label.
As the VSS task uses the ss.exe command line executable, any arguments which
contain spaces must be properly quoted.

In ANT 1.1, the following would work....

<vss ....... label="Production Release 1" ..... />

However, in ANT 1.2, this breaks.  What happens is that the command line
argument should look like this:

-VL "Production Release 1"

However, due to changes in Commandline.java, it now sees the quotes, and
does the following:

"-VLProduction Release 1"

which, of course, breaks.

The problem is in how the command line arguments are generated.

The following method contains the bug:

public void getVersionCommand(Commandline cmd) {

        if ( m_Version != null) {
            cmd.createArgument().setValue(FLAG_VERSION + m_Version);
        } else if ( m_Date != null) {
            cmd.createArgument().setValue(FLAG_VERSION_DATE + m_Date);
        } else if (m_Label != null) {
            cmd.createArgument().setValue(FLAG_VERSION_LABEL + m_Label);
        }
}

The problem here is that FLAG_VERSION_LABEL (-VL, in this case) and the
label itself ("Production Release 1") are being passed in as a *single*
argument.  I've found that the following fixes the bug:

public void getVersionCommand(Commandline cmd) {

        if ( m_Version != null) {
            cmd.createArgument().setValue(FLAG_VERSION + m_Version);
        } else if ( m_Date != null) {
            cmd.createArgument().setValue(FLAG_VERSION_DATE + m_Date);
        } else if (m_Label != null) {
            cmd.createArgument().setValue(FLAG_VERSION_LABEL);
            cmd.createArgument().setValue(m_Label);
        }
}

I haven't tested it out, but I'd go so far as to suggest that the other
versioning options be adjusted accordingly.

I've attached a file that has this fix, and a few others (two others for
this method, and another related to working directory, as directories can
easily contain spaces).

If a committer could review these changes and check it in, or pass it on to
the original author for review, that'd be great.

Actually, since this is the first time I'm contributing any code, could
someone just let me know if this is in fact the right (or wrong) way to go
about fixing bugs, and if not, what the standard procedure is?

Thanks,
Matt



Mime
View raw message