How to set file permission bits with Perforce

Angelo Babudro picture Angelo Babudro · Feb 4, 2015 · Viewed 16k times · Source

I have a few files that I noticed have the Other bits turned off (e.g., permissions set to 550 when checked-in to Perforce). I want them to be readable and/or executable by everyone. To put it in 'ls -l' parlance, the file's permissions look like this:

Checked-in: -r-xr-x---
Checked-out: -rwxr-x---

I tried setting chmod 555 before doing p4 edit, but Perforce just resets it to 750. Likewise I tried chmod 755 after the file was opened for editing, but when I submit it reverts to 550.

I read the p4 help filetypes documentation and saw nothing that answered this, but I tried +x anyway and it didn't make any difference.

How can I set the Other bits in Perforce?

Answer

Ricky Levi picture Ricky Levi · Jun 29, 2015

There are two ways to set file permissions in Perforce:

  1. Set the file permissions before you p4 add the file to Perforce.
  2. Edit the file with the permissions you would like to have i.e:
p4 edit -t text+x some_bash_script.sh

Then Perforce will open the file for edit using the filetype you requested. This document has more information on Perforce filetype options.