delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/07/02:38:46

From: "Juan Manuel Guerrero" <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
Organization: Darmstadt University of Technology
To: djgpp AT delorie DOT com
Date: Fri, 7 Jul 2000 08:34:02 +0200
MIME-Version: 1.0
Subject: A remark about unzip32
X-mailer: Pegasus Mail for Windows (v2.54DE)
Message-ID: <8C684AC7AE1@HRZ1.hrz.tu-darmstadt.de>
Reply-To: djgpp AT delorie DOT com

Unzip32 has an, in my opinion, somewhat "peculiar" algorithm
for truncating long file names into short file names on plain DOS.
The goal of this algorithm is to use as much as posible from
the 8.3 name space. For this purpose unzip32 checks if the
file name is more than 8 characters long *AND* if it has *NO* dot.
If this is true, it checks if there is an underscore (_) beyond
the 8-th character. If this is true the underscore will be replaced
by a dot. Of course, this converts everything beyond the underscore
(now a dot) into an *EXTENSION*. This means that a file *WITHOUT*
extension is converted into a file *WITH* extension.
Example:
  verylongfile_name
becomes:
  verylong.name

This algorithm breaks some scripts and makefiles.
I noticed this when i tried to run the testsuit of textutils 2.0
on MSDOS 6.22. I am makeing reference to txutl20s.zip.
I had unziped the package with unzip32 instead of djtar.
The check always breaks in the pr test. The reason is that the shell
script in the pr directory looks for the following long file name:
  tn2e5o3-t_tab
This name has been converted into:
  tn2e5o3-.tab 
by unzip32 instead of:
  tn2e5o3-

I had the sources of unzip532 available so I can
send a patch that shows were the difficulty is located.
The "bug" is in function map2fat in file unz532/msdos/msdos.c.
1) I know that this is not the appropiate place to send this
patch but the intention is to call your attention to this difficulty.
2) This patch shall only show where the bug is and not
fix it. The patch simply defines out the faulty part of the
function. This is probably a too crude approach.
3) I know that unzip32 is version 5.40 and not version 5.32
but the behaivior of both versions is the same.

If all this should already be known then ignore this message
and excuse the inconveniences caused.

Regards,
Guerrero, Juan M.

diff -apru10 alt/msdos.c neu/msdos.c
--- alt/msdos.c	Fri Oct 31 10:32:48 1997
+++ neu/msdos.c	Fri Jul  7 03:27:32 2000
@@ -629,34 +629,34 @@ static void map2fat(pathcomp, last_dot)
 /*---------------------------------------------------------------------------
     Case 1:  filename has no dot, so figure out if we should add one.  Note
     that the algorithm does not try to get too fancy:  if there are no dots
     already, the name either gets truncated at 8 characters or the last un-
     derscore is converted to a dot (only if more characters are saved that
     way).  In no case is a dot inserted between existing characters.
 
               GRR:  have problem if filename is volume label??
 
   ---------------------------------------------------------------------------*/
-
+#if 0
     if (last_dot == (char *)NULL) {   /* no dots:  check for underscores... */
         char *plu = strrchr(pathcomp, '_');   /* pointer to last underscore */
 
         if (plu == (char *)NULL) {  /* no dots, no underscores:  truncate at */
             if (pEnd > pathcomp+8)  /* 8 chars (could insert '.' and keep 11) */
                 *(pEnd = pathcomp+8) = '\0';
         } else if (MIN(plu - pathcomp, 8) + MIN(pEnd - plu - 1, 3) > 8) {
             last_dot = plu;       /* be lazy:  drop through to next if-block */
         } else if ((pEnd - pathcomp) > 8)    /* more fits into just basename */
             pathcomp[8] = '\0';    /* than if convert last underscore to dot */
         /* else whole thing fits into 8 chars or less:  no change */
     }
-
+#endif
 /*---------------------------------------------------------------------------
     Case 2:  filename has dot in it, so truncate first half at 8 chars (shift
     extension if necessary) and second half at three.
   ---------------------------------------------------------------------------*/
 
     if (last_dot != (char *)NULL) {   /* one dot (or two, in the case of */
         *last_dot = '.';              /*  "..") is OK:  put it back in */
 
         if ((last_dot - pathcomp) > 8) {
             char *p, *q;
@@ -1681,21 +1681,23 @@ void version(__G)
 
 #endif /* !WINDLL */
 #endif /* !SFX */
 
 
 
 
 
 #if (defined(__GO32__) || defined(__EMX__))
 
+#if ((__DJGPP__ = 2) && (__DJGPP_MINOR__ < 3))
 unsigned volatile _doserrno;
+#endif
 
 #if (!defined(__DJGPP__) || (__DJGPP__ < 2))
 
 unsigned _dos_getcountryinfo(void *countrybuffer)
 {
     asm("movl %0, %%edx": : "g" (countrybuffer));
     asm("movl $0x3800, %eax");
     asm("int $0x21": : : "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi");
     _doserrno = 0;
     asm("jnc 1f");

- Raw text -


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