Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Artifacts uploaded to repo/downloads not preserving file permissions

Deleted user January 19, 2021

I have a build script that sets modular perms on the generated artifact to 0555, prior to  uploading to the Downloads section of my repo. After the upload occurs I have gone back and downloaded the newly published artifact, checked the perms, and found that they are 0311 and not 0555 like expected. 

Are the permissions being modified (script sets and confirms perms prior to upload -- see below) and if yes, is this intentional?

 

if platform == 'linux64' or platform == 'darwin64':
os.chmod(package, 0o555)

print(f'File permissions of {package} have been set to {oct(os.stat(package).st_mode)[-3:]}')

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 3, 2021

Hi @[deleted] ,

I have brought this up with the development team and they will check if anything on our side modifies permissions.

In the meantime, I have attempted reproducing this. I uploaded in the Downloads section of my repo a file with permissions 0555 and after downloading it, I see its permissions are 644, which is not the same as the original ones, but also different from what you are seeing.

I'm not sure if the os and browser play a role here, my attempt to reproduce was with Chrome in MacOS. Could you please let us know what browser, version of the browser, and OS you are seeing this with?

Kind regards,
Theodora

Deleted user February 3, 2021

Hi  @Theodora Boudale

The file is being published using the python requests module (see below);

# Let's go ahead and ship it off to bitbucket
uploadfile = {'files': open(package, 'rb')}
credentials = {
'user': args.un,
'password': args.pw
}

url = 'https://api.bitbucket.org/2.0/repositories/biscuits/discsearcher/downloads'
r = requests.post(url, auth=(args.un, args.pw), files=uploadfile)

 The behavior is consistent with both Linux, and MacOS. Neither OS is preserving the execute bit.

For what it's worth, I run the builder python tool on all Linux, Windows, and MacOS. Since windows considers .exe as executable and not a specific bit set, the Windows binary does not have this problem when downloaded.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2021

Hi @[deleted] ,

Thank you for the info.

I've heard back from the development team, they have investigated this and informed me that we don't do any modification on file permissions after the upload.

This is related to a user's environment and operating system. So, in Linux when you create a new file/folder, the umask command determines the permission of that resource. By default the umask value is 022 on mac and an umask of 022 sets permissions of 644 on new files and 755 on new folders. Browsers that work under current user's permission will use this umask value implicitly while creating a new file/folder. Also, browsers are not interfering with file permissions during the download process.

If you are seeing 0311 permissions on the downloaded file, you can check the umask value that is being used while creating a new file in the OS you are using.

Please feel free to let me know if this helps and if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events