Re: 2.6.10 patches
On Mon, Dec 15, 2003 at 05:42:34PM -0600, Albert Chin wrote: 1. [include/post-config.h] Don't assume C++ compiler defines __STDC__. Applied. 2. [missing] Update to latest version from automake 1.7.9. I imagine anything from 1.7.x should be ok. I have removed these files from cvs, as they are part of automake: missing depcomp install-sh mkinstalldirs 3. [src/Makefile.am] Because we use libtool to build lftp, use $(LTLIBINTL) for the gettext libraries. Applied. 4. [src/ftpclass.cc, src/NetAccess.h, src/NetAccess.cc, src/FileAccess.cc, configure.ac, m4/socklen.m4] Ok, this was fun. On HP-UX 11i, we had to replace socklen_t with socktype_t which is defined to socklen_t if it exists or some appropriate definition otherwise. The problem is that sys/socket.h defines socklen_t but _uses_ it only when _XOPEN_SOURCE_EXTENDED is defined. And, we don't want to do this. So, the test fails, defining socklen_t to 'int' which generates a failure because of the 'typedef size_t socklen_t' entry in sys/socket.h. So, we work around this by coming up with a new name, socktype_t. I don't quite like it. The type name socktype_t is confusing. It should be possible to use socklen_t by: #include sys/types.h #include sys/socket.h #undef socklen_t #define socklen_t lftp_socklen_t in post-config.h. I like socklen_t because it is part of a standard (I don't remember which one). 5. [src/HttpDir.cc] Patch to build with HP C++ compiler. Already applied. 6. [m4/inttypes_h.m4, m4/mbstate_t.m4, m4/uintmax_t.m4, m4/stdint_h.m4, m4/human.m4] Rename some of these macros from jm_xxx to lftp_xxx. Because we use the result of these macros with C++, we should test for their existence with C++. We cannot use the jm_xxx versions because that conflicts with the versions from gettext. On Tru64 UNIX with the Compaq DTK compiler and the Compaq C++ complier, include files like inttypes.h and stdint.h differ depending on whether or not you're building with C or C++. I don't like this too. Most of the tests are used in C. If some system feature is tested for use in C and C++, there should be two tests which define different symbols. That is, don't change tests, just add new ones which define new symbols, then use these new symbols in C++. 7. [configure.ac] LOCALE_DIR no longer used. Applied. Thanks! -- Alexander.
Re: 2.6.10 patches
On Tue, Dec 16, 2003 at 03:04:35PM +0300, Alexander V. Lukyanov wrote: On Mon, Dec 15, 2003 at 05:42:34PM -0600, Albert Chin wrote: 4. [src/ftpclass.cc, src/NetAccess.h, src/NetAccess.cc, src/FileAccess.cc, configure.ac, m4/socklen.m4] Ok, this was fun. On HP-UX 11i, we had to replace socklen_t with socktype_t which is defined to socklen_t if it exists or some appropriate definition otherwise. The problem is that sys/socket.h defines socklen_t but _uses_ it only when _XOPEN_SOURCE_EXTENDED is defined. And, we don't want to do this. So, the test fails, defining socklen_t to 'int' which generates a failure because of the 'typedef size_t socklen_t' entry in sys/socket.h. So, we work around this by coming up with a new name, socktype_t. I don't quite like it. The type name socktype_t is confusing. It should be possible to use socklen_t by: #include sys/types.h #include sys/socket.h #undef socklen_t #define socklen_t lftp_socklen_t in post-config.h. I like socklen_t because it is part of a standard (I don't remember which one). How about lftp_socklen_t instead of socktype_t? 6. [m4/inttypes_h.m4, m4/mbstate_t.m4, m4/uintmax_t.m4, m4/stdint_h.m4, m4/human.m4] Rename some of these macros from jm_xxx to lftp_xxx. Because we use the result of these macros with C++, we should test for their existence with C++. We cannot use the jm_xxx versions because that conflicts with the versions from gettext. On Tru64 UNIX with the Compaq DTK compiler and the Compaq C++ complier, include files like inttypes.h and stdint.h differ depending on whether or not you're building with C or C++. I don't like this too. Most of the tests are used in C. If some system feature is tested for use in C and C++, there should be two tests which define different symbols. That is, don't change tests, just add new ones which define new symbols, then use these new symbols in C++. So should I add jm_cxx_xxx versions of the macros for C++ to m4/inttypes_h.m4, m4/mbstate_t.m4, m4/uintmax_t.m4, m4/stdint_h.m4, and m4/human.m4 and change the corresponding AM_DEFINE names? -- albert chin ([EMAIL PROTECTED])
Re: 2.6.10 patches
On Tue, Dec 16, 2003 at 06:18:15AM -0600, Albert Chin wrote: How about lftp_socklen_t instead of socktype_t? That's ok. So should I add jm_cxx_xxx versions of the macros for C++ to m4/inttypes_h.m4, m4/mbstate_t.m4, m4/uintmax_t.m4, m4/stdint_h.m4, and m4/human.m4 and change the corresponding AM_DEFINE names? Yes. I think jm stands for author initials, so it should probably be changed. But please don't add macros if the corresponding AM_DEFINE name is not used anywhere. -- Alexander.
Re: 2.6.10 patches
On Tue, Dec 16, 2003 at 03:04:35PM +0300, Alexander V. Lukyanov wrote: On Mon, Dec 15, 2003 at 05:42:34PM -0600, Albert Chin wrote: 7. [configure.ac] LOCALE_DIR no longer used. Applied. Sorry but the patch below is needed as well. I missed one use of this. Considering that locale files are installed to $(datadir)/locale by po/Makefile.in.in, we use that instead. If someone wants locale files in a different directory, --datadir=path. -- albert chin ([EMAIL PROTECTED]) -- snip snip --- src/Makefile.am.orig2003-12-15 11:40:32.0 -0600 +++ src/Makefile.am 2003-12-16 11:04:47.027341000 -0600 @@ -1,4 +1,4 @@ -localedir = @LOCALE_DIR@ +localedir = $(datadir)/locale pkgverlibdir = $(pkglibdir)/$(VERSION) bin_PROGRAMS = lftp
Re: 2.6.10 patches
On Tue, Dec 16, 2003 at 04:31:16PM +0300, Alexander V. Lukyanov wrote: On Tue, Dec 16, 2003 at 06:18:15AM -0600, Albert Chin wrote: How about lftp_socklen_t instead of socktype_t? That's ok. Ok, patch to use lftp_socklen_t below. -- albert chin ([EMAIL PROTECTED]) -- snip snip --- src/ftpclass.cc.orig2003-12-14 17:38:04.0 -0600 +++ src/ftpclass.cc 2003-12-16 11:45:52.475331000 -0600 @@ -111,7 +111,7 @@ if(sock==-1) return; int avail=-1; - socklen_t len=sizeof(avail); + lftp_socklen_t len=sizeof(avail); if(getsockopt(sock,SOL_SOCKET,SO_SNDBUF,(char*)avail,len)==-1) avail=-1; int buf=-1; @@ -191,7 +191,7 @@ { sockaddr_u d; sockaddr_u c; - socklen_t len; + lftp_socklen_t len; len=sizeof(d); if(dp) d=*dp; @@ -744,7 +744,7 @@ return 0; } - socklen_t len=sizeof(data_sa); + lftp_socklen_t len=sizeof(data_sa); getpeername(control_sock,data_sa.sa,len); if(data_sa.sa.sa_family==AF_INET) data_sa.in.sin_port=htons(port); @@ -1120,7 +1120,7 @@ const char *command=0; bool append_file=false; int res; - socklen_t addr_len; + lftp_socklen_t addr_len; unsigned char *a; unsigned char *p; automate_state oldstate; @@ -4108,7 +4108,7 @@ int buffer=0; if(TIOCOUTQ_returns_free_space) { - socklen_t len=sizeof(buffer); + lftp_socklen_t len=sizeof(buffer); if(getsockopt(data_sock,SOL_SOCKET,SO_SNDBUF,(char*)buffer,len)==-1) return 0; int avail=buffer; --- src/NetAccess.h.orig2003-12-14 17:38:38.0 -0600 +++ src/NetAccess.h 2003-12-16 11:45:05.210178000 -0600 @@ -67,7 +67,7 @@ static const char *SocketNumericAddress(const sockaddr_u *u); static int SocketPort(const sockaddr_u *u); - static socklen_t SocketAddrLen(const sockaddr_u *u); + static lftp_socklen_t SocketAddrLen(const sockaddr_u *u); static int SocketConnect(int fd,const sockaddr_u *u); int SocketCreate(int,int,int); int SocketCreateTCP(int); --- src/NetAccess.cc.orig 2003-12-14 17:38:53.0 -0600 +++ src/NetAccess.cc2003-12-16 11:45:21.600506000 -0600 @@ -184,7 +185,7 @@ return 0; } -socklen_t NetAccess::SocketAddrLen(const sockaddr_u *u) +lftp_socklen_t NetAccess::SocketAddrLen(const sockaddr_u *u) { if(u-sa.sa_family==AF_INET) return sizeof(u-in); --- src/FileAccess.cc.orig 2003-12-14 17:40:00.0 -0600 +++ src/FileAccess.cc 2003-12-16 11:45:11.200977000 -0600 @@ -208,7 +208,7 @@ #ifdef SO_ERROR char str[256]; int s_errno=0; - socklen_t len; + lftp_socklen_t len; errno=0; --- m4/socklen.m4.orig 2003-12-14 16:07:37.0 -0600 +++ m4/socklen.m4 2003-12-16 11:44:29.494493000 -0600 @@ -16,12 +16,13 @@ ], [ lftp_cv_socklen_t=yes +lftp_cv_socklen_t_equiv=socklen_t ]) AC_LANG_POP(C++) ]) AC_MSG_RESULT($lftp_cv_socklen_t) if test $lftp_cv_socklen_t = no; then - AC_MSG_CHECKING(for socklen_t equivalent) + AC_MSG_CHECKING([for socklen_t equivalent for socket functions]) AC_CACHE_VAL(lftp_cv_socklen_t_equiv, [ lftp_cv_socklen_t_equiv=int @@ -43,7 +44,7 @@ AC_LANG_POP(C++) ]) AC_MSG_RESULT($lftp_cv_socklen_t_equiv) - AC_DEFINE_UNQUOTED(socklen_t, $lftp_cv_socklen_t_equiv, -[type to use in place of socklen_t if not defined]) fi + AC_DEFINE_UNQUOTED(lftp_socklen_t, $lftp_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined]) ])
Re: 2.6.10 patches
On Tue, Dec 16, 2003 at 12:03:30PM -0600, Albert Chin wrote: Sorry but the patch below is needed as well. I missed one use of this. Applied. Thanks! -- Alexander.