Re: [PATCH 1/1] Introduce new build variables INSTALL_MODE_EXECUTABLE and INSTALL_MODE_DATA.

2013-02-25 Thread TJ
On 25/02/13 06:54, Junio C Hamano wrote: Besides, you would want to 
differentiate the two kinds of 755 anyway
 (I'd prefer INSTALL_PROGRAM to use -m 555 personally, for example).

 Yes, I think I lost that one in the mists of sed-land when making the 
 changes :)

 I'll revise the patch based on received comments and post the revision 
 tomorrow.
 
 Did anything come out of this discussion?

Yes - but then I got lost in other projects and forgot about it! I'll revisit 
it this week and post the latest revision.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[New Feature] git-submodule-move - Easily move submodules

2013-02-03 Thread TJ
I've recently had need to re-arrange more than ten submodules within a project 
and discovered there is apparently no easy way to do it.

Using some suggestions I found on Stack Overflow I eventually figured out the 
steps required. Because the steps can be
complex I thought it would be handy to have a tool to automate the 
functionality.

I have put together a reasonably bullet-proof shell script git-submodule-move 
that does the job pretty well. I've put it through quite a bit of testing and 
trusted it with my own project and it has
performed well.

I've published to github so others can use and improve it.

https://github.com/iam-TJ/git-submodule-move
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] git-clone fails due to GnuTLS recv error (-9), then deletes entire local repo

2013-02-01 Thread TJ
Using Ubuntu Precise 12.04 with git version (1.8.0.3) I discovered a bug 
whereby git-clone deletes the repository
it has just created if there is a GnuTLS error after the final transfer.

I switched to building and using the current git head 
(1.8.1.2.433.g070c57d.dirty) and found the same issue is still present.

There are two problems here:

1. At the end of the transfer GnuTLS recv error (-9): A TLS packet with 
unexpected length was received
2. git-clone goes on to resolve deltas *then* deletes the entire repository

This is reported as Ubuntu bug #882 at 
https://bugs.launchpad.net/ubuntu/+bug/882

The following transcript uses git built with one local patch on top of commit 
070c57d which fixes the $(INSTALL) file mode
issue as per my previous list posting PATCH 1/1] Introduce new build variables 
INSTALL_MODE_EXECUTABLE and INSTALL_MODE_DATA.

GIT_CURL_VERBOSE=1 git clone -v https://git01.codeplex.com/typescript

the operation fails after the final git pack-file has been received and the 
already-created repository is deleted from the file system.

...
 POST /typescript/git-upload-pack HTTP/1.1
User-Agent: git/1.8.1.2.433.g9808ce0.dirty
Host: git01.codeplex.com
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 611

* upload completely sent off: 611out of 611 bytes
 HTTP/1.1 200 OK
 Cache-Control: no-cache, max-age=0, must-revalidate
 Pragma: no-cache
 Content-Type: application/x-git-upload-pack-result
 Expires: Fri, 01 Jan 1980 00:00:00 GMT
 Server: Microsoft-IIS/7.5
 X-Powered-By: ASP.NET
 Date: Thu, 31 Jan 2013 21:43:55 GMT
 Connection: close

remote: Counting objects: 149766, done.
remote: Compressing objects: 100% (10580/10580), done.
* GnuTLS recv error (-9): A TLS packet with unexpected length was received.
* Closing connection #0
remote: Total 149766 (delta 138201), reused 149559 (delta 138077)
Receiving objects: 100% (149766/149766), 198.98 MiB | 361 KiB/s, done.
error: RPC failed; result=56, HTTP code = 200
Resolving deltas: 100% (138201/138201), done.


git exits at this point but it deletes the entire cloned ./typescript directory.

So far as I can tell from watching the ./typescript directory from another 
terminal and also the ethernet interface activity
the transfer is complete but GnuTLS is expecting something more from the HTTPS 
server which isn't forthcoming, leading to
the error.

The git bug - if this is accepted as a bug - is the deletion of the entire 
cloned repository.


I tried building the git binary and including an additional debug option in 
http.c that allowed me to set the protocol version using an environment 
option:

CURLOPT_SSLVERSION=1 git clone ...

where 1 = TLSv1, 2 = SSLv2, 3 = SSLv3.

I tried each protocol but the result was the same.

I did some experimentation using gnutl-cli-debug but was unable to figure out a 
way to reproduce the SSL/TLS error without
this particular git-clone operation. However, that is a GnuTLS bug, not a git 
bug.

