delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/08/07:43:10

From: "Juan Manuel Guerrero" <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
Organization: Darmstadt University of Technology
To: djgpp-workers AT delorie DOT com
Date: Mon, 8 May 2000 13:51:13 +0200
MIME-Version: 1.0
Subject: bug in sort.exe (Textutils-2.0)
X-mailer: Pegasus Mail for Windows (v2.54DE)
Message-ID: <32BA4DC6E6A@HRZ1.hrz.tu-darmstadt.de>
Reply-To: djgpp-workers AT delorie DOT com

There is a bug in sort.exe that inhibits its use under plain DOS.
This bug concerns the file name generation for temporary files.

This is a quote of sort.c, line #46-#50:
  #if HAVE_PATHCONF && defined _PC_NAME_MAX
  # define NAME_MAX_IN_DIR(Dir) pathconf (Dir, _PC_NAME_MAX)
  #else
  # define NAME_MAX_IN_DIR(Dir) 255
  #endif

The HAVE_PATHCONF macro seems to have some "guard" function.
But the HAVE_PATHCONF macro is *never* defined by the configure script
nor somewhere else. This implies that the above AND relation will *always*
be false no matter if _PC_NAME_MAX from unistd.h is defined or not.
The consequence is that NAME_MAX_IN_DIR is *always* 255 no matter
if LFN support is available or not.

In my opinion there are at least 4 posibilities:
1) HAVE_PATHCONF is completely superflous and can be deleted.
   The above line can be replaced by:
     #if defined _PC_NAME_MAX

2) The && (AND operation) should is replaced by || (OR operation).
   The above line can be replaced by:
     #if HAVE_PATHCONF || defined _PC_NAME_MAX

3) This is a quote from system.h, line #94 - line #97
     #ifdef HAVE_UNISTD_H
     # include <unistd.h>
     #endif

   This can be replaced by:
     #ifdef HAVE_UNISTD_H
     # include <unistd.h>
     # ifdef _PC_NAME_MAX
     #  define HAVE_PATHCONF
     # endif
     #endif

4) Add some code to configure.in that will check for a header that contains
   _PC_NAME_MAX and if found it defines HAVE_PATHCONF.

I don't know if a similar bug appears in all other binaries of Textutil-2.0.
but this should be checked.
I am not familiar with the Textutil sources so there will be no patch. Sorry.

Regards,
Guerrero, Juan M.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019