{"thread":{"id":"6854","subject":"[PATCH] Support for large files on 32bit systems.","startedAt":"2007-02-17T09:13:10Z","lastAt":"2007-02-19T02:44:29Z","messageCount":6,"participants":["Martin Waitz","Shawn O. Pearce","Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"34860","messageId":"20070217091310.GD21842@admingilde.org","threadId":"6854","inReplyTo":null,"subject":"[PATCH] Support for large files on 32bit systems.","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2007-02-17T09:13:10Z","receivedAt":"2007-02-17T09:13:10Z","isPatch":true,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"Glibc uses the same size for int and off_t by default.\nIn order to support large pack sizes (>2GB) we force Glibc to a 64bit off_t.\n\nSigned-off-by: Martin Waitz <tali@admingilde.org>\n---\n git-compat-util.h |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex bf3ceb8..38f9594 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -19,6 +19,11 @@\n #define _GNU_SOURCE 1\n #define _BSD_SOURCE 1\n \n+/* support large files even on 32bit systems */\n+#ifdef __GLIBC__\n+#define _FILE_OFFSET_BITS=64\n+#endif\n+\n #include <unistd.h>\n #include <stdio.h>\n #include <sys/stat.h>\n-- \n1.5.0.rc2.g08361-dirty\n\n-- \nMartin Waitz\n"},{"id":"34862","messageId":"20070217093953.GE21842@admingilde.org","threadId":"6854","inReplyTo":"20070217091310.GD21842@admingilde.org","subject":"Re: [PATCH] Support for large files on 32bit systems.","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2007-02-17T09:39:53Z","receivedAt":"2007-02-17T09:39:53Z","isPatch":true,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"hoi :)\n\narg, this patch is completely broken.\nI tested it by setting the macro via the command line and the\n= is still left in there.  And __GLIBC__ is not yet defined at this\npoint.\n\nHowever, we need to set _FILE_OFFSET_BITS for glibc somehow.\nWhat is the best way to do so?\n\n-- \nMartin Waitz\n"},{"id":"34864","messageId":"20070217094959.GH27864@spearce.org","threadId":"6854","inReplyTo":"20070217093953.GE21842@admingilde.org","subject":"Re: [PATCH] Support for large files on 32bit systems.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-17T09:49:59Z","receivedAt":"2007-02-17T09:49:59Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Martin Waitz <tali@admingilde.org> wrote:\n> arg, this patch is completely broken.\n> I tested it by setting the macro via the command line and the\n> = is still left in there.  And __GLIBC__ is not yet defined at this\n> point.\n> \n> However, we need to set _FILE_OFFSET_BITS for glibc somehow.\n> What is the best way to do so?\n\nI think the only way to do with this is to have the Makefile detect\nif -D_FILE_OFFSET_BITS=64 is required to be added to CFLAGS based on\nsome rule (e.g. uname output?), then add that to CFLAGS when needed.\n\nThis is one area where autoconf is nice, as you can compile\na thousand little C programs to see how the compiler reacts by\ndefault, and when you attempt to set this define, and then decide\nif you should include it or not.\n\nIt is also the part of autoconf that's not-so-nice... as it compiles\na thousand little C programs just to figure out how to compile the\nreal program.  ;-)\n\n-- \nShawn.\n"},{"id":"34866","messageId":"20070217104632.GF21842@admingilde.org","threadId":"6854","inReplyTo":"20070217094959.GH27864@spearce.org","subject":"Re: [PATCH] Support for large files on 32bit systems.","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2007-02-17T10:46:32Z","receivedAt":"2007-02-17T10:46:32Z","isPatch":true,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"hoi :)\n\nOn Sat, Feb 17, 2007 at 04:49:59AM -0500, Shawn O. Pearce wrote:\n> I think the only way to do with this is to have the Makefile detect\n> if -D_FILE_OFFSET_BITS=64 is required to be added to CFLAGS based on\n> some rule (e.g. uname output?), then add that to CFLAGS when needed.\n\nsomething like this?\n\n(I'm just testing it with a large data transfer, which will take some\ntime..., will report success later)\n\n+++\nSupport for large files on 32bit systems.\n\nGlibc uses the same size for int and off_t by default.\nIn order to support large pack sizes (>2GB) we force Glibc to a 64bit off_t.\n\nSigned-off-by: Martin Waitz <tali@admingilde.org>\n---\n Makefile |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ebecbbd..325c19f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -334,9 +334,11 @@ EXTLIBS = -lz\n \n ifeq ($(uname_S),Linux)\n \tNO_STRLCPY = YesPlease\n+\tBASIC_CFLAGS = -D_FILE_OFFSET_BITS=64\n endif\n ifeq ($(uname_S),GNU/kFreeBSD)\n \tNO_STRLCPY = YesPlease\n+\tBASIC_CFLAGS = -D_FILE_OFFSET_BITS=64\n endif\n ifeq ($(uname_S),Darwin)\n \tNEEDS_SSL_WITH_CRYPTO = YesPlease\n-- \n1.5.0.80.g42d14\n\n\n-- \nMartin Waitz\n"},{"id":"34867","messageId":"alpine.LRH.0.82.0702170830280.31945@xanadu.home","threadId":"6854","inReplyTo":"20070217094959.GH27864@spearce.org","subject":"Re: [PATCH] Support for large files on 32bit systems.","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-17T13:32:06Z","receivedAt":"2007-02-17T13:32:06Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Sat, 17 Feb 2007, Shawn O. Pearce wrote:\n\n> Martin Waitz <tali@admingilde.org> wrote:\n> > arg, this patch is completely broken.\n> > I tested it by setting the macro via the command line and the\n> > = is still left in there.  And __GLIBC__ is not yet defined at this\n> > point.\n> > \n> > However, we need to set _FILE_OFFSET_BITS for glibc somehow.\n> > What is the best way to do so?\n> \n> I think the only way to do with this is to have the Makefile detect\n> if -D_FILE_OFFSET_BITS=64 is required to be added to CFLAGS based on\n> some rule (e.g. uname output?), then add that to CFLAGS when needed.\n\nWhy not simply defining _FILE_OFFSET_BITS=64 unconditionally?\n\nIt certainly won't cause GIT to explode if compiled against something \nelse than glibc.\n\n\nNicolas\n"},{"id":"34975","messageId":"7vr6smc1de.fsf@assigned-by-dhcp.cox.net","threadId":"6854","inReplyTo":"alpine.LRH.0.82.0702170830280.31945@xanadu.home","subject":"Re: [PATCH] Support for large files on 32bit systems.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-19T02:44:29Z","receivedAt":"2007-02-19T02:44:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n>> I think the only way to do with this is to have the Makefile detect\n>> if -D_FILE_OFFSET_BITS=64 is required to be added to CFLAGS based on\n>> some rule (e.g. uname output?), then add that to CFLAGS when needed.\n>\n> Why not simply defining _FILE_OFFSET_BITS=64 unconditionally?\n>\n> It certainly won't cause GIT to explode if compiled against something \n> else than glibc.\n\nI like the simplicity of that approach.  Like this?\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 105ac28..dd5f369 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -1,6 +1,8 @@\n #ifndef GIT_COMPAT_UTIL_H\n #define GIT_COMPAT_UTIL_H\n \n+#define _FILE_OFFSET_BITS 64\n+\n #ifndef FLEX_ARRAY\n #if defined(__GNUC__) && (__GNUC__ < 3)\n #define FLEX_ARRAY 0\n"}]}