[PATCH] make error more descriptive if hook symlinks are bad

8 views
Skip to first unread message

ke...@reversity.org

unread,
Apr 12, 2024, 6:17:14 AMApr 12
to gito...@googlegroups.com, Mario Hros
From: Mario Hros <g...@reversity.org>

After moving users's HOME directory to a new location,
hook symlinks end up pointing to a wrong path but the gitolite
simply behaves as if nobody had access to any repo
and reports error "DENIED by fallthru" which is pretty misleading.

This patch changes the error into "DENIED by invalid setup"
and also logs a possible action to fix the problem.

---
src/lib/Gitolite/Conf/Load.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm
index 150a89c..bce6c88 100644
--- a/src/lib/Gitolite/Conf/Load.pm
+++ b/src/lib/Gitolite/Conf/Load.pm
@@ -73,7 +73,10 @@ sub access {
trace( 2, $repo, $user, $aa, $ref );
_die "invalid user '$user'" if not( $user and $user =~ $USERNAME_PATT );
sanity($repo);
- return "$aa any $repo $user DENIED by fallthru" unless update_hook_present($repo);
+ if ( not update_hook_present($repo) ) {
+ trace( 1, "repo $repo does not have a valid update hook, run 'gitolite setup -ho' if you have moved the user's home directory" );
+ return "$aa any $repo $user DENIED by invalid setup";
+ }

my @rules;
my $deny_rules;
--
2.39.3 (Apple Git-146)

Sitaram Chamarty

unread,
Apr 12, 2024, 6:38:39 AMApr 12
to ke...@reversity.org, gito...@googlegroups.com, Mario Hros
Hi,

On Thu, Apr 11, 2024 at 05:20:31PM +0200, kexik via gitolite wrote:
> From: Mario Hros <g...@reversity.org>
>
> After moving users's HOME directory to a new location,
> hook symlinks end up pointing to a wrong path but the gitolite

The correct procedure for moving gitolite from one server to
another (or even one "hosting user" [1] to another) is
documented at [2], and it is clear to me that you did something
else.

[1]: https://gitolite.com/gitolite/concepts.html#the-hosting-user
[2]: https://gitolite.com/gitolite/install#moving-servers

Don't get me wrong -- it's great that you knew enough about
gitolite to find some other way to do this (indeed, the
link I posted even says this is only one way).

So, more power to you but I'm only going to officially support
*one* way to do this.

Hope you understand.

sitaram

> simply behaves as if nobody had access to any repo
> and reports error "DENIED by fallthru" which is pretty misleading.
>
> This patch changes the error into "DENIED by invalid setup"
> and also logs a possible action to fix the problem.
>
> ---
> src/lib/Gitolite/Conf/Load.pm | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm
> index 150a89c..bce6c88 100644
> --- a/src/lib/Gitolite/Conf/Load.pm
> +++ b/src/lib/Gitolite/Conf/Load.pm
> @@ -73,7 +73,10 @@ sub access {
> trace( 2, $repo, $user, $aa, $ref );
> _die "invalid user '$user'" if not( $user and $user =~ $USERNAME_PATT );
> sanity($repo);
> - return "$aa any $repo $user DENIED by fallthru" unless update_hook_present($repo);
> + if ( not update_hook_present($repo) ) {
> + trace( 1, "repo $repo does not have a valid update hook, run 'gitolite setup -ho' if you have moved the user's home directory" );
> + return "$aa any $repo $user DENIED by invalid setup";
> + }
>
> my @rules;
> my $deny_rules;
> --
> 2.39.3 (Apple Git-146)
>
> --
> You received this message because you are subscribed to the Google Groups "gitolite" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gitolite+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gitolite/20240411152031.23478-1-git%40reversity.org.
Reply all
Reply to author
Forward
0 new messages