Skip to content

[bug] unbound variable caused by conanbuildenv-debug-x86_64.sh #19285

@Ignition

Description

@Ignition

Describe the bug

I'm using antlr4 as a tool_requires

self.tool_requires("antlr4/4.13.1")

It's package_info sets CLASSPATH

def package_info(self):
    ...
    self.runenv_info.prepend_path("CLASSPATH", jar)

https://github.com/conan-io/conan-center-index/blob/0ae09f76f8efec51f00c6d8b0f019d64403d0f4f/recipes/antlr4/all/conanfile.py#L75

conan makes conanbuildenv-debug-x86_64.sh where it unconditionally joins paths

export CLASSPATH="/home/gareth/.conan2/p/antlr15795d040a28f/p/res/antlr-complete.jar:$CLASSPATH"

Which leads to error when sourced in hardened script environments

.../build/generators/conanbuildenv-debug-x86_64.sh: line 15: CLASSPATH: unbound variable

Example hardened script environment

$ bash -c 'set -eu; echo $UNKNOWN_VAR'
bash: line 1: UNKNOWN_VAR: unbound variable
$ echo $?
1

${CLASSPATH:+:$CLASSPATH} should work

How to reproduce it

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions