{"thread":{"id":"5084","subject":"[PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","startedAt":"2006-08-02T01:03:39Z","lastAt":"2006-08-05T17:11:28Z","messageCount":5,"participants":["Ramsay Jones","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"24541","messageId":"00b601c6b5cf$7d54b940$c47eedc1@ramsay1.demon.co.uk","threadId":"5084","inReplyTo":null,"subject":"[PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-02T01:03:39Z","receivedAt":"2006-08-02T01:03:39Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"convert-objects.c sets _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED before\nincluding <time.h>, in order to get the declaration of strptime().\nThis leads to breakage in cache.h, due to S_ISLNK and S_IFLNK no longer\nbeing defined by <sys/stat.h>.  These definitions are protected by the\n__USE_BSD symbol, which is not set when _XOPEN_SOURCE is set.  Moving\nthe #defines and #include <time.h> below all other #includes does not\nfix the problem, however, since now _USE_XOPEN, which protects the\ndeclaration of strptime(), is now not defined (don't ask!).\n\nThe fix is to #define _GNU_SOURCE, which enables the definition of\npractically everything.\n\nSigned-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n convert-objects.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/convert-objects.c b/convert-objects.c\nindex 0fabd89..971ad6d 100644\n--- a/convert-objects.c\n+++ b/convert-objects.c\n@@ -1,5 +1,6 @@\n #define _XOPEN_SOURCE 500 /* glibc2 and AIX 5.3L need this */\n #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n+#define _GNU_SOURCE\n #include <time.h>\n #include \"cache.h\"\n #include \"blob.h\"\n-- \n1.4.1\n\n\nFrom 72f745c4c1e366a0f1fc75ec8da55a3cfb5457c7 Mon Sep 17 00:00:00 2001\nFrom: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\nDate: Sun, 30 Jul 2006 16:52:09 +0100\nSubject: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.\n\nconvert-objects.c sets _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED before\nincluding <time.h>, in order to get the declaration of strptime().\nThis leads to breakage in cache.h, due to S_ISLNK and S_IFLNK no longer\nbeing defined by <sys/stat.h>.  These definitions are protected by the\n__USE_BSD symbol, which is not set when _XOPEN_SOURCE is set.  Moving\nthe #defines and #include <time.h> below all other #includes does not\nfix the problem, however, since now _USE_XOPEN, which protects the\ndeclaration of strptime(), is now not defined (don't ask!).\n\nThe fix is to #define _GNU_SOURCE, which enables the definition of\npractically everything.\n\nSigned-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n convert-objects.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/convert-objects.c b/convert-objects.c\nindex 0fabd89..971ad6d 100644\n--- a/convert-objects.c\n+++ b/convert-objects.c\n@@ -1,5 +1,6 @@\n #define _XOPEN_SOURCE 500 /* glibc2 and AIX 5.3L need this */\n #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n+#define _GNU_SOURCE\n #include <time.h>\n #include \"cache.h\"\n #include \"blob.h\"\n-- \n1.4.1\n\n"},{"id":"24550","messageId":"7vpsfjvaul.fsf@assigned-by-dhcp.cox.net","threadId":"5084","inReplyTo":"00b601c6b5cf$7d54b940$c47eedc1@ramsay1.demon.co.uk","subject":"Re: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-02T07:46:26Z","receivedAt":"2006-08-02T07:46:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ramsay Jones\" <ramsay@ramsay1.demon.co.uk> writes:\n\n> convert-objects.c sets _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED before\n> including <time.h>, in order to get the declaration of strptime().\n> This leads to breakage in cache.h, due to S_ISLNK and S_IFLNK no longer\n> being defined by <sys/stat.h>.  These definitions are protected by the\n> __USE_BSD symbol, which is not set when _XOPEN_SOURCE is set.  Moving\n> the #defines and #include <time.h> below all other #includes does not\n> fix the problem, however, since now _USE_XOPEN, which protects the\n> declaration of strptime(), is now not defined (don't ask!).\n\nWouldn't including \"cache.h\" and friends first and including\n<time.h> last solve the problem, then?\n\nThis kind of change tends to fix one system while potentially\nbreaking another, and we would need to be careful.  Will queue\nfor post 1.4.2 and have people scream if it breaks somebody, I\nguess.\n"},{"id":"24579","messageId":"001d01c6b664$285ff540$c47eedc1@ramsay1.demon.co.uk","threadId":"5084","inReplyTo":"7vpsfjvaul.fsf@assigned-by-dhcp.cox.net","subject":"RE: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-02T18:47:51Z","receivedAt":"2006-08-02T18:47:51Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nOn Wed, 2006-08-02 at 8:46, Junio C Hamano wrote:\n> \n> \"Ramsay Jones\" <ramsay@ramsay1.demon.co.uk> writes:\n> \n> > convert-objects.c sets _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED before\n> > including <time.h>, in order to get the declaration of strptime().\n> > This leads to breakage in cache.h, due to S_ISLNK and S_IFLNK no longer\n> > being defined by <sys/stat.h>.  These definitions are protected by the\n> > __USE_BSD symbol, which is not set when _XOPEN_SOURCE is set.  Moving\n> > the #defines and #include <time.h> below all other #includes does not\n> > fix the problem, however, since now _USE_XOPEN, which protects the\n> > declaration of strptime(), is now not defined (don't ask!).\n> \n> Wouldn't including \"cache.h\" and friends first and including\n> <time.h> last solve the problem, then?\n> \n\nNot for me. It may be a glibc 2.1 specific problem, of course, but \nstrptime() remains undeclared.\n\n> This kind of change tends to fix one system while potentially\n> breaking another, and we would need to be careful.  Will queue\n> for post 1.4.2 and have people scream if it breaks somebody, I\n> guess.\n> \n\nYes, I had some concern about that myself. Unfortunately, you can't\nmake it conditional on the glibc version macros; in order to get the\nmacros, you have to include (one way or another) <features.h>, at which\npoint it is already too late ...\n\nRamsay\n"},{"id":"24675","messageId":"Pine.LNX.4.63.0608040211160.1800@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5084","inReplyTo":"001d01c6b664$285ff540$c47eedc1@ramsay1.demon.co.uk","subject":"RE: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-04T00:19:56Z","receivedAt":"2006-08-04T00:19:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 2 Aug 2006, Ramsay Jones wrote:\n\n> [...] but strptime() remains undeclared.\n\nNote that there is just one call to strptime() in the C sources: \nconvert-objects.\n\nAlso, we have something more portable in git now: you might be able to \nsubstitute\n\n\tconst char *next = strptime(buf, *fmt, &tm);\n\tif (next) {\n\nby something like\n\n\tchar buffer[50];\n\tint len = parse_date(buf, buffer, sizeof(buffer));\n\tconst char *next = buf + len;\n\n\tif (len) {\n\t\tconst char *tzstring = strchr(buffer, ' ') + 1;\n\t\tint tz = (int)strtol(tzstring, NULL, 10);\n\t\ttm = *time_to_tm(strtoul(buffer, NULL, 10), tz);\n\nHowever, I did not test it, and this might be completely bogus.\n\nCiao,\nDscho\n\t\n"},{"id":"24833","messageId":"000101c6b8b2$30c76060$c47eedc1@ramsay1.demon.co.uk","threadId":"5084","inReplyTo":"Pine.LNX.4.63.0608040211160.1800@wbgn013.biozentrum.uni-wuerzburg.de","subject":"RE: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-05T17:11:28Z","receivedAt":"2006-08-05T17:11:28Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nOn Fri, 2006-08-04 at 1:20, Johannes Schindelin wrote:\n> Hi,\n> \n> On Wed, 2 Aug 2006, Ramsay Jones wrote:\n> \n> > [...] but strptime() remains undeclared.\n> \n> Note that there is just one call to strptime() in the C sources: \n> convert-objects.\n> \n> Also, we have something more portable in git now: you might be able to \n> substitute\n> \n> \tconst char *next = strptime(buf, *fmt, &tm);\n> \tif (next) {\n> \n> by something like\n> \n> \tchar buffer[50];\n> \tint len = parse_date(buf, buffer, sizeof(buffer));\n> \tconst char *next = buf + len;\n> \n> \tif (len) {\n> \t\tconst char *tzstring = strchr(buffer, ' ') + 1;\n> \t\tint tz = (int)strtol(tzstring, NULL, 10);\n> \t\ttm = *time_to_tm(strtoul(buffer, NULL, 10), tz);\n> \n> However, I did not test it, and this might be completely bogus.\n> \n\nYes, I'm sure something like that could be done, but I really don't\nthink we need anything that intrusive to fix such a simple problem.\nIndeed, I would rather Junio ignore the patch if it appears to cause\nanyone else a problem. I can maintain it locally (it's only one line!).\nAfter all, I'm pretty sure I'm the only idiot^H^H^H^H^H person using a\nsix year old dev system.\n\nRamsay\n"}]}