oras icon indicating copy to clipboard operation
oras copied to clipboard

Single files lose their file modes

Open mxey opened this issue 4 years ago • 4 comments

When adding a directory to a FileStore, it creates a tarball, which means various file modes are stored and later restored on pull. But when adding a single file, the file modes are lost. This was quite confusing to me and IMO both should behave the same.

mxey avatar Jan 20 '20 14:01 mxey

Hi @mxey Can you provide a repro? Is this with the ORAS client, or using the ORAS libraries?

SteveLasker avatar Sep 13 '20 22:09 SteveLasker

oras version:

Version:        0.8.1
Go version:     go1.12.4
Git commit:     237ac925cb6a308a5523cc048292bb53037f6975
Git tree state: clean

OS: macOS 10.15.6 (19G2021)

Start local Docker registry:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

Prepare input files:

mkdir -p oras-repro
cd oras-repro
touch file.txt
mkdir directory
touch directory/fileindir.txt
chmod 400 file.txt directory/fileindir.txt

Check permissions with ls -l file.txt directory/fileindir.txt:

-r--------  1 Max  staff  0 14 Sep 13:09 directory/fileindir.txt
-r--------  1 Max  staff  0 14 Sep 13:09 file.txt

Push and pull:

oras push localhost:5000/repro:latest file.txt directory
oras pull localhost:5000/repro:latest --output=$PWD/out

Check permissions with cd out && ls -l file.txt directory/fileindir.txt:

-r--------  1 Max  staff  0 14 Sep 13:09 directory/fileindir.txt
-rw-r--r--  1 Max  staff  0 14 Sep 13:10 file.txt

As you can see, the file in the directory retained its permissions of 0400, but the other file did not.

mxey avatar Sep 14 '20 11:09 mxey

Noticed this as well. Is that expected @SteveLasker ?

Hades32 avatar Jun 08 '21 12:06 Hades32

@deitch, @jdolitsky, @shizhMSFT can you help with some thoughts? This looks like the work to standardize around tar would be really helpful. https://github.com/oras-project/oras/issues/178

SteveLasker avatar Jun 14 '21 15:06 SteveLasker

Closing this issue due to inactivity. Please re-open if needed.

shizhMSFT avatar Mar 22 '23 09:03 shizhMSFT