Jump to content

p4 submit should not chown

  • Please log in to reply
1 reply to this topic

#1 mob



  • Members
  • Pip
  • 8 posts

Posted 09 January 2020 - 12:40 PM

I'm tracking different files in my root filesystem, that are owned by different users.
For universal access I'm just running the p4 command as root.

The client is like

Client: project

Update: 2019/12/11 14:20:10

Access: 2020/01/09 09:57:32

Owner: Me

Host: project

Created by me

Root: /

Options: allwrite noclobber nocompress unlocked nomodtime normdir

SubmitOptions: leaveunchanged+reopen

LineEnd: local

//CFG/rootfs/style.css //project/mnt/data/htdocs/style.css
//CFG/rootfs/nginx.conf //project/etc/nginx/nginx.conf
//CFG/rootfs/fstab //project/etc/fstab

The files are of type (text+kw). Because I only want to track explicit files, I don't use the .p4ignore or p4 reconcile yet and have single client lines for each file. That works.
The only issue is that after p4 submit, the file belongs to root:root which often is not desired as the files are belonging to different users originally. This breaks processes writing to those files if not belonging to their user anymore...

How can I prevent p4 submit from doing a chown? I just know +w or +x to keep specific chmod flags or keep the original mtime, but there is no +u for instance to keep the original user.

I could drop the +reopen and use the reconcile (especially the features p4 edit inside, because there won't be a p4 add done by reconcile if the client has a restricted file set only.
Any idea?

#2 Sambwise


    Advanced Member

  • Members
  • PipPipPip
  • 1175 posts

Posted 09 January 2020 - 04:05 PM

I don't think there's an intentional chown happening; the files get edited by the +k expansion, which is automatically going to change the owner, right?  Perforce doesn't track individual file ownership (since it's not portable across clients) so there's no option to set a file as being owned by a specific user the way you can set "+w" or "+x".

If you have "+w" set I believe Perforce just won't touch the file permissions, so you could chmod the files to be owned by all users and then that'd stick.

The other option would be to have your script that manages these files grab the file ownership before it runs and then chown it back after it's done.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users