Skip to content

chmod cleanup (Was: [BUG?] How to make a shared/restricted repo?)

Johan Herland git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Move chmod(foo, 0444) into move_temp_to_file()fast-import.c http-push.c http-walker.c +2 more+4 -112 replies
2/2Resolve double chmod() in move_temp_to_file()cache.h path.c sha1_file.c+21 -83 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] chmod cleanup (Was: [BUG?] How to make a shared/restricted repo?)
Quoted 8 lines · Johannes Sixt
Quoted 6 lines · Johan Herland

In the above patch, I've passed mode == -1 to finalize_temp_file() from all callsites where there was no corresponding (f)chmod(foo, 0444). However, after looking at the context (these are all either packs or loose objects), I'm wondering if we shouldn't pass mode == 0444 for all of these. At which point we could replace the above patch with this much simpler version:

Quoted 8 lines

Indeed!

Quoted 2 lines

(We could also add an optional "mode" argument to adjust_shared_perm(), to get rid of the double chmod().)

And I think you should do that, otherwise you have a short time window where the permissions of a pack or loose object is less restrictive than you want.

Ok, here's a cleaned-up series on top of Junio's patch. It should resolve the chmod()-after-adjust_shared_perm() issue in Junio's patch, as well as the rename-after-chmod Windows issue reported by Hannes.

The first patch is the second alternative I sent in an earlier mail. The second patch resolves the double chmod() left by the first patch.

Johan Herland (2):
Move chmod(foo, 0444) into move_temp_to_file()
Resolve double chmod() in move_temp_to_file()

 cache.h       |    1 +
 fast-import.c |    3 ---
 http-push.c   |    1 -
 http-walker.c |    1 -
 index-pack.c  |    7 +++----
 path.c        |   26 +++++++++++++++++++-------
 sha1_file.c   |    3 +--
 7 files changed, 24 insertions(+), 18 deletions(-)

Have fun! :)

...Johan

Signature · 2 lines
Johan Herland, <[email protected]>
www.herland.net