nmh-workers
[Top] [All Lists]

Re: bug with mh 6.8.3 popd on BSD 4.4 (FreeBSD)

1995-12-07 18:01:01
    Mark Diekhans <markd(_at_)grizzly(_dot_)com> wrote:
    >mh 6.8.3 popd does not work on BSD 4.4 (FreeBSD) due to
    >the assumption that off_t is a long.

There were several fixes submitted for this.  How are
fseek() and ftell() defined on 64bit systems?  On my
Solaris 2.4 system, the offset in fseek and the return
value of ftell are of type "long".

The problem with MH on these systems is not related to fseek or ftell.
As far as I know ANSI or POSIX mandates that the arguments and return
type for the "offset" value for these functions be a "long", so NetBSD
(and I also assume BSD 4.4 and FreeBSD) leave the definitions of these
functions alone.  Since this limits the ability of these functions to
work on files < 2GB in size the functions fgetops() and fsetpos() have
been added, and these take an fpos_t* argument, so that the limitation
on < 2GB files can be removed.

The problem with MH on systems where off_t is 64 bits but long is 32
is (as far as we know) twofold:

1) support/pop/popser.c does not have a prototype for truncate()
   in scope when it is being used, and does not cast it's second
   argument.  Thus, the second argument by default becomes an
   int, and disaster strikes on systems where off_t != int (or
   long, for that matter).  The preferable solution is to import
   the proper prototype from the system header files, and is what
   the fix below does.

2) uip/dropsbr.c contains code which assumes that off_t is equal
   in size to a long.  The definition of mbx_read() defines the
   second argument as "register long", whereas the invocation of
   the mbx_read() function in map_write() casts that argument to
   off_t.  At the time I worked around this problem I didn't
   check all the other invocations of mbx_read(), and they seem
   to be in parts of the code we don't use.  We worked around it
   by changing the definition of mbx_read()'s second argument --
   on second thought that was probably not such a great idea, and
   instead the invocation in map_write() should be fixed (remove
   the cast of the second argument).


Regards,

- Håvard
*** support/pop/popser.c.old   Wed Dec  1 05:01:34 1993
--- support/pop/popser.c    Wed Jun 14 18:09:46 1995
***************
*** 21,26 ****
--- 21,29 ----
  #include "syslog.h"
  #include <sys/types.h>
  #include <sys/stat.h>
+ #ifdef UNISTD
+ #include <unistd.h>
+ #endif
  #ifdef KPOP
  #include <krb.h>
  #endif        /* KPOP */
<Prev in Thread] Current Thread [Next in Thread>