Skip to content

UndefinedVar triggered in heredoc code #3718

@WanWizard

Description

@WanWizard

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Consider this Dockerfile snippet:

COPY <<EOF /etc/environment
export LC_ALL=en_US.utf8
export LANG=$LC_ALL
export LC_CTYPE=$LC_ALL
export LC_NUMERIC=$LC_ALL
export LC_TIME=$LC_ALL
export LC_COLLATE=$LC_ALL
export LC_MONETARY=$LC_ALL
export LC_MESSAGES=$LC_ALL
export LC_PAPER=$LC_ALL
export LC_NAME=$LC_ALL
export LC_ADDRESS=$LC_ALL
export LC_TELEPHONE=$LC_ALL
export LC_MEASUREMENT=$LC_ALL
export LC_IDENTIFICATION=$LC_ALL
EOF

This now prints

 1 warning found (use docker --debug to expand):
 - UndefinedVar: Usage of undefined variable '$LC_ALL' (line 59)

even though this isn't code related to building the docker image.

I know it is cosmetic and probably low prio, but it still annoys me every time I see it... 😁

Expected behaviour

No warnings printed.

Actual behaviour

Outputs

 1 warning found (use docker --debug to expand):
 - UndefinedVar: Usage of undefined variable '$LC_ALL' (line 59)

when building the docker image.

Buildx version

github.com/docker/buildx v0.31.1 a267595

Docker info

Client: Docker Engine - Community
 Version:    29.2.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.31.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.1.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 4
 Server Version: 29.2.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.14.0-611.34.1.el9_7.x86_64
 Operating System: AlmaLinux 9.7 (Moss Jungle Cat)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 30.96GiB
 Name: batman.office.flexcoders.eu
 ID: 8b5933f9-3368-4c9c-a1eb-fefdc7153e93
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables+firewalld

Builders list

NAME/NODE     DRIVER/ENDPOINT   STATUS    BUILDKIT   PLATFORMS
default*      docker                                 
 \_ default    \_ default       running   v0.27.1    linux/amd64 (+3), linux/386

Configuration

See description.

Build logs


Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions