{"thread":{"id":"35019","subject":"[PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","startedAt":"2013-09-25T15:45:41Z","lastAt":"2013-09-26T00:47:54Z","messageCount":6,"participants":["Wataru Noguchi","Jonathan Nieder","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"228216","messageId":"1380123941-25941-1-git-send-email-wnoguchi.0727@gmail.com","threadId":"35019","inReplyTo":null,"subject":"[PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Wataru Noguchi","fromEmail":"wnoguchi.0727@gmail.com","sentAt":"2013-09-25T15:45:41Z","receivedAt":"2013-09-25T15:45:41Z","isPatch":true,"sender":{"key":"wnoguchi.0727@gmail.com","avatar":"https://gravatar.com/avatar/92adeb8d30332b0a1204df49b55442bf91ea38b678bb7406c7bf66f72f51b569?d=mp&s=160"},"body":"Git for Windows crashes when clone Japanese multibyte repository.\n- Japanese Base Encoding is Shift-JIS.\n- It happens Japanese multibyte directory name and too-long directory path\n- Linux(ex. Ubuntu 13.04 amd64) can clone normally.\n- example repository is here:\n\ngit clone https://github.com/wnoguchi/mingw-checkout-crash.git\n\n- The reproduce crash repository contains following file only.\n  - following directory and file name is encoded for this commit log.\n  - actually file name is decoded.]\n  %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n- only one commit.\n\nThis commit reduce gcc optimization level from O2 to O1 when MinGW Windows environment.\n\nSigned-off-by: Wataru Noguchi <wnoguchi.0727@gmail.com>\n---\n git-compat-util.h | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex a31127f..394c23b 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -90,6 +90,8 @@\n #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n #include <winsock2.h>\n #include <windows.h>\n+/* reduce gcc optimization level to 1 */\n+#pragma GCC optimize (\"O1\")\n #define GIT_WINDOWS_NATIVE\n #endif\n \n-- \n1.8.1.2\n"},{"id":"228226","messageId":"20130925191527.GY9464@google.com","threadId":"35019","inReplyTo":"1380123941-25941-1-git-send-email-wnoguchi.0727@gmail.com","subject":"Re: [PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-09-25T19:15:27Z","receivedAt":"2013-09-25T19:15:27Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(cc-ing the Git for Windows maintainers)\nHi,\n\nWataru Noguchi wrote:\n\n> Git for Windows crashes when clone Japanese multibyte repository.\n> - Japanese Base Encoding is Shift-JIS.\n> - It happens Japanese multibyte directory name and too-long directory path\n> - Linux(ex. Ubuntu 13.04 amd64) can clone normally.\n> - example repository is here:\n>\n> git clone https://github.com/wnoguchi/mingw-checkout-crash.git\n>\n> - The reproduce crash repository contains following file only.\n>   - following directory and file name is encoded for this commit log.\n>   - actually file name is decoded.]\n>   %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n> - only one commit.\n>\n> This commit reduce gcc optimization level from O2 to O1 when MinGW Windows environment.\n>\n> Signed-off-by: Wataru Noguchi <wnoguchi.0727@gmail.com>\n\nThanks.\n\n> ---\n>  git-compat-util.h | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index a31127f..394c23b 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -90,6 +90,8 @@\n>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n>  #include <winsock2.h>\n>  #include <windows.h>\n> +/* reduce gcc optimization level to 1 */\n> +#pragma GCC optimize (\"O1\")\n>  #define GIT_WINDOWS_NATIVE\n>  #endif\n\nDo you know why reducing the optimization level avoids a crash?\nPerhaps this is just masking the symptoms and the problem is still\nlurking.\n\nIf changing the optimization level turns out to be the right fix, I\nwould prefer to see this change made in the Makefile instead of\ngit-compat-util.h.  That way, the user building can still easily\noverride the optimization settings to -O0 if they want to during a\ndebugging session.\n\nWhat do you think?\n\nHope that helps,\nJonathan\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"228233","messageId":"alpine.DEB.1.00.1309252142220.1191@s15462909.onlinehome-server.info","threadId":"35019","inReplyTo":"20130925191527.GY9464@google.com","subject":"Re: Re: [PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2013-09-25T19:50:06Z","receivedAt":"2013-09-25T19:50:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 25 Sep 2013, Jonathan Nieder wrote:\n\n> Wataru Noguchi wrote:\n> \n> >   - actually file name is decoded.]\n> >   %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n> >\n> > This commit reduce gcc optimization level from O2 to O1 when MinGW\n> > Windows environment.\n> \n> Do you know why reducing the optimization level avoids a crash?\n\nI suspect that the optimization level causes smaller (or no) buffer bytes\nbetween data structures and the crash is the symptom of a buffer overflow.\nIn that light, I think that reducing the optimization level is most likely\njust working around this particular issue, and other scenarios might still\ncrash until we fix the underlying bug.\n\nMost likely the problem is with our Windows-specific UTF-8 handling, I\nwould not be surprised if it is my \"favorite\" bug: an off-by-one.\n\nTo find out what the real cause is, I suggest using a tool similar to\nvalgrind. Valgrind does not run on Windows, but I DuckDuckWent e.g.\nhttp://code.google.com/p/drmemory/ as an alternative that could be tried\nto identify the problem.\n\nCiao,\nJohannes\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"228240","messageId":"CAFRcQ0FohRz+eKsq=c8S2JGHb-_2sZaApNJwY6-ey2_jF3qmJg@mail.gmail.com","threadId":"35019","inReplyTo":"alpine.DEB.1.00.1309252142220.1191@s15462909.onlinehome-server.info","subject":"Re: Re: [PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Wataru Noguchi","fromEmail":"wnoguchi.0727@gmail.com","sentAt":"2013-09-25T23:42:29Z","receivedAt":"2013-09-25T23:42:29Z","isPatch":true,"sender":{"key":"wnoguchi.0727@gmail.com","avatar":"https://gravatar.com/avatar/92adeb8d30332b0a1204df49b55442bf91ea38b678bb7406c7bf66f72f51b569?d=mp&s=160"},"body":"Hi,\n\nThanks for your reply.\n\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.\n\nYes, I see.\nI think so.\nI shuld write optimization level change code to Makefile instead of\ngit-compat-util.h.\n\n\n2013/9/26 Jonathan Nieder <jrnieder@gmail.com>\n\n> (cc-ing the Git for Windows maintainers)\n> Hi,\n>\n> Wataru Noguchi wrote:\n>\n> > Git for Windows crashes when clone Japanese multibyte repository.\n> > - Japanese Base Encoding is Shift-JIS.\n> > - It happens Japanese multibyte directory name and too-long directory\n> path\n> > - Linux(ex. Ubuntu 13.04 amd64) can clone normally.\n> > - example repository is here:\n> >\n> > git clone https://github.com/wnoguchi/mingw-checkout-crash.git\n> >\n> > - The reproduce crash repository contains following file only.\n> >   - following directory and file name is encoded for this commit log.\n> >   - actually file name is decoded.]\n> >\n> %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n> > - only one commit.\n> >\n> > This commit reduce gcc optimization level from O2 to O1 when MinGW\n> Windows environment.\n> >\n> > Signed-off-by: Wataru Noguchi <wnoguchi.0727@gmail.com>\n>\n> Thanks.\n>\n> > ---\n> >  git-compat-util.h | 2 ++\n> >  1 file changed, 2 insertions(+)\n> >\n> > diff --git a/git-compat-util.h b/git-compat-util.h\n> > index a31127f..394c23b 100644\n> > --- a/git-compat-util.h\n> > +++ b/git-compat-util.h\n> > @@ -90,6 +90,8 @@\n> >  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n> >  #include <winsock2.h>\n> >  #include <windows.h>\n> > +/* reduce gcc optimization level to 1 */\n> > +#pragma GCC optimize (\"O1\")\n> >  #define GIT_WINDOWS_NATIVE\n> >  #endif\n>\n> Do you know why reducing the optimization level avoids a crash?\n> Perhaps this is just masking the symptoms and the problem is still\n> lurking.\n>\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.  That way, the user building can still easily\n> override the optimization settings to -O0 if they want to during a\n> debugging session.\n>\n> What do you think?\n>\n> Hope that helps,\n> Jonathan\n>\n\nHi,\n\nThanks for your advise.\n\n> To find out what the real cause is, I suggest using a tool similar to\n> valgrind. Valgrind does not run on Windows, but I DuckDuckWent e.g.\n> http://code.google.com/p/drmemory/ as an alternative that could be tried\n> to identify the problem.\n\nI will try debugging by using any tools more real cause.\n* Valgrind and drmemory, etc.\n\n2013/9/26 Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n> Hi,\n>\n> On Wed, 25 Sep 2013, Jonathan Nieder wrote:\n>\n> > Wataru Noguchi wrote:\n> >\n> > >   - actually file name is decoded.]\n> > >\n> %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n> > >\n> > > This commit reduce gcc optimization level from O2 to O1 when MinGW\n> > > Windows environment.\n> >\n> > Do you know why reducing the optimization level avoids a crash?\n>\n> I suspect that the optimization level causes smaller (or no) buffer bytes\n> between data structures and the crash is the symptom of a buffer overflow.\n> In that light, I think that reducing the optimization level is most likely\n> just working around this particular issue, and other scenarios might still\n> crash until we fix the underlying bug.\n>\n> Most likely the problem is with our Windows-specific UTF-8 handling, I\n> would not be surprised if it is my \"favorite\" bug: an off-by-one.\n>\n> To find out what the real cause is, I suggest using a tool similar to\n> valgrind. Valgrind does not run on Windows, but I DuckDuckWent e.g.\n> http://code.google.com/p/drmemory/ as an alternative that could be tried\n> to identify the problem.\n>\n> Ciao,\n> Johannes\n>\n\n\nThanks!\n\n-- \n===========================\n  Wataru Noguchi\n  wnoguchi.0727@gmail.com\n  http://wnoguchi.github.io/\n===========================\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"228241","messageId":"CAFRcQ0HPnnBFE7ww38OBO78SbHTJZpdPn4zd26k5TeUXWbGMGg@mail.gmail.com","threadId":"35019","inReplyTo":"20130925191527.GY9464@google.com","subject":"Re: [PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Wataru Noguchi","fromEmail":"wnoguchi.0727@gmail.com","sentAt":"2013-09-25T23:46:50Z","receivedAt":"2013-09-25T23:46:50Z","isPatch":true,"sender":{"key":"wnoguchi.0727@gmail.com","avatar":"https://gravatar.com/avatar/92adeb8d30332b0a1204df49b55442bf91ea38b678bb7406c7bf66f72f51b569?d=mp&s=160"},"body":"Hi,\n\nThanks for your reply and advise.\n\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.\n\nYes, I see.\nI think so.\nI shuld write optimization level change code to Makefile instead of\ngit-compat-util.h.\n\n\n2013/9/26 Jonathan Nieder <jrnieder@gmail.com>\n\n> (cc-ing the Git for Windows maintainers)\n> Hi,\n>\n> Wataru Noguchi wrote:\n>\n> > Git for Windows crashes when clone Japanese multibyte repository.\n> > - Japanese Base Encoding is Shift-JIS.\n> > - It happens Japanese multibyte directory name and too-long directory\n> path\n> > - Linux(ex. Ubuntu 13.04 amd64) can clone normally.\n> > - example repository is here:\n> >\n> > git clone https://github.com/wnoguchi/mingw-checkout-crash.git\n> >\n> > - The reproduce crash repository contains following file only.\n> >   - following directory and file name is encoded for this commit log.\n> >   - actually file name is decoded.]\n> >\n> %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n> > - only one commit.\n> >\n> > This commit reduce gcc optimization level from O2 to O1 when MinGW\n> Windows environment.\n> >\n> > Signed-off-by: Wataru Noguchi <wnoguchi.0727@gmail.com>\n>\n> Thanks.\n>\n> > ---\n> >  git-compat-util.h | 2 ++\n> >  1 file changed, 2 insertions(+)\n> >\n> > diff --git a/git-compat-util.h b/git-compat-util.h\n> > index a31127f..394c23b 100644\n> > --- a/git-compat-util.h\n> > +++ b/git-compat-util.h\n> > @@ -90,6 +90,8 @@\n> >  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n> >  #include <winsock2.h>\n> >  #include <windows.h>\n> > +/* reduce gcc optimization level to 1 */\n> > +#pragma GCC optimize (\"O1\")\n> >  #define GIT_WINDOWS_NATIVE\n> >  #endif\n>\n> Do you know why reducing the optimization level avoids a crash?\n> Perhaps this is just masking the symptoms and the problem is still\n> lurking.\n>\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.  That way, the user building can still easily\n> override the optimization settings to -O0 if they want to during a\n> debugging session.\n>\n> What do you think?\n>\n> Hope that helps,\n> Jonathan\n>\n\nThanks.\n\n\n-- \n===========================\n  Wataru Noguchi\n  wnoguchi.0727@gmail.com\n  http://wnoguchi.github.io/\n===========================\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"228243","messageId":"CAFRcQ0Fzikruv9tM5--hK9ELHZHDHQCcYyXxH7S9Xwv2p7_REg@mail.gmail.com","threadId":"35019","inReplyTo":"alpine.DEB.1.00.1309252142220.1191@s15462909.onlinehome-server.info","subject":"Re: Re: [PATCH] git-compat-util.h: reduce optimization level to 1 on MinGW env.","fromName":"Wataru Noguchi","fromEmail":"wnoguchi.0727@gmail.com","sentAt":"2013-09-26T00:47:54Z","receivedAt":"2013-09-26T00:47:54Z","isPatch":true,"sender":{"key":"wnoguchi.0727@gmail.com","avatar":"https://gravatar.com/avatar/92adeb8d30332b0a1204df49b55442bf91ea38b678bb7406c7bf66f72f51b569?d=mp&s=160"},"body":"Hi,\n\nI'm sorry resend email many times...\nMy GMail setting default to HTML format.\nSo mail sent to Git ML is rejected...\n\n----------------------------\nThanks for your reply.\n\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.\n\nYes, I see.\nI think so.\nI shuld write optimization level change code to Makefile instead of\ngit-compat-util.h.\n\n\n\n2013/9/26 Jonathan Nieder <jrnieder@gmail.com>:\n> (cc-ing the Git for Windows maintainers)\n> Hi,\n>\n> Wataru Noguchi wrote:\n>\n>> Git for Windows crashes when clone Japanese multibyte repository.\n>> - Japanese Base Encoding is Shift-JIS.\n>> - It happens Japanese multibyte directory name and too-long directory path\n>> - Linux(ex. Ubuntu 13.04 amd64) can clone normally.\n>> - example repository is here:\n>>\n>> git clone https://github.com/wnoguchi/mingw-checkout-crash.git\n>>\n>> - The reproduce crash repository contains following file only.\n>>   - following directory and file name is encoded for this commit log.\n>>   - actually file name is decoded.]\n>>   %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n>> - only one commit.\n>>\n>> This commit reduce gcc optimization level from O2 to O1 when MinGW Windows environment.\n>>\n>> Signed-off-by: Wataru Noguchi <wnoguchi.0727@gmail.com>\n>\n> Thanks.\n>\n>> ---\n>>  git-compat-util.h | 2 ++\n>>  1 file changed, 2 insertions(+)\n>>\n>> diff --git a/git-compat-util.h b/git-compat-util.h\n>> index a31127f..394c23b 100644\n>> --- a/git-compat-util.h\n>> +++ b/git-compat-util.h\n>> @@ -90,6 +90,8 @@\n>>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n>>  #include <winsock2.h>\n>>  #include <windows.h>\n>> +/* reduce gcc optimization level to 1 */\n>> +#pragma GCC optimize (\"O1\")\n>>  #define GIT_WINDOWS_NATIVE\n>>  #endif\n>\n> Do you know why reducing the optimization level avoids a crash?\n> Perhaps this is just masking the symptoms and the problem is still\n> lurking.\n>\n> If changing the optimization level turns out to be the right fix, I\n> would prefer to see this change made in the Makefile instead of\n> git-compat-util.h.  That way, the user building can still easily\n> override the optimization settings to -O0 if they want to during a\n> debugging session.\n>\n> What do you think?\n>\n> Hope that helps,\n> Jonathan\n\n\n\n\nHi,\n\nThanks for your advise.\n\n> To find out what the real cause is, I suggest using a tool similar to\n> valgrind. Valgrind does not run on Windows, but I DuckDuckWent e.g.\n> http://code.google.com/p/drmemory/ as an alternative that could be tried\n> to identify the problem.\n\nI will try debugging by using any tools more real cause.\n* Valgrind and drmemory, etc.\n\n\n2013/9/26 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Wed, 25 Sep 2013, Jonathan Nieder wrote:\n>\n>> Wataru Noguchi wrote:\n>>\n>> >   - actually file name is decoded.]\n>> >   %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%201-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%202-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%203-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%204-long-long-long-dirname/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%205-long-long-long-dirname/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB%E3%81%8A%E8%AA%AD%E3%81%BF%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84.txt\n>> >\n>> > This commit reduce gcc optimization level from O2 to O1 when MinGW\n>> > Windows environment.\n>>\n>> Do you know why reducing the optimization level avoids a crash?\n>\n> I suspect that the optimization level causes smaller (or no) buffer bytes\n> between data structures and the crash is the symptom of a buffer overflow.\n> In that light, I think that reducing the optimization level is most likely\n> just working around this particular issue, and other scenarios might still\n> crash until we fix the underlying bug.\n>\n> Most likely the problem is with our Windows-specific UTF-8 handling, I\n> would not be surprised if it is my \"favorite\" bug: an off-by-one.\n>\n> To find out what the real cause is, I suggest using a tool similar to\n> valgrind. Valgrind does not run on Windows, but I DuckDuckWent e.g.\n> http://code.google.com/p/drmemory/ as an alternative that could be tried\n> to identify the problem.\n>\n> Ciao,\n> Johannes\n\n\nThanks!\n\n\n-- \n===========================\n  Wataru Noguchi\n  wnoguchi.0727@gmail.com\n  http://wnoguchi.github.io/\n===========================\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"}]}