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

Re: First cut at git port to Cygwin

From
HAH. Peter Anvin <hpa@zytor.com>
Date
Sep 30, 2005, 17:01 UTC
Message-ID
<433D6F62.3030906@zytor.com>
In-Reply-To
<7v4q826ffy.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> 
> Could you do update-server-info there, please?
> 
Done...
Show 9 quoted lines
> 
> Knowing nothing about Cygwin environment, here are some
> comments.
> 
>         +# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
> 
> This part probably is applicable outside Cygwin.  At some point,
> can we have it in the mainline please?
> 
Well, I would hope that all the changes could eventually be merged.
Show 25 quoted lines
>          # The ones that do not have to link with lcrypto nor lz.
>          SIMPLE_PROGRAMS = \
>         -	git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
>         -	git-daemon git-var
>         +	git-get-tar-commit-id$(X) git-mailinfo$(X) git-mailsplit$(X) \
>         +	git-stripspace$(X) git-var$(X) git-daemon$(X)
>  
> I have seen these $(X) in other programs' ports and found them
> quite distasteful.  Since I not have immediate suggestions
> for improvements, I do not have rights to complain, though.
> 
> Spelling it $X is a bit less distracting but not that much
> better.  Maybe "SIMPLE_PROGRAM_NAMES = git-foo git-bar" and
> "SIMPLE_PROGRAMS = $(patsubst %,%$X,$(SIMPLE_PROGRAM_NAMES))"...
> but that would not help bits like this:
> 
>         -	PROGRAMS += git-http-fetch
>         +	PROGRAMS += git-http-fetch$(X)
> 
> or this: 
> 
>         -git-%: %.o $(LIB_FILE)
>         +git-%$(X): %.o $(LIB_FILE)
> 
> ... so I'd shut up about this part.

My first cut had PROGRAMS_X and SIMPLE_PROGRAMS_X being patsubst of the original versions, but in the end I decided it was even uglier, because these patterns were needed elsewhere. I'll change them to $X except where the parens are needed.

Show 9 quoted lines
>         diff --git a/daemon.c b/daemon.c
>         --- a/daemon.c
>         +++ b/daemon.c
>         @@ -1,9 +1,11 @@
>          #include "cache.h"
>          #include "pkt-line.h"
>         +#include <alloca.h>
> 
> Why?  I do not see any use of alloca in the added code...

I originally used alloca() before changing my mind and using calloc(); I think there might be platforms without alloca out there.

Show 7 quoted lines
>         +#include <sys/poll.h>
> 
> Is poll preferrable over select in general?  Some may have only
> select available and others may have only poll available,
> perhaps?  In any case, this is probably relevant to wider
> audience than just Cygwin; please give it to mainline at some
> point, perhaps conditionally allowing either/both.

The main reason I switched to poll() is that I believe all platforms that are even remotely relevant have both these days, and forming a poll list is so much cleaner than forming a select set. What makes forming a select set even remotely bearable is the invalid assumption that the number of file descriptors is bounded at compile time and therefore that fdset_t can be statically allocated. We've had problems in the past with that assumption on Linux, and I've tried to avoid select since then.

>         +	*socklist_p = malloc(sizeof(int));
>         +	pfd = calloc(socknum, sizeof(struct pollfd));
> 
> Please use xmalloc and xcalloc just for consistency.
Check.
Show 7 quoted lines
>                 test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;;
>         +
>         +	# In case we're running on Cygwin...
>         +	test -x $path/git-$cmd.exe && exec $path/git-$cmd.exe "$@" ;;
>          esac
>  
> Hmph, I think you forgot to drop double semicolon there.
D'oh!
Show 34 quoted lines
> The git.sh script is munged by Makefile so presumably we could
> fix this part up there, like:
> 
>         git: git.sh Makefile
>                 rm -f $@+ $@
>                 sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
>                     -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
>                     -e 's/@@X@@/$X/g' <$@.sh >$@+
>                 chmod +x $@+
>                 mv $@+ $@
> 
> And then (a patch on top of your "master"):
> 
> diff --git a/git.sh b/git.sh
> --- a/git.sh
> +++ b/git.sh
> @@ -12,10 +12,14 @@ case "$#" in
>  		exit 0 ;;
>  	esac
>  
> -	test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;;
> +	test -x $path/git-$cmd && exec $path/git-$cmd "$@"
>  
> -	# In case we're running on Cygwin...
> -	test -x $path/git-$cmd.exe && exec $path/git-$cmd.exe "$@" ;;
> +	case '@@X@@' in
> +	'')
> +		;;
> +	*)
> +		test -x $path/git-$cmd@@X@@ && exec $path/git-$cmd@@X@@ "$@" ;;
> +	esac		
>  esac
>  
>  echo "Usage: git COMMAND [OPTIONS] [TARGET]"

