{"thread":{"id":"48436","subject":"[PATCH] sha1dc: fix for compiling on AIX using IBM XLC compiler","startedAt":"2018-05-09T11:27:45Z","lastAt":"2018-05-10T23:32:41Z","messageCount":4,"participants":["jens persson","Ævar Arnfjörð Bjarmason","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"347068","messageId":"CAEoyyNJPZXUKi3W=Gs=3v8i4YnTL47G9oaHDoV5pvCLx78jUVQ@mail.gmail.com","threadId":"48436","inReplyTo":null,"subject":"[PATCH] sha1dc: fix for compiling on AIX using IBM XLC compiler","fromName":"jens persson","fromEmail":"jens@persson.cx","sentAt":"2018-05-09T11:27:21Z","receivedAt":"2018-05-09T11:27:45Z","isPatch":true,"sender":{"key":"jens@persson.cx","avatar":null},"body":"Hello, first patch. I'm having trouble compiling on AIX using IBMs\ncompiler, leading to\nunusable binaries. The following patch solved the problem for 2.17.0.\nThe patch below is cut&pasted via gmail to allow for firewalls, but\nexists in an unmolested form on github:\nhttps://github.com/MrShark/git/commit/44bfcaca6637e24548ec06f46fb6035a846b14af\n\nBest regards\n/jp\n\nBuilding on AIX using XLC every checkout gives an error:\nfatal: pack is corrupted (SHA1 mismatch)\nfatal: index-pack failed\n\nBack tracking it was introduced in 2.13.2, most likely in [1]\n\nAdd a #ifdef guard based on macros defined at [2] and [3].\n\nShould perhaps __xlc__ should should be changed to or combined with _AIX\nbased on the behavour of GCC on AIX or XL C on Linux.\n\n1. https://github.com/git/git/commit/6b851e536b05e0c8c61f77b9e4c3e7cedea39ff8\n2. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/macros_platform.html\n3. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/xlmacros.html\n\nSigned-off-by: jens persson <jens@persson.cx>\n---\n sha1dc/sha1.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sha1dc/sha1.c b/sha1dc/sha1.c\nindex 25eded139..68a8a0180 100644\n--- a/sha1dc/sha1.c\n+++ b/sha1dc/sha1.c\n@@ -84,7 +84,7 @@\n /* Not under GCC-alike or glibc or *BSD or newlib */\n #elif (defined(__ARMEB__) || defined(__THUMBEB__) ||\ndefined(__AARCH64EB__) || \\\n        defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \\\n-       defined(__sparc))\n+       defined(__sparc) || (defined(__powerpc) && defined(__xlc__)))\n /*\n  * Should define Big Endian for a whitelist of known processors. See\n  * https://sourceforge.net/p/predef/wiki/Endianness/ and\n-- \n2.11.0\n\n-- \njens persson\n<jens@persson.cx>\nMäster Olofsväg 24\nS-224 66 LUND;SWEDEN\n"},{"id":"347070","messageId":"87603xxc3k.fsf@evledraar.gmail.com","threadId":"48436","inReplyTo":"CAEoyyNJPZXUKi3W=Gs=3v8i4YnTL47G9oaHDoV5pvCLx78jUVQ@mail.gmail.com","subject":"Re: [PATCH] sha1dc: fix for compiling on AIX using IBM XLC compiler","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-05-09T12:11:43Z","receivedAt":"2018-05-09T12:11:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, May 09 2018, jens persson wrote:\n\n> Hello, first patch. I'm having trouble compiling on AIX using IBMs\n> compiler, leading to\n> unusable binaries. The following patch solved the problem for 2.17.0.\n> The patch below is cut&pasted via gmail to allow for firewalls, but\n> exists in an unmolested form on github:\n> https://github.com/MrShark/git/commit/44bfcaca6637e24548ec06f46fb6035a846b14af\n>\n> Best regards\n> /jp\n>\n> Building on AIX using XLC every checkout gives an error:\n> fatal: pack is corrupted (SHA1 mismatch)\n> fatal: index-pack failed\n>\n> Back tracking it was introduced in 2.13.2, most likely in [1]\n>\n> Add a #ifdef guard based on macros defined at [2] and [3].\n>\n> Should perhaps __xlc__ should should be changed to or combined with _AIX\n> based on the behavour of GCC on AIX or XL C on Linux.\n>\n> 1. https://github.com/git/git/commit/6b851e536b05e0c8c61f77b9e4c3e7cedea39ff8\n> 2. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/macros_platform.html\n> 3. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/xlmacros.html\n>\n> Signed-off-by: jens persson <jens@persson.cx>\n> ---\n>  sha1dc/sha1.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c\n> index 25eded139..68a8a0180 100644\n> --- a/sha1dc/sha1.c\n> +++ b/sha1dc/sha1.c\n> @@ -84,7 +84,7 @@\n>  /* Not under GCC-alike or glibc or *BSD or newlib */\n>  #elif (defined(__ARMEB__) || defined(__THUMBEB__) ||\n> defined(__AARCH64EB__) || \\\n>         defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \\\n> -       defined(__sparc))\n> +       defined(__sparc) || (defined(__powerpc) && defined(__xlc__)))\n>  /*\n>   * Should define Big Endian for a whitelist of known processors. See\n>   * https://sourceforge.net/p/predef/wiki/Endianness/ and\n\nThis patch looks sane to me, but we don't manage this software but\ninstead try to pull it as-is from upstream at\nhttps://github.com/cr-marcstevens/sha1collisiondetection\n\nWhich we could apply this, it would be much better if you could submit a\npull request with this to upstream, and then we can update our copy as I\ndid in e.g. 9936c1b52a (\"sha1dc: update from upstream\", 2017-07-01).\n"},{"id":"347122","messageId":"20180509183008.GL10348@aiede.svl.corp.google.com","threadId":"48436","inReplyTo":"87603xxc3k.fsf@evledraar.gmail.com","subject":"Re: [PATCH] sha1dc: fix for compiling on AIX using IBM XLC compiler","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-05-09T18:30:08Z","receivedAt":"2018-05-09T18:30:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+cc: Marc Stevens)\nÆvar Arnfjörð Bjarmason wrote:\n> On Wed, May 09 2018, jens persson wrote:\n\n>> Hello, first patch. I'm having trouble compiling on AIX using IBMs\n>> compiler, leading to\n>> unusable binaries. The following patch solved the problem for 2.17.0.\n>> The patch below is cut&pasted via gmail to allow for firewalls, but\n>> exists in an unmolested form on github:\n>> https://github.com/MrShark/git/commit/44bfcaca6637e24548ec06f46fb6035a846b14af\n>>\n>> Best regards\n>> /jp\n\nThanks for the patch.\n\n>> Building on AIX using XLC every checkout gives an error:\n>> fatal: pack is corrupted (SHA1 mismatch)\n>> fatal: index-pack failed\n>>\n>> Back tracking it was introduced in 2.13.2, most likely in [1]\n>>\n>> Add a #ifdef guard based on macros defined at [2] and [3].\n>>\n>> Should perhaps __xlc__ should should be changed to or combined with _AIX\n>> based on the behavour of GCC on AIX or XL C on Linux.\n>>\n>> 1. https://github.com/git/git/commit/6b851e536b05e0c8c61f77b9e4c3e7cedea39ff8\n>> 2. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/macros_platform.html\n>> 3. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/xlmacros.html\n>>\n>> Signed-off-by: jens persson <jens@persson.cx>\n>> ---\n>>  sha1dc/sha1.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c\n>> index 25eded139..68a8a0180 100644\n>> --- a/sha1dc/sha1.c\n>> +++ b/sha1dc/sha1.c\n>> @@ -84,7 +84,7 @@\n>>  /* Not under GCC-alike or glibc or *BSD or newlib */\n>>  #elif (defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \\\n>>         defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \\\n>> -       defined(__sparc))\n>> +       defined(__sparc) || (defined(__powerpc) && defined(__xlc__)))\n\nI wonder if there's a simpler way to detect this.\n\n__powerpc seems orthogonal to the goal, since there are little-endian\npowerpc machines.\n\nIt appears that XLC defines _BIG_ENDIAN on big-endian machines.  I\nwonder if we should do\n\n #elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)\n  ... as today ...\n #elif !defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)\n # define SHA1DC_BIGENDIAN\n #elif !defined(_BYTE_ORDER) && !defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)\n  /* little endian. */\n #else\n  ...\n\nIt also seems to me that Git should enable the #error in the\nfallthrough case.  The test suite would catch this kind of problem but\nit does not seem that everyone runs the test suite, so a compiler\nerror is more robust.  Is there a #define we can set to enable that?\n\n>>  /*\n>>   * Should define Big Endian for a whitelist of known processors. See\n>>   * https://sourceforge.net/p/predef/wiki/Endianness/ and\n>\n> This patch looks sane to me, but we don't manage this software but\n> instead try to pull it as-is from upstream at\n> https://github.com/cr-marcstevens/sha1collisiondetection\n>\n> Which we could apply this, it would be much better if you could submit a\n> pull request with this to upstream, and then we can update our copy as I\n> did in e.g. 9936c1b52a (\"sha1dc: update from upstream\", 2017-07-01).\n\nThanks,\nJonathan\n"},{"id":"347319","messageId":"20180510233226.GA125677@aiede.svl.corp.google.com","threadId":"48436","inReplyTo":"20180509183008.GL10348@aiede.svl.corp.google.com","subject":"Re: [PATCH] sha1dc: fix for compiling on AIX using IBM XLC compiler","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-05-10T23:32:26Z","receivedAt":"2018-05-10T23:32:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(cc-ing Marc Stevens for real this time. Sorry for the noise)\nÆvar Arnfjörð Bjarmason wrote:\n> On Wed, May 09 2018, jens persson wrote:\n\n>> Hello, first patch. I'm having trouble compiling on AIX using IBMs\n>> compiler, leading to\n>> unusable binaries. The following patch solved the problem for 2.17.0.\n>> The patch below is cut&pasted via gmail to allow for firewalls, but\n>> exists in an unmolested form on github:\n>> https://github.com/MrShark/git/commit/44bfcaca6637e24548ec06f46fb6035a846b14af\n>>\n>> Best regards\n>> /jp\n\nThanks for the patch.\n\n>> Building on AIX using XLC every checkout gives an error:\n>> fatal: pack is corrupted (SHA1 mismatch)\n>> fatal: index-pack failed\n>>\n>> Back tracking it was introduced in 2.13.2, most likely in [1]\n>>\n>> Add a #ifdef guard based on macros defined at [2] and [3].\n>>\n>> Should perhaps __xlc__ should should be changed to or combined with _AIX\n>> based on the behavour of GCC on AIX or XL C on Linux.\n>>\n>> 1. https://github.com/git/git/commit/6b851e536b05e0c8c61f77b9e4c3e7cedea39ff8\n>> 2. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/macros_platform.html\n>> 3. https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/xlmacros.html\n>>\n>> Signed-off-by: jens persson <jens@persson.cx>\n>> ---\n>>  sha1dc/sha1.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c\n>> index 25eded139..68a8a0180 100644\n>> --- a/sha1dc/sha1.c\n>> +++ b/sha1dc/sha1.c\n>> @@ -84,7 +84,7 @@\n>>  /* Not under GCC-alike or glibc or *BSD or newlib */\n>>  #elif (defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \\\n>>         defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \\\n>> -       defined(__sparc))\n>> +       defined(__sparc) || (defined(__powerpc) && defined(__xlc__)))\n\nI wonder if there's a simpler way to detect this.\n\n__powerpc seems orthogonal to the goal, since there are little-endian\npowerpc machines.\n\nIt appears that XLC defines _BIG_ENDIAN on big-endian machines.  I\nwonder if we should do\n\n #elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)\n  ... as today ...\n #elif !defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)\n # define SHA1DC_BIGENDIAN\n #elif !defined(_BYTE_ORDER) && !defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)\n  /* little endian. */\n #else\n  ...\n\nIt also seems to me that Git should enable the #error in the\nfallthrough case.  The test suite would catch this kind of problem but\nit does not seem that everyone runs the test suite, so a compiler\nerror is more robust.  Is there a #define we can set to enable that?\n\n>>  /*\n>>   * Should define Big Endian for a whitelist of known processors. See\n>>   * https://sourceforge.net/p/predef/wiki/Endianness/ and\n>\n> This patch looks sane to me, but we don't manage this software but\n> instead try to pull it as-is from upstream at\n> https://github.com/cr-marcstevens/sha1collisiondetection\n>\n> Which we could apply this, it would be much better if you could submit a\n> pull request with this to upstream, and then we can update our copy as I\n> did in e.g. 9936c1b52a (\"sha1dc: update from upstream\", 2017-07-01).\n\nThanks,\nJonathan\n"}]}