I did try to build the latest gnutls but it needs a very recent version of 
libnettle which has the rsa_decrypt_tr function. I stopped at that point 
since I don't want to get into dependency and
library version issues.

Additional research seems to indicate this is a known intentional gnutls 
behaviour (that has been modified in very recent gnutls that makes use of a 
very recent libnettle - as mentioned above). The
issue is, apparently, the random size padding of packets to prevent 
communications compromise for stream ciphers.

I installed stunnel4 (which depends on openssl rather than gnutls) and created 
a reverse-proxy (client in stunnel terminology):

$ cat /etc/stunnel/rp-codeplex.com.conf
client = yes

[http]
accept = 
connect = git01.codeplex.com:443
TIMEOUTclose = 0

$ sudo sed -i 's/\(ENABLED\).*/\1=1/' /etc/default/stunnel4
$ sudo service stunnel4 restart

$ GIT_CURL_VERBOSE=1 git clone -v http://localhost:/typescript

...
 POST http://localhost:/typescript/git-upload-pack HTTP/1.1
User-Agent: git/1.8.1.2.433.g9808ce0.dirty
Host: localhost:
Accept-Encoding: gzip
Proxy-Connection: Keep-Alive
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 611

* upload completely sent off: 611out of 611 bytes
 HTTP/1.1 200 OK
 Cache-Control: no-cache, max-age=0, must-revalidate
 Pragma: no-cache
 Content-Type: application/x-git-upload-pack-result
 Expires: Fri, 01 Jan 1980 00:00:00 GMT
 Server: Microsoft-IIS/7.5
 X-Powered-By: ASP.NET
 Date: Thu, 31 Jan 2013 23:38:19 GMT
 Connection: close

remote: Counting objects: 149798, done.
remote: Compressing objects: 100% (10612/10612), done.
remote: Total 149798 (delta 138221), reused 149558 (delta 138077)
* Closing connection #0
Receiving objects: 100% (149798/149798), 198.99 MiB | 640 KiB/s, done.
Resolving deltas: 100% (138221/138221), done.
Checking out files: 100% (2851/2851), done.
--
To unsubscribe from 

Re: [PATCH 1/1] Introduce new build variables INSTALL_MODE_EXECUTABLE and INSTALL_MODE_DATA.

2013-01-31 Thread TJ
On 31/01/13 15:51, Junio C Hamano wrote:
 TJ g...@iam.tj writes:
 
 +$(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man1dir)
 +$(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man5dir)
 +$(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man7dir)
 +$(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN1) $(DESTDIR)$(man1dir)
 +$(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN5) $(DESTDIR)$(man5dir)
 +$(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN7) $(DESTDIR)$(man7dir)
 
 I'm tempted to suggest
 
 INSTALL_DIR = $(INSTALL) -d -m 755
 INSTALL_DATA = $(INSTALL) -m 644
 INSTALL_PROGRAM = $(INSTALL) -m 755
 
 The number of lines the patch needs to touch will be the same, but
 the resulting lines will not have many $(INSTALL_MODE_BLAH) shouting
 at us.

I did contemplate that but was concerned it might be seen as interfering unduly 
with
the tool name/path settings, as opposed to their options.

 Besides, you would want to differentiate the two kinds of 755 anyway
 (I'd prefer INSTALL_PROGRAM to use -m 555 personally, for example).

Yes, I think I lost that one in the mists of sed-land when making the changes :)

I'll revise the patch based on received comments and post the revision tomorrow.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/1] Introduce new build variables INSTALL_MODE_EXECUTABLE and INSTALL_MODE_DATA.

2013-01-30 Thread TJ
During a build/install cycle of the current HEAD whilst attempting to identify 
the cause of a bug in
git version 1.8.0.3 whilst doing:

GIT_CURL_VERBOSE=1 git clone -v https://git01.codeplex.com/typescript

* GnuTLS recv error (-9): A TLS packet with unexpected length was received.
* Closing connection #0
error: RPC failed; result=56, HTTP code = 200

I hit a local install failure whilst installing to the prefix /usr/local/ where 
the $(INSTALL)
command reported a Permission Denied error.

This was due to the $(INSTALL) modes being 755/644 but the file-system modes 
being 775/664.
In this case ownership and permissions are:

