git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: No fchmd. was: Re: [PATCH 00/14] Add submodule test harness

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 10, 2014, 19:49 UTC
Message-ID
<xmqq61j5805g.fsf@gitster.dls.corp.google.com>
In-Reply-To
<53BE3127.8020805@web.de>
Torsten Bögershausen <tboegi@web.de> writes:
Show 16 quoted lines
> Isn't the whole problem starting here:
> in config.c:
>
>     fd = hold_lock_file_for_update(lock, config_filename, 0);
> In lockfile.c:
>   /* This should return a meaningful errno on failure */
>   int hold_lock_file_for_update(struct lock_file *lk, const char
> *path, int flags)
>   {
>       int fd = lock_file(lk, path, flags);
> which leads to
>   static int lock_file(struct lock_file *lk, const char *path, int flags)
>     []
>     lk->fd = open(lk->filename.buf, O_RDWR | O_CREAT | O_EXCL, 0666);
>
> There is no way to tell which permissions the new lockfile should have.
We follow whategver user's umask says with this code.
> That is somewhat unlucky.
>
> On the other hand, shouldn't we call
> adjust_shared_perm(const char *path) from path.c on the config file?

Good question, but I am not sure. For $GIT_DIR/config, I tend to agree we should, but "git config --global foo bar" would not be a shared file anyway, and my understanding of Eric's original motivation is to keep $HOME/.gitconfig to be tighter than the user's umask normally would indicate.

Show 5 quoted lines
> And to all files which are fiddled through the lock_file API?
> In other words, the lockfile could be created with the restrictive
> permissions
> 600, and once the lockfile had been closed and renamed into the final name
> we apply adjust_shared_perm() on it ?

For all files that adjust-shared-perm should apply, yes, but I do not think it is relevant to the codepath in question.

> I think there are 2 different things missing here:
>
> - Be able to specify permissions to hold_lock_file_for_update(),
>    especially restrictive ones, like 600 and not 666.

Yes (in the sense that "yes we can add an extra parameter") and no (in the sense that "where would we get the value to pass to the extra parameter from? would it be worth to add configurations variables for different kinds of files?").

If we limit the case to "Inherit permissions from the file we are replacing by taking a lock on it", which is the topic of discussion in this thread, we do not have to worry about how to configure the value (we do not have to) and adding a new parameter to tell the mode to hold-lock-file-for-update is unneeded (the function will have a pathname of the original and can learn the current permission bits itself).

> - Adjust the permissions for "shared files" in a shared repo.
>   This is probably needed for a shared repo, when the user itself
>    has a umask which is too restrictive and adjust_shared_perm()
>    must be run to widen the permissions.

Don't we already do that for $GIT_DIR/config? In any case that will not help $HOME/.gitconfig and other files that are not shared.

Previous: Torsten BögershausenNext: Torsten Bögershausen
Message 63 of 65 in “Add submodule test harness”
  1. 00/14 Add submodule test harnessJens Lehmann, Jun 15, 2014
  2. 01/14 test-lib: add test_dir_is_empty()Jens Lehmann, Jun 15, 2014
  3. Junio C HamanoJun 16, 2014
  4. Jens LehmannJun 17, 2014
  5. 01/14 test-lib: add test_dir_is_empty()Jens Lehmann, Jun 19, 2014
  6. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jun 15, 2014
  7. Junio C HamanoJun 16, 2014
  8. Jens LehmannJun 17, 2014
  9. Junio C HamanoJun 17, 2014
  10. Jens LehmannJun 17, 2014
  11. Junio C HamanoJun 17, 2014
  12. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jun 19, 2014
  13. Junio C HamanoJun 20, 2014
  14. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jul 1, 2014
  15. 03/14 checkout: call the new submodule update test frameworkJens Lehmann, Jun 15, 2014
  16. 04/14 apply: add t4137 for submodule updatesJens Lehmann, Jun 15, 2014
  17. 05/14 read-tree: add t1013 for submodule updatesJens Lehmann, Jun 15, 2014
  18. 06/14 reset: add t7112 for submodule updatesJens Lehmann, Jun 15, 2014
  19. 07/14 bisect: add t6041 for submodule updatesJens Lehmann, Jun 15, 2014
  20. 07/14 bisect: add t6041 for submodule updatesJens Lehmann, Jun 19, 2014
  21. 08/14 merge: add t7613 for submodule updatesJens Lehmann, Jun 15, 2014
  22. 09/14 rebase: add t3426 for submodule updatesJens Lehmann, Jun 15, 2014
  23. Eric SunshineJun 16, 2014
  24. Jens LehmannJun 17, 2014
  25. 09/14 rebase: add t3426 for submodule updatesJens Lehmann, Jun 19, 2014
  26. 10/14 pull: add t5572 for submodule updatesJens Lehmann, Jun 15, 2014
  27. 11/14 cherry-pick: add t3512 for submodule updatesJens Lehmann, Jun 15, 2014
  28. 12/14 am: add t4255 for submodule updatesJens Lehmann, Jun 15, 2014
  29. 13/14 stash: add t3906 for submodule updatesJens Lehmann, Jun 15, 2014
  30. 13/14 stash: add t3906 for submodule updatesJens Lehmann, Jun 19, 2014
  31. 14/14 revert: add t3513 for submodule updatesJens Lehmann, Jun 15, 2014
  32. 14/14 revert: add t3513 for submodule updatesJens Lehmann, Jun 19, 2014
  33. Torsten BögershausenJul 2, 2014
  34. Jens LehmannJul 2, 2014
  35. Torsten BögershausenJul 3, 2014
  36. Jens LehmannJul 3, 2014
  37. Junio C HamanoJul 7, 2014
  38. Torsten BögershausenJul 7, 2014
  39. Jens LehmannJul 8, 2014
  40. Ramsay JonesJul 8, 2014
  41. Ramsay JonesJul 8, 2014
  42. No fchmod() under msygit - Was: Re: [PATCH 00/14] Add submodule test harnessTorsten Bögershausen, Jul 9, 2014
  43. Eric WongJul 9, 2014
  44. Erik Faye-LundJul 14, 2014
  45. Nico WilliamsJul 14, 2014
  46. Nico WilliamsJul 14, 2014
  47. Karsten BleesJul 14, 2014
  48. Junio C HamanoJul 14, 2014
  49. Torsten BögershausenJul 9, 2014
  50. Junio C HamanoJul 9, 2014
  51. Jens LehmannJul 9, 2014
  52. Junio C HamanoJul 9, 2014
  53. Junio C HamanoJul 10, 2014
  54. Jens LehmannJul 12, 2014
  55. Junio C HamanoJul 14, 2014
  56. Jens LehmannJul 14, 2014
  57. Junio C HamanoJul 14, 2014
  58. Johannes SixtJul 9, 2014
  59. Junio C HamanoJul 9, 2014
  60. Eric WongJul 9, 2014
  61. Junio C HamanoJul 9, 2014
  62. No fchmd. was: Re: [PATCH 00/14] Add submodule test harnessTorsten Bögershausen, Jul 10, 2014
  63. Junio C HamanoJul 10, 2014
  64. Torsten BögershausenJul 10, 2014
  65. Junio C HamanoJul 10, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.