Skip to content

Bash 'task.setvariable' adds unexpected ' as trailing symbol #10331

@nuclear0wl

Description

@nuclear0wl

Type: Bug

Task Name: Bash

Environment

  • Server - Azure Pipelines

  • Agent - Private:

    • OS: Red Hat Enterprise Linux Server release 7.4 (Maipo)
    • Agent version: 2.141.1

Issue Description

When echo "##vso[task.setvariable variable=variable]$value" is used as a part of script in Bash task type some unexpected trailing ' may appear in the value of variable. Appearance of trailing ' is a fully random process, but I usually get them in the part of my variables.

To produce and show appearance of trailing ' in value of variables I set two variables: build.producedArtifactName and build.producedArtifactPath, as could be seen below, I work with this variables in the same style: use some bash commands to set values and expose them using ###vso set.variable, in next Tasks I echo this variables and use them as an input for Task, as could be seen on screenshots, trailing ' appeared in value of variable build.producedArtifactName and didn't for build.producedArtifactPath that makes me think that problem came from the side of Bash V3 module.

Here simple bash script sets two variables and uses ###vso for variables setting:
Simple bash script

As it could be seen in log, set variables don't have any ' symbols:
Result of simple bash script

Next, it's used simple bash script to echo variables which were set via ###vso:
Simple bash script for new vars

As a result output for first variable absolutely normal, but in second variable trailing ' appeared:
Appearance of trailing symbol

If variable set via ###vso is used in other types of tasks like Publish Build Artifacts same behaviour is faced:
Test variable with other task types

As a result drop artifact also has trailing ' in it's name:
Result for other task type

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions