History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CIB-1001
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: jason
Reporter: jason
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Pulse

Incorrect validation for custom projects

Created: 11/Mar/07 10:30 AM   Updated: 29/Oct/07 01:03 AM
Component/s: None
Affects Version/s: 1.2.18
Fix Version/s: 1.2.20


 Description  « Hide
During validation, variables are not resolved. This breaks when a variable reference is used in an artifact name, where only certain characters are allowed. For example:

<?xml version="1.0"?>
<project>
    <property name="foo" value="bar"/>
    <recipe name="test">
        <command name="${foo}">
            <sleep interval="0"/>
            <artifact file="somefile.tgz" name="${foo}"/>
        </command>
    </recipe>
</project>

Processing element 'artifact': starting at line 95 column 7: Name must consist of an alphanumeric character followed by zero or more alphanumeric characters mixed with characters , ., - or _

 All   Comments   Change History      Sort Order:
jason - 21/Mar/07 02:09 PM
Fixed in change 3144.

Tim Davison - 02/Apr/07 01:49 PM
I just upgraded to 1.2.21 and this doesn't seem to be fixed for dir-artifacts. Did this original fix also address dir-artifacts or just artifacts? Or was there a possible regression?
Thanks
-Tim

Tim Davison - 02/Apr/07 01:58 PM
I should add that I'm trying to reference a propery defined in the Build Spec, not one defined in the pulse file - in case that makes a difference.

jason - 02/Apr/07 10:43 PM
Hi Tim,

This fix is still limited to variables that can be resolved at the time that you are saving the Pulse file. Because your variable is defined in the build spec, there is no easy way Pulse can resolve it (I suppose it could validate for all build specs, but that also might get confusing). Variables that are not yet defined are therefore left as references and the original problem occurs. I guess one way for us to fix this would be to make the validation logic more lenient at custom project save time, so artifacts do not validate their names (for example). Another way would be to default the variable values to something that works, but that is more of a hack.

Tim Davison - 03/Apr/07 02:04 PM
I can see how this is a problem. I guess it would be ideal for me if the name wasn't resolved until the execution of the pulse file, but that makes error reporting much more difficult.
I tried defining a property in my pulse file and then specifying the same property in the build spec ( I wanted to override the pulse file property ). That gave me a different error about the property already existing.
Is there another way to default those values in the pulse file so that validation passes, but then change the value in the build spec?

Maybe the validation can be semi-lenient, it replaces all known properties and for any properties references that don't exist, the reference is removed for the validation. That would do a basic validation, but would allow new properties to affect the final name of the artifact.

jason - 03/Apr/07 02:37 PM
Hi Tim,

Your workaround of specifying a default unfortunately cannot work. It is possible to have a value in the Pulse file, so long as it is not at the top-level scope, but this value would always override that provided in the build specification.

Removing references during validation also causes problems for required fields. For example, if the artifact name contains only the property reference, after removal the name will be empty and validation will fail as a name is required. It's a painful one :).