{"thread":{"id":"32810","subject":"Re: Re: Re: Re: Segmentation fault with latest git (070c57df)","startedAt":"2013-02-01T10:59:39Z","lastAt":"2013-02-02T00:03:13Z","messageCount":4,"participants":["Jongman Heo","Jonathan Nieder","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"208470","messageId":"27376267.797831359716377823.JavaMail.weblogic@epml01","threadId":"32810","inReplyTo":null,"subject":"Re: Re: Re: Re: Segmentation fault with latest git (070c57df)","fromName":"Jongman Heo","fromEmail":"jongman.heo@samsung.com","sentAt":"2013-02-01T10:59:39Z","receivedAt":"2013-02-01T10:59:39Z","isPatch":false,"sender":{"key":"jongman.heo@samsung.com","avatar":null},"body":"\n>> [...]\n>>  Finished prerequisites of target file `builtin/fetch.o'.\n>>  Prerequisite `builtin/fetch.c' is older than target `builtin/fetch.o'.\n>>  Prerequisite `GIT-CFLAGS' is older than target `builtin/fetch.o'.\n>> No need to remake target `builtin/fetch.o'.\n>\n>But it doesn't stimulate any prerequisites in make, which is weird.\n>What's in builtin/.depend/fetch.o.d?\n>\n>-Peff\n\nHi, \n\nplease see below~.\n\n$ cat builtin/.depend/fetch.o.d            \nfetch.o: builtin/fetch.c cache.h git-compat-util.h compat/bswap.h \\\n  strbuf.h hash.h advice.h gettext.h convert.h refs.h commit.h object.h \\\n  tree.h decorate.h builtin.h cache.h commit.h notes.h string-list.h \\\n  string-list.h remote.h transport.h remote.h run-command.h \\\n  parse-options.h sigchain.h submodule.h connected.h argv-array.h\n\ncache.h:\n\ngit-compat-util.h:\n\ncompat/bswap.h:\n\nstrbuf.h:\n\nhash.h:\n\nadvice.h:\n\ngettext.h:\n\nconvert.h:\n\nrefs.h:\n\ncommit.h:\n\nobject.h:\n\ntree.h:\n\ndecorate.h:\n\nbuiltin.h:\n\ncache.h:\n\ncommit.h:\n\nnotes.h:\n\nstring-list.h:\n\nstring-list.h:\n\nremote.h:\n\ntransport.h:\n\nremote.h:\n\nrun-command.h:\n\nparse-options.h:\n\nsigchain.h:\n\nsubmodule.h:\n\nconnected.h:\n\nargv-array.h:"},{"id":"208511","messageId":"20130201223851.GH12368@google.com","threadId":"32810","inReplyTo":"27376267.797831359716377823.JavaMail.weblogic@epml01","subject":"Re: Re: Re: Re: Segmentation fault with latest git (070c57df)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-01T22:38:51Z","receivedAt":"2013-02-01T22:38:51Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jongman Heo wrote:\n\n>> But it doesn't stimulate any prerequisites in make, which is weird.\n>> What's in builtin/.depend/fetch.o.d?\n[...]\n> please see below~.\n>\n> $ cat builtin/.depend/fetch.o.d            \n> fetch.o: builtin/fetch.c cache.h git-compat-util.h compat/bswap.h \\\n\nThat's the problem.  See the following thread:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/185625/focus=185680\n\nCurrently when COMPUTE_HEADER_DEPENDENCIES=auto git tests for\ndependency generation support by checking the output and exit status\nfrom the following command:\n\n\t$(CC) $(ALL_CFLAGS) -c -MF /dev/null -MMD -MP \\\n\t\t-x c /dev/null -o /dev/null 2>&1\n\nPerhaps this can be improved?  Even something as simple as a ccache\nversion test could presumably help a lot.\n\nHope that helps,\nJonathan\n"},{"id":"208512","messageId":"20130201224519.GI12368@google.com","threadId":"32810","inReplyTo":"27376267.797831359716377823.JavaMail.weblogic@epml01","subject":"[PATCH resend] Makefile: explicitly set target name for autogenerated dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-01T22:45:19Z","receivedAt":"2013-02-01T22:45:19Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Date: Fri, 18 Nov 2011 17:23:24 -0600\n\n\"gcc -MF depfile -MMD -MP -c -o path/to/file.o\" produces a makefile\nsnippet named \"depfile\" describing what files are needed to build the\ntarget given by \"-o\".  When ccache versions before v3.0pre0~187 (Fix\nhandling of the -MD and -MDD options, 2009-11-01) run, they execute\n\n\tgcc -MF depfile -MMD -MP -E\n\ninstead to get the final content for hashing.  Notice that the \"-c -o\"\ncombination is replaced by \"-E\".  The result is a target name without\na leading path.\n\nThus when building git with such versions of ccache with\nCOMPUTE_HEADER_DEPENDENCIES enabled, the generated makefile snippets\ndefine dependencies for the wrong target:\n\n\t$ make builtin/add.o\n\tGIT_VERSION = 1.7.8.rc3\n\t    * new build flags or prefix\n\t    CC builtin/add.o\n\t$ head -1 builtin/.depend/add.o.d\n\tadd.o: builtin/add.c cache.h git-compat-util.h compat/bswap.h strbuf.h \\\n\nAfter a change in a header file, object files in a subdirectory are\nnot automatically rebuilt by \"make\":\n\n\t$ touch cache.h\n\t$ make builtin/add.o\n\t$\n\nLuckily we can prevent trouble by explicitly supplying the name of the\ntarget to ccache and gcc, using the -MQ option.  Do so.\n\nReported-and-tested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nReported-by: : 허종만 <jongman.heo@samsung.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Makefile | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 731b6a8..5a2e02d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -973,7 +973,8 @@ endif\n \n ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)\n dep_check = $(shell $(CC) $(ALL_CFLAGS) \\\n-\t-c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null 2>&1; \\\n+\t-c -MF /dev/null -MQ /dev/null -MMD -MP \\\n+\t-x c /dev/null -o /dev/null 2>&1; \\\n \techo $$?)\n ifeq ($(dep_check),0)\n override COMPUTE_HEADER_DEPENDENCIES = yes\n@@ -1843,7 +1844,7 @@ $(dep_dirs):\n \n missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))\n dep_file = $(dir $@).depend/$(notdir $@).d\n-dep_args = -MF $(dep_file) -MMD -MP\n+dep_args = -MF $(dep_file) -MQ $@ -MMD -MP\n ifdef CHECK_HEADER_DEPENDENCIES\n $(error cannot compute header dependencies outside a normal build. \\\n Please unset CHECK_HEADER_DEPENDENCIES and try again)\n-- \n1.8.1\n"},{"id":"208515","messageId":"20130202000313.GA30191@sigill.intra.peff.net","threadId":"32810","inReplyTo":"20130201224519.GI12368@google.com","subject":"Re: [PATCH resend] Makefile: explicitly set target name for autogenerated dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-02-02T00:03:13Z","receivedAt":"2013-02-02T00:03:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 01, 2013 at 02:45:19PM -0800, Jonathan Nieder wrote:\n\n> After a change in a header file, object files in a subdirectory are\n> not automatically rebuilt by \"make\":\n> \n> \t$ touch cache.h\n> \t$ make builtin/add.o\n> \t$\n> \n> Luckily we can prevent trouble by explicitly supplying the name of the\n> target to ccache and gcc, using the -MQ option.  Do so.\n\nThanks, I missed the original thread last year, but this does look like\nthe same problem. The fixed version of ccache is a few years old, but\nthe OP did mention RHEL5, so that makes sense.\n\n>  missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))\n>  dep_file = $(dir $@).depend/$(notdir $@).d\n> -dep_args = -MF $(dep_file) -MMD -MP\n> +dep_args = -MF $(dep_file) -MQ $@ -MMD -MP\n\nThis looks like a nice simple solution. The only downside would be if\n-MQ is not supported by some gcc versions (in which case we would do\nbetter to improve the \"can we use computed dependencies\" check, and\npunish people on old ccache, not people on old gcc who otherwise could\nwork without -MQ).\n\nAs far as I can tell, though, -MQ came along with the other dependency\ngeneration options in 2001:\n\n  http://gcc.gnu.org/news/dependencies.html\n\nwhich means it's not a problem to rely on. So the patch looks good to\nme.\n\n-Peff\n"}]}