Subject: wu-ftpd-2.4.2-beta-18-vr13 fails on AIX 4.2.1 (fwd)

From: Gregory A Lundberg <[email-masked]>
Date: Fri, 12 Feb 1999 10:09:59 -0500 (EST)

Does anyone have any other suggestions?  Or an email address for the AIX
compiler support team at IBM?

-- 

Gregory A Lundberg		Senior Partner, VRnet Company
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195

---------- Forwarded message ----------
Date: Fri, 12 Feb 1999 16:00:51 +0100
From: Ole Holm Nielsen
Subject: wu-ftpd-2.4.2-beta-18-vr13 fails on AIX 4.2.1

Dear WU-FTPD maintainers,

I am reporting a serious bug in the wu-ftpd-2.4.2-beta-18-vr13
on AIX 4.2.1.  This is the same problem that was noted in 
FIXES-2.4.2-BETA-18-VR9:

> [email-masked] reports errors on AIX with malloc.
> [email-masked] confirms a problem in send_data().  This patch is
> experimental against VR8 to attempt to correct the problem.  I'm working
> on the supposition that the problem is data alignment; the 'blksize' is
> off_t and malloc() wants a size_t.  I've added a conversion step which
> should eliminate the problem.

The ftpd.c line 3919:

        size_t_blksize = blksize;

unfortunately doesn't fix the problem.  I have found that
size_t_blksize becomes 0 (zero) by this assignment, even
with an explicit (size_t) typecast.  This must be a compiler
bug, and even with "cc -g" the bug is still there.
I have no further ideas on how to correct the error.

I added this experimental code to verify the problem:
        char erbuf[256];
          ...
        size_t_blksize = blksize;
        if (size_t_blksize <= 0) {
            transflag = 0;
            sprintf (erbuf, "Local resource failure: size_t_blksize=%ld blksize=%ld", 
                size_t_blksize, blksize);
            perror_reply(451, erbuf);
            retrieve_is_data = 1;
            return (0);
        }

A short testing code does NOT exhibit this problem on AIX 4.2.1:
#include <sys/types.h>
#include <stdio.h> 
main() {
        off_t blksize;
        size_t size_t_blksize;
        blksize = 8192;
        size_t_blksize = blksize;
        printf ("blksize=%ld size_t_blksize=%ld\n", blksize, size_t_blksize);
}

WORKAROUNDS:

Either of the following makes the ftpd work correctly:

1. Use #undef THROUGHPUT in config.h.  This apparently makes
   the compiler generate correct code.

2. Compile with GCC:  In ./src go "make CC=gcc".

I have no further ideas on how to fool the AIX cc compiler into
generating correct code.  You should talk to real AIX experts
or submit the problem to IBM Support.

Our AIX C-compiler is xlC.C with the latest fixes at level 3.1.4.10.
We do not have the new compiler version 4.4.

With best regards,

Ole Holm Nielsen
Department of Physics, Building 307
Technical University of Denmark, DK-2800 Lyngby, Denmark