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

[PATCH] add definitions for global variables to shell.c

From
Robert Schiele <rschiele@gmail.com>
Date
Aug 18, 2008, 12:37 UTC
Message-ID
<20080818123727.GB11842@schiele.dyndns.org>

Commit 5b8e6f85 introduced stubs for three functions that make no sense for git-shell. But those stubs defined libgit.a functions a second time so that a linker can complain. While commit 78568448 fixes this problem it introduces a new issue on the affected systems: Some versions of the Sun compiler generate references to global variables when they see extern declarations for those, even when they are never used in the code.

This patch does a similar workaround for this problem as commit 5b8e6f85 did for the functions.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
---
 shell.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/shell.c b/shell.c
index 6a48de0..8902ea5 100644
--- a/shell.c
+++ b/shell.c
@@ -3,12 +3,17 @@
 #include "exec_cmd.h"
 #include "strbuf.h"
 
-/* Stubs for functions that make no sense for git-shell. These stubs
- * are provided here to avoid linking in external redundant modules.
+/* Stubs for functions and external variables that make no sense for
+ * git-shell. These stubs are provided here to avoid linking in
+ * external redundant modules.
  */
 void release_pack_memory(size_t need, int fd){}
 void trace_argv_printf(const char **argv, const char *fmt, ...){}
 void trace_printf(const char *fmt, ...){}
+int trust_executable_bit;
+const unsigned char null_sha1[20];
+const signed char hexval_table[256];
+int has_symlinks;
 
 
 static int do_generic_cmd(const char *me, char *arg)
-- 
1.5.4.5
Next: Junio C Hamano
Message 1 of 13 in “add definitions for global variables to shell.c”
  1. add definitions for global variables to shell.cRobert Schiele, Aug 18, 2008
  2. Junio C HamanoAug 19, 2008
  3. Robert SchieleAug 19, 2008
  4. Junio C HamanoAug 19, 2008
  5. Robert SchieleAug 19, 2008
  6. Johannes SixtAug 19, 2008
  7. Robert SchieleAug 19, 2008
  8. Junio C HamanoAug 19, 2008
  9. 1/2 shell: do not play duplicated definition games to shrink the executableJunio C Hamano, Aug 20, 2008
  10. 2/2 Build-in "git-shell"Junio C Hamano, Aug 20, 2008
  11. Johannes SixtAug 20, 2008
  12. Junio C HamanoAug 20, 2008
  13. Robert SchieleAug 20, 2008

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.