Re: [PATCH] Be more careful with objects directory permissions on clone
- From
- Mark Hills <mark@pogo.org.uk>
- Date
- May 5, 2008, 09:56 UTC
- Message-ID
- <alpine.BSO.1.10.0805051047260.7723@zrgural.vwaro.pbz>
- In-Reply-To
- <481ECCF0.6080308@viscovery.net>
On Mon, 5 May 2008, Johannes Sixt wrote:
Show 23 quoted lines
> Mark Hills schrieb: >> Honour the setgid and umask when re-creating the objects directory >> at the destination. >> >> cpio in copy-pass mode aims to copy file permissions which causes this >> problem and cannot be disabled. Be explicit by copying the directory >> structure first, honouring the permissions at the destination, then copy >> the files with their existing read-only permissions. > ... >> cd "$repo" && >> - find objects -depth -print | cpio $cpio_quiet_flag -pumd$l >> "$GIT_DIR/" || \ >> + # Create dirs using umask and permissions and destination >> + find objects -type d -print | (cd "$GIT_DIR" && xargs mkdir -p) && >> + # Copy 0444 permissions on files >> + find objects -type f -print | cpio $cpio_quiet_flag -pumd$l >> "$GIT_DIR/" || \ > > Wouldn't that be better: > > find objects ! -type d -print | cpio ... > > ?
This was my first suggestion, unfortunately it shows up broken behaviour in all but the latest version of cpio. It creates 0700 directory permissions which is even worse.
I didn't find the later versions of cpio to be widespread, so I wrote the patch to work in all cases.
See the thread 'git-clone file permissions and cpio'.
Mark