$ ls -ald /usr/local
drwxrwxr-x 13 root adm 4096 Sep 26 04:16 /usr/local

Users belonging to the 'adm' group have permission to install local packages.

The fix I've implemented is to convert the hard-coded 755/644 modes to 
variables which can
be over-ridden on the make command-line if necessary.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] Introduce new build variables INSTALL_MODE_EXECUTABLE and INSTALL_MODE_DATA.

2013-01-30 Thread TJ
Installation would fail if the target location had anything other than 755/644
file permissions. Therefore replace the hard-coded modes for each $(INSTALL)
with variables.

Default values are 755/644 but can be over-ridden on the make command line
e.g. make INSTALL_MODE_EXECUTABLE=755 INSTALL_MODE_DATA=644 install.

Signed-off-by: TJ g...@iam.tj
---
 Documentation/Makefile   | 20 ++--
 Makefile | 17 +++--
 contrib/emacs/Makefile   |  2 +-
 contrib/subtree/Makefile |  4 ++--
 git-gui/Makefile | 12 ++--
 gitk-git/Makefile|  6 +++---
 gitweb/Makefile  |  8 
 templates/Makefile   |  2 +-
 8 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 971977b..913928c 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -190,16 +190,16 @@ pdf: user-manual.pdf
 install: install-man
  install-man: man
-   $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
-   $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
-   $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
-   $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
-   $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
-   $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man1dir)
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man5dir)
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(man7dir)
+   $(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN1) $(DESTDIR)$(man1dir)
+   $(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN5) $(DESTDIR)$(man5dir)
+   $(INSTALL) -m $(INSTALL_MODE_DATA) $(DOC_MAN7) $(DESTDIR)$(man7dir)
  install-info: info
-   $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
-   $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(infodir)
+   $(INSTALL) -m $(INSTALL_MODE_DATA) git.info gitman.info 
$(DESTDIR)$(infodir)
if test -r $(DESTDIR)$(infodir)/dir; then \
  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
@@ -208,8 +208,8 @@ install-info: info
fi
  install-pdf: pdf
-   $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
-   $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) $(DESTDIR)$(pdfdir)
+   $(INSTALL) -m $(INSTALL_MODE_DATA) user-manual.pdf $(DESTDIR)$(pdfdir)
  install-html: html
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
diff --git a/Makefile b/Makefile
index 731b6a8..7a59202 100644
--- a/Makefile
+++ b/Makefile
@@ -354,6 +354,11 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 +# default installation file modes. Can be overridden from the 'make' 
command-line.
+# E.g. For allowing group write: make INSTALL_MODE_EXECUTABLE=775 install
+INSTALL_MODE_EXECUTABLE = 755
+INSTALL_MODE_DATA = 644
+
 # Among the variables below, these:
 #   gitexecdir
 #   template_dir
@@ -2257,16 +2262,16 @@ mergetools_instdir_SQ = $(subst 
','\'',$(mergetools_instdir))
 install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) 
$(BINDIR_PROGRAMS_NO_X)
  install: all
-   $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
-   $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) '$(DESTDIR_SQ)$(bindir_SQ)'
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) 
'$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
-   $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
+   $(INSTALL) -m $(INSTALL_MODE_DATA) $(SCRIPT_LIB) 
'$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
-   $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
-   $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) 
'$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
+   $(INSTALL) -m $(INSTALL_MODE_DATA) mergetools/* 
'$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
 ifndef NO_GETTEXT
-   $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
+   $(INSTALL) -d -m $(INSTALL_MODE_EXECUTABLE) 
'$(DESTDIR_SQ)$(localedir_SQ)'
(cd po/build/locale  $(TAR) cf - .) | \
(cd '$(DESTDIR_SQ)$(localedir_SQ)'  umask 022  $(TAR) xof -)
 endif
diff --git a/contrib/emacs/Makefile b/contrib/emacs/Makefile
index 24d9312..a405744 100644
--- a/contrib/emacs/Makefile
+++ b/contrib/emacs/Makefile
@@ -4,7 +4,7 @@ EMACS = emacs
  ELC = git.elc git-blame.elc
 INSTALL ?= install
-INSTALL_ELC = $(INSTALL) -m 644
+INSTALL_ELC = $(INSTALL) -m $(INSTALL_MODE_DATA)
 prefix ?= $(HOME)
 emacsdir = $(prefix)/share/emacs/site