That wouldn't work, because the shell scripts don't get the .exe extension. However, I can figure out something equivalent.

	-hpa
Previous: Junio C HamanoNext: H. Peter Anvin
Message 11 of 62 in “First cut at git port to Cygwin”
  1. H. Peter AnvinSep 29, 2005
  2. Junio C HamanoSep 29, 2005
  3. H. Peter AnvinSep 29, 2005
  4. Martin LanghoffSep 29, 2005
  5. Junio C HamanoSep 29, 2005
  6. H. Peter AnvinSep 29, 2005
  7. Johannes SchindelinSep 29, 2005
  8. H. Peter AnvinSep 29, 2005
  9. H. Peter AnvinSep 29, 2005
  10. Junio C HamanoSep 30, 2005
  11. H. Peter AnvinSep 30, 2005
  12. H. Peter AnvinSep 30, 2005
  13. Alex RiesenOct 4, 2005
  14. Alex RiesenOct 4, 2005
  15. H. Peter AnvinOct 4, 2005
  16. Christopher FaylorOct 5, 2005
  17. H. Peter AnvinOct 4, 2005
  18. Christopher FaylorOct 5, 2005
  19. H. Peter AnvinOct 5, 2005
  20. Alex RiesenOct 5, 2005
  21. Alex RiesenOct 5, 2005
  22. Christopher FaylorOct 5, 2005
  23. Davide LibenziOct 5, 2005
  24. Christopher FaylorOct 5, 2005
  25. H. Peter AnvinOct 5, 2005
  26. Christopher FaylorOct 5, 2005
  27. Davide LibenziOct 5, 2005
  28. Alex RiesenOct 5, 2005
  29. Christopher FaylorOct 5, 2005
  30. Alex RiesenOct 6, 2005
  31. Alex RiesenOct 6, 2005
  32. Alex RiesenOct 7, 2005
  33. Linus TorvaldsOct 7, 2005
  34. Alex RiesenOct 7, 2005
  35. Alex RiesenOct 7, 2005
  36. Chuck LeverOct 7, 2005
  37. Alex RiesenOct 7, 2005
  38. Linus TorvaldsOct 8, 2005
  39. Elfyn McBratneyOct 8, 2005
  40. Elfyn McBratneyOct 8, 2005
  41. Johannes SchindelinOct 8, 2005
  42. Junio C HamanoOct 8, 2005
  43. Johannes SchindelinOct 8, 2005
  44. Junio C HamanoOct 8, 2005
  45. Johannes SchindelinOct 8, 2005
  46. H. Peter AnvinOct 10, 2005
  47. Johannes SchindelinOct 10, 2005
  48. H. Peter AnvinOct 10, 2005
  49. Johannes SchindelinOct 10, 2005
  50. Junio C HamanoOct 10, 2005
  51. Junio C HamanoOct 10, 2005
  52. H. Peter AnvinOct 10, 2005
  53. Daniel BarkalowOct 10, 2005
  54. Alex RiesenOct 8, 2005
  55. Commit text BEFORE the dashes (Re: First cut at git port to Cygwin)Matthias Urlichs, Oct 9, 2005
  56. Jonas FonsecaOct 5, 2005
  57. Johannes SchindelinOct 5, 2005
  58. Fix symbolic ref validationJonas Fonseca, Oct 5, 2005
  59. Junio C HamanoOct 5, 2005
  60. Alex RiesenOct 7, 2005
  61. Elfyn McBratneyOct 8, 2005
  62. H. Peter AnvinOct 10, 2005

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.