[ (aka test) not working properly in ubuntu:latest amd64 docker image

Bug #1980404 reported by Vlas Baard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-images
Invalid
Undecided
Tomáš Virtus

Bug Description

My problem is two-fold.

1.
On an amd64 machine:

$ docker run -ti ubuntu:latest bash
# ls -l /usr/bin/ls
-rwxr-xr-x 1 root root 138208 Feb 7 16:03 /usr/bin/ls
# if [ -r /usr/bin/ls ]; then echo Jay; else echo Nay; fi
Nay

In other words, ls shows that the ls binary is readable, but "[ -r" does not agree. Note:

# which [
#

The same happens with ubuntu:impish and ubuntu:devel, but ubuntu:focal works as expected.

I tried a fresh install with Virtualbox, there things are as expected.

2.
On an Macbook Pro M1, with ubuntu:latest, "[ -r" works as expected. And:

# which [
/usr/bin/[
#

So, the amd64 image is not functionally identical to the arm64 one.

The digest is sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac, which I believe is the latest.

Revision history for this message
Chris Newcomer (cnewcomer) wrote :

I am not able to reproduce this behavior. Are you using the docker.io packages from the Ubuntu repository?

# docker run -it ubuntu:latest bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
405f018f9d1d: Pull complete
Digest: sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac
Status: Downloaded newer image for ubuntu:latest
root@b10efb7999c2:/# ls -l /usr/bin/ls
-rwxr-xr-x 1 root root 138208 Feb 7 16:03 /usr/bin/ls
root@b10efb7999c2:/# [[ -r /usr/bin/ls ]] && echo yes || echo no
yes
root@b10efb7999c2:/# if [[ -r /usr/bin/ls ]]; then echo yes; else echo no;fi
yes
root@b10efb7999c2:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
root@b10efb7999c2:/# which [
/usr/bin/[

Revision history for this message
Vlas Baard (vlasbaard) wrote :

Thanks for trying!

I am using docker.io packages - but the test was on 19.03.12. I've now tried on 20.10.17 and the issue has disappeared.

Note I was trying with single [, not [[ (which I think is always bash internal?).

Either way, 19.03.12 is ancient, so I understand there is no reason to look into this. Feel free to close the case.

Revision history for this message
Tomáš Virtus (virtustom) wrote :

Hello,

I also cannot reproduce the issue (on Ubuntu Jammy):

$ docker --version
Docker version 20.10.17, build 100c701
$ sudo docker run -it ubuntu:latest bash
# ls -l /usr/bin/ls
-rwxr-xr-x 1 root root 138208 Feb 7 16:03 /usr/bin/ls
# if [ -r /usr/bin/ls ]; then echo Jay; else echo Nay; fi
Jay
# which [
/usr/bin/[
# grep VERSION= /etc/os-release
VERSION="22.04 LTS (Jammy Jellyfish)"

Revision history for this message
Tomáš Virtus (virtustom) wrote :

> Either way, 19.03.12 is ancient, so I understand there is no reason to look into this. Feel free to close the case.

Closing then. Please reopen if you hit the problem with newer Docker daemon.

Changed in cloud-images:
assignee: nobody → Tomáš Virtus (virtustom)
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.