Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Artifacts uploaded to repo/downloads not preserving file permissions Edited

Biscuits I'm New Here Jan 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

Hi @Biscuits ,

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

Biscuits I'm New Here Feb 03, 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.

Hi @Biscuits ,

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
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

2,140 views 11 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you