{"thread":{"id":"12607","subject":"[PATCH v6] autoconf: Test FREAD_READS_DIRECTORIES","startedAt":"2008-03-09T20:44:04Z","lastAt":"2008-03-10T15:46:54Z","messageCount":4,"participants":["Michal Rokos","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":6,"patchTotal":null},"messages":[{"id":"71523","messageId":"200803092144.04440.michal.rokos@nextsoft.cz","threadId":"12607","inReplyTo":null,"subject":"[PATCH v6] autoconf: Test FREAD_READS_DIRECTORIES","fromName":"Michal Rokos","fromEmail":"michal.rokos@nextsoft.cz","sentAt":"2008-03-09T20:44:04Z","receivedAt":"2008-03-09T20:44:04Z","isPatch":true,"sender":{"key":"michal.rokos@nextsoft.cz","avatar":null},"body":"Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed \ndirectory.\n\nSigned-off-by: Michal Rokos <michal.rokos@nextsoft.cz>\nTested-by: Mike Ralphson <mike@abacus.co.uk>\n\ndiff --git a/config.mak.in b/config.mak.in\nindex 8e1cd5f..7868dfd 100644\n--- a/config.mak.in\n+++ b/config.mak.in\n@@ -46,4 +46,5 @@ NO_MKDTEMP=@NO_MKDTEMP@\n NO_ICONV=@NO_ICONV@\n OLD_ICONV=@OLD_ICONV@\n NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@\n+FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@\n SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@\ndiff --git a/configure.ac b/configure.ac\nindex 287149d..82584e9 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -327,6 +327,26 @@ else\n fi\n AC_SUBST(NO_C99_FORMAT)\n #\n+# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds\n+# when attempting to read from an fopen'ed directory.\n+AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],\n+ [ac_cv_fread_reads_directories],\n+[\n+AC_RUN_IFELSE(\n+\t[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],\n+\t\t[[char c;\n+\t\tFILE *f = fopen(\".\", \"r\");\n+\t\treturn f && fread(&c, 1, 1, f)]])],\n+\t[ac_cv_fread_reads_directories=no],\n+\t[ac_cv_fread_reads_directories=yes])\n+])\n+if test $ac_cv_fread_reads_directories = yes; then\n+\tFREAD_READS_DIRECTORIES=UnfortunatelyYes\n+else\n+\tFREAD_READS_DIRECTORIES=\n+fi\n+AC_SUBST(FREAD_READS_DIRECTORIES)\n+#\n # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()\n # or vsnprintf() return -1 instead of number of characters which would\n # have been written to the final string if enough space had been available.\n"},{"id":"71555","messageId":"7vy78rksk8.fsf@gitster.siamese.dyndns.org","threadId":"12607","inReplyTo":"200803092144.04440.michal.rokos@nextsoft.cz","subject":"Re: [PATCH v6] autoconf: Test FREAD_READS_DIRECTORIES","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-10T06:21:27Z","receivedAt":"2008-03-10T06:21:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Looks fine to me.  I was not keeping on an close eye on the discussion,\nhowever.  Can we have a list of platforms we saw success stories on, so\nthat I can mention them when I queue this?\n"},{"id":"71563","messageId":"200803100954.27898.michal.rokos@nextsoft.cz","threadId":"12607","inReplyTo":"7vy78rksk8.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v6] autoconf: Test FREAD_READS_DIRECTORIES","fromName":"Michal Rokos","fromEmail":"michal.rokos@nextsoft.cz","sentAt":"2008-03-10T08:54:27Z","receivedAt":"2008-03-10T08:54:27Z","isPatch":true,"sender":{"key":"michal.rokos@nextsoft.cz","avatar":null},"body":"On Monday 10 March 2008 07:21:27 Junio C Hamano wrote:\n> Looks fine to me.  I was not keeping on an close eye on the discussion,\n> however.  Can we have a list of platforms we saw success stories on, so\n> that I can mention them when I queue this?\n\nLinux 2.6.25-rc4 - FREAD_READS_DIRECTORIES=\nTested-by: Michal Rokos <michal.rokos@nextsoft.cz>\n\nHP-UX B.11.11 - FREAD_READS_DIRECTORIES=UnfortunatelyYes\nTested-by: Michal Rokos <michal.rokos@nextsoft.cz>\n\nHP-UX B.11.23 - FREAD_READS_DIRECTORIES=UnfortunatelyYes\nTested-by: Michal Rokos <michal.rokos@nextsoft.cz>\n\nAIX 5.3 - FREAD_READS_DIRECTORIES=UnfortunatelyYes\nTested-by: Mike Ralphson <mike@abacus.co.uk>\n\nTru64 V5.1 - FREAD_READS_DIRECTORIES=UnfortunatelyYes\nTested-by: Michal Rokos <michal.rokos@nextsoft.cz>\n\n-- \nMichal Rokos\n\nNextSoft s.r.o.\nVyskočilova 1/1410\n140 21 Praha 4\nphone:  +420 267 224 311\nfax:    +420 267 224 307\nmobile: +420 736 646 591\ne-mail: michal.rokos@nextsoft.cz\n"},{"id":"71594","messageId":"alpine.LSU.1.00.0803101645090.3975@racer.site","threadId":"12607","inReplyTo":"200803092144.04440.michal.rokos@nextsoft.cz","subject":"Re: [PATCH v6] autoconf: Test FREAD_READS_DIRECTORIES","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-10T15:46:54Z","receivedAt":"2008-03-10T15:46:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 9 Mar 2008, Michal Rokos wrote:\n\n> Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed \n> directory.\n> \n> Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>\n> Tested-by: Mike Ralphson <mike@abacus.co.uk>\n\nOkay, I just forced the stupid \"socket in -lc\" test to succeed, and now \nyour patch does exactly what it is supposed to on MinGW (it says that \nfopen()ed directories cannot be read).\n\nOf course, the building blocks are not in place, so I cannot compile on \nMinGW, but that is another issue.\n\nSo, you can readd my Tested-by: ;-)\n\nThanks,\nDscho\n"}]}