When running Ubuntu Noble in an arm32 Docker container, on certain hosts (Azure VM CI agents), tar fails to extract certain archives that include folders with specific permissions set.
Here's a concise repro. The error occurs in when building the Dockerfile. I can only get this to work on Azure VMs, but can't find out why.
# Extracting it gives an error
RUN mkdir -p /test2 \
&& tar -tzvf /test.tar.gz \
&& tar -oxzf /test.tar.gz -C /test2
```
What I expected to happen: The test.tar.gz archive should be successfully extracted to the /test2 directory.
What happened instead: Tar throws the following error:
```
tar: ./775: Cannot change mode to rwxrwxr-x: Operation not permitted
tar: Exiting with failure status due to previous errors
```
The Ubuntu container is running as root so there shouldn't be any permission errors.
Since this is running in a container, I observed this happening on the following kernel:
`Linux version 5.15.148.2-2.cm2 (root@CBL-Mariner) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Fri Feb 23 23:38:33 UTC 2024`.
I was not able to reproduce it using Ubuntu 22.04 Jammy (ubuntu.azurecr.io/ubuntu:jammy), using the same kernel as above.
Additionally I was not able to reproduce this on the kernel `Linux cb0507859b24 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux`, which is running on my work machine, using Docker qemu emulation for the arm32 image (I do not have access to an arm32 native machine).
When running Ubuntu Noble in an arm32 Docker container, on certain hosts (Azure VM CI agents), tar fails to extract certain archives that include folders with specific permissions set.
Here's a concise repro. The error occurs in when building the Dockerfile. I can only get this to work on Azure VMs, but can't find out why.
```Dockerfile azurecr. io/ubuntu: noble
FROM ubuntu.
# Create the problematic archive
RUN mkdir /test \
&& chmod 775 /test \
&& cd /test \
&& mkdir 775 \
&& chmod 775 775 \
&& touch 775/test.txt \
&& chmod 644 775/test.txt \
&& tar -czvf /test.tar.gz .
# Extracting it gives an error
RUN mkdir -p /test2 \
&& tar -tzvf /test.tar.gz \
&& tar -oxzf /test.tar.gz -C /test2
```
What I expected to happen: The test.tar.gz archive should be successfully extracted to the /test2 directory.
What happened instead: Tar throws the following error:
```
tar: ./775: Cannot change mode to rwxrwxr-x: Operation not permitted
tar: Exiting with failure status due to previous errors
```
The Ubuntu container is running as root so there shouldn't be any permission errors.
Since this is running in a container, I observed this happening on the following kernel:
`Linux version 5.15.148.2-2.cm2 (root@CBL-Mariner) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Fri Feb 23 23:38:33 UTC 2024`.
I was not able to reproduce it using Ubuntu 22.04 Jammy (ubuntu. azurecr. io/ubuntu: jammy), using the same kernel as above.
Additionally I was not able to reproduce this on the kernel `Linux cb0507859b24 5.15.146. 1-microsoft- standard- WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux`, which is running on my work machine, using Docker qemu emulation for the arm32 image (I do not have access to an arm32 native machine).
Ubuntu version: Ubuntu Noble Numbat (development branch) 24.04 (from ubuntu. azurecr. io/ubuntu: noble)
tar version: `1.35+dfsg-3`