How to set file permission bits with Perforce

I have several files that, as I noticed, disabled other bits (for example, permissions are set to 550 when registering with Perforce). I want them to be readable and / or executable by everyone. To put it in 'ls -l' parlance, the file permissions are as follows:

Checked: -r-xr-x ---
Issued: -rwxr-x ---

I tried installing chmod 555 before doing p4 editing, but Perforce just resets it to 750. Similarly, I tried chmod 755 after the file was opened for editing, but when I send it, it goes back to 550.

I read the p4 help filetypes and did not see anything that answered this, but I still tried + x, and it did not matter.

How to set other bits in Perforce?

+6
source share
2 answers

There are two ways to set file permissions in Perforce:

  • Set file permissions before p4 add save the file in Perforce.
  • Edit the file with the permissions you would like to have ie:
 p4 edit -t text+x some_bash_script.sh 

Perforce will then open the file for editing using the file type you requested. This document contains additional information about Perforce file options.

+10
source

The solution was to set umask (user file creation mask) so that it would not mask the bits that I want to save, for example, "umask 0022".

My umask was "0027" because by default I did not want the new files to be readable. Most often, file permissions are preserved as they are installed. If you edit a file, for example, change its permissions and then edit it again, its permission structure will not be reset according to your umask, and the original will be saved.

Perforce seems to erase and overwrite the file with each operation. Even if you are โ€œp4 editingโ€ the file, then change your umask and immediately โ€œp4 revertโ€ without making any changes to the file. Perforce will change the resolution bit according to your umask.

0
source

Source: https://habr.com/ru/post/981995/


All Articles