[RFC PATCH] git-help: find library man pages again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



46bac90 (Do not install shell libraries executable, 2010-01-31) changed
the executable bits of shell variables in order to avoid false reports
from valgrind. As a side effect, this inhibits "git help" from finding
the corresponding man pages because list_command_in_dir() (called by
load_command_list()) checks that bit.

Short of reverting that and appeasing  valgrind in another way, make
list_command_in_dir() ignore the executable bit when looking in the exec
dir, so that the following man pages are found again by "git-help":

git-mergetool--lib
git-parse-remote
git-sh-setup

Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---
Notes:
    This does not help with the man page for git-remote-helpers which is installed
    but not found by git-help either. That is a different issue, though.

 help.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/help.c b/help.c
index 7f4928e..451899c 100644
--- a/help.c
+++ b/help.c
@@ -146,8 +146,9 @@ static int is_executable(const char *name)
 }
 
 static void list_commands_in_dir(struct cmdnames *cmds,
-					 const char *path,
-					 const char *prefix)
+					const char *path,
+					const char *prefix,
+					int checkexec)
 {
 	int prefix_len;
 	DIR *dir = opendir(path);
@@ -172,7 +173,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
 
 		strbuf_setlen(&buf, len);
 		strbuf_addstr(&buf, de->d_name);
-		if (!is_executable(buf.buf))
+		if (checkexec && !is_executable(buf.buf))
 			continue;
 
 		entlen = strlen(de->d_name) - prefix_len;
@@ -193,7 +194,7 @@ void load_command_list(const char *prefix,
 	const char *exec_path = git_exec_path();
 
 	if (exec_path) {
-		list_commands_in_dir(main_cmds, exec_path, prefix);
+		list_commands_in_dir(main_cmds, exec_path, prefix, 0);
 		qsort(main_cmds->names, main_cmds->cnt,
 		      sizeof(*main_cmds->names), cmdname_compare);
 		uniq(main_cmds);
@@ -206,7 +207,7 @@ void load_command_list(const char *prefix,
 			if ((colon = strchr(path, PATH_SEP)))
 				*colon = 0;
 			if (!exec_path || strcmp(path, exec_path))
-				list_commands_in_dir(other_cmds, path, prefix);
+				list_commands_in_dir(other_cmds, path, prefix, 1);
 
 			if (!colon)
 				break;
-- 
1.7.2.2.540.g9d56f.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]