Bug 1386 - OpenSSH 4.7p1 compile error in atomicio.c under Tru64 4.0f
Summary: OpenSSH 4.7p1 compile error in atomicio.c under Tru64 4.0f
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: -current
Hardware: Alpha Tru64
: P2 major
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2007-10-31 22:46 AEDT by Scott McAskill
Modified: 2008-07-22 12:20 AEST (History)
3 users (show)

See Also:


Attachments
Output of ./configure and make (70.94 KB, text/plain)
2007-10-31 22:46 AEDT, Scott McAskill
no flags Details
Comment out poll pars (712 bytes, patch)
2007-11-01 03:47 AEDT, Darren Tucker
no flags Details | Diff
Include sys/poll.h in atomicio.c (482 bytes, patch)
2007-11-01 03:56 AEDT, Darren Tucker
no flags Details | Diff
Add readv() declarations to configure and openbsd-compat (1.31 KB, patch)
2007-11-01 04:47 AEDT, Darren Tucker
no flags Details | Diff
Output of ./configure --with-cflags=-DHAVE_DECL_READV=0 and make (23.29 KB, text/plain)
2007-11-02 03:28 AEDT, Scott McAskill
no flags Details
remove const for test purposes (632 bytes, patch)
2007-11-02 06:28 AEDT, Darren Tucker
no flags Details | Diff
#ifdef out poll() in atomiciov (831 bytes, patch)
2008-06-14 10:49 AEST, Darren Tucker
no flags Details | Diff
Output from configure and make after applying patch (71.06 KB, text/plain)
2008-06-18 04:12 AEST, Scott McAskill
no flags Details
Output from configure and make after applying patch (71.06 KB, text/plain)
2008-06-18 04:14 AEST, Scott McAskill
no flags Details
#ifdef out the readv poll() calls on Tru64 (1.40 KB, patch)
2008-06-29 04:40 AEST, Darren Tucker
djm: ok+
Details | Diff
Configure from 5.0p1 rebuilt with patch #1534. (86.16 KB, application/octet-stream)
2008-06-29 04:42 AEST, Darren Tucker
no flags Details
Output from configure and make (71.12 KB, text/plain)
2008-07-11 00:35 AEST, Scott McAskill
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott McAskill 2007-10-31 22:46:44 AEDT
Created attachment 1373 [details]
Output of ./configure and make

Compilation of OpenSSH 4.7p1 fails under Tru64 4.0f. See error below. Full output of ./configure and make are attached.

.
.
.
cc: Error: atomicio.c, line 101: In this statement, "f" and "readv" cannot be compared for equality or inequality. (noequality)
	pfd.events = f == readv ? POLLIN : POLLOUT;
---------------------^
*** Exit 1
Stop.
Comment 1 Darren Tucker 2007-11-01 03:47:06 AEDT
Created attachment 1374 [details]
Comment out poll pars

Is the readv function call defined in any of the header files and if so, which one?

The poll is an optimization which you can do without, the attached patch should let it build for you.  I'd prefer to make it work properly, though.
Comment 2 Darren Tucker 2007-11-01 03:56:50 AEDT
Created attachment 1375 [details]
Include sys/poll.h in atomicio.c

Here's something else that's worth a try: it includes <sys/poll.h> on platforms that don't have <poll.h>.  Not sure if that includes Tru64, though.
Comment 3 Scott McAskill 2007-11-01 04:29:40 AEDT
readv is not defined in any header files. The only reference to readv is a comment in atomicio.h:


#ifndef _ATOMICIO_H
#define _ATOMICIO_H

/*
 * Ensure all of data on socket comes through. f==read || f==vwrite
 */
size_t	atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);

#define vwrite (ssize_t (*)(int, void *, size_t))write

/*
 * ensure all of data on socket comes through. f==readv || f==writev
 */
size_t	atomiciov(ssize_t (*)(int, const struct iovec *, int),
    int, const struct iovec *, int);

#endif /* _ATOMICIO_H */


I'll give both patches a try and let you know.
Comment 4 Darren Tucker 2007-11-01 04:47:47 AEDT
Created attachment 1376 [details]
Add readv() declarations to configure and openbsd-compat

That makes sense, I believe that it is common in older 4.2BSD based systems to have readv and writev but not have any prototypes for them.

Please try this patch instead of the other two.  You will either need to run "autoreconf" from autoconf 2.61 and re-run configure, or fake it by running "./configure --with-cflags=-DHAVE_DECL_READV=0".
Comment 5 Scott McAskill 2007-11-02 03:28:43 AEDT
Created attachment 1377 [details]
Output of ./configure --with-cflags=-DHAVE_DECL_READV=0 and make
Comment 6 Scott McAskill 2007-11-02 03:31:15 AEDT
Applied the patch (Add readv() declarations to configure and openbsd-compat), but received new error (full output attached):

.
.
.
cc -std -g -DHAVE_DECL_READV=0  -I. -I. -I/usr/local/ssl/include  -DSSHDIR=\"/usr/local/etc\"  -D_PATH_SSH_PROGRAM=\"/usr/local/bin/ssh\"  -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/libexec/ssh-askpass\"  -D_PATH_SFTP_SERVER=\"/usr/local/libexec/sftp-server\"  -D_PATH_SSH_KEY_SIGN=\"/usr/local/libexec/ssh-keysign\"  -D_PATH_SSH_PIDDIR=\"/var/run\"  -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\"  -DSSH_RAND_HELPER=\"/usr/local/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H -c moduli.c
cc: Error: openbsd-compat/openbsd-compat.h, line 137: In this declaration, the type of "readv" is not compatible with the type of a previous declaration of "readv" at line number 141 in file /usr/include/sys/uio.h. (notcompat)
int readv(int, struct iovec *, int);
----^
*** Exit 1
Stop.
Comment 7 Darren Tucker 2007-11-02 03:39:45 AEDT
Oh, you have readv in sys/uio.h.  What is it declared as?  I'm suspecting it's type mismatch (ssize_t vs int).  If so, I'm not quite sure what to do about it.

Also, for comparison, what's read() declared as?
Comment 8 Scott McAskill 2007-11-02 04:38:16 AEDT
I think your're right. Here's a snippet from /usr/include/sys/uio.h. read() is declared in /usr/include/unistd.h as int
.
.
.
#if defined(_XOPEN_SOURCE_EXTENDED) && !defined(_LIBC_POLLUTION_H_)
#ifdef __DECC
#pragma extern_prefix "_E"
#else
#define readv(__a,__b,__c) _Ereadv(__a,__b,__c)
#define writev(__a,__b,__c) _Ewritev(__a,__b,__c)
#endif
#endif /* _XOPEN_SOURCE_EXTENDED && !_LIBC_POLLUTION_H_ */

#ifdef _XOPEN_SOURCE_EXTENDED
extern ssize_t __R(readv) __((int, const struct iovec *, int));
extern ssize_t __R(writev) __((int, const struct iovec *, int));
#else
extern ssize_t readv __((int, struct iovec *, int));
extern ssize_t writev __((int, struct iovec *, int));
#endif /* _XOPEN_SOURCE_EXTENDED */
.
.
.
Comment 9 Darren Tucker 2007-11-02 06:28:50 AEDT
Created attachment 1378 [details]
remove const for test purposes

They're both ssize_t but it might be const vs no const if _XOPEN_SOURCE_EXTENDED not defined, it seems to not be.

Could you please try this to confirm?  It's not a proper fix, though (and if this is the problem I'm not really sure what the proper fix is).
Comment 10 Scott McAskill 2007-11-03 05:58:27 AEDT
I applied the last patch, but compilation failed (see below). On a lark, I used atomicio.c from the 4.6p1 distribution and compilation completed OK. If I install this "hybrid" build, will I have broken anything?

.
.
.
cc -std -g  -I. -I. -I/usr/local/ssl/include  -DSSHDIR=\"/usr/local/etc\"  -D_PATH_SSH_PROGRAM=\"/usr/local/bin/ssh\"  -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/libexec/ssh-askpass\"  -D_PATH_SFTP_SERVER=\"/usr/local/libexec/sftp-server\"  -D_PATH_SSH_KEY_SIGN=\"/usr/local/libexec/ssh-keysign\"  -D_PATH_SSH_PIDDIR=\"/var/run\"  -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\"  -DSSH_RAND_HELPER=\"/usr/local/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H -c atomicio.c
cc: Warning: atomicio.c, line 85: In this declaration, parameter 2 has a different type than specified in an earlier declaration of this function. (mismatparam)
atomiciov(ssize_t (*f) (int, struct iovec *, int), int fd,
--------------------^
cc: Warning: atomicio.c, line 85: In this declaration, parameter 1 has a different type than specified in an earlier declaration of this function. (mismatparam)
atomiciov(ssize_t (*f) (int, struct iovec *, int), int fd,
^
cc: Error: atomicio.c, line 85: In this declaration, the type of "atomiciov" is not compatible with the type of a previous declaration of "atomiciov" at line number 42 in file atomicio.h. (notcompat)
atomiciov(ssize_t (*f) (int, struct iovec *, int), int fd,
^
*** Exit 1
Stop.
Comment 11 Darren Tucker 2007-11-03 06:59:01 AEDT
(In reply to comment #10)
> I applied the last patch, but compilation failed (see below).

Thanks, I will look at that as soon.

> On a
> lark, I used atomicio.c from the 4.6p1 distribution and compilation
> completed OK. If I install this "hybrid" build, will I have broken
> anything?

Your hybrid should work fine, it just won't be as efficient as a vanilla 4.7p1.  You can run the regression tests "make tests" to validate it.
Comment 12 Robert Lerche 2008-05-29 11:12:46 AEST
I just tried to build openssh 5.0p1 on a tru64 system and encountered the same problem (and the same fix -- grab atomicio.c from 4.6p1) appeared to work).  Can I assume that this is still valid (i.e., doesn't cause a problem)?  Thanks.
Comment 13 Darren Tucker 2008-06-14 10:33:59 AEST
(In reply to comment #12)
> I just tried to build openssh 5.0p1 on a tru64 system and encountered
> the same problem (and the same fix -- grab atomicio.c from 4.6p1)
> appeared to work).  Can I assume that this is still valid (i.e.,
> doesn't cause a problem)?  Thanks.

Using the old atomicio.c is still fine (although potentially not quite as efficient).

If we can't get the compat code to work I'd like to add an ifdef.
Comment 14 Darren Tucker 2008-06-14 10:49:11 AEST
Created attachment 1520 [details]
#ifdef out poll() in atomiciov

Could you please try this patch on top of OpenSSH 5.0p1?

Thanks.
Comment 15 Darren Tucker 2008-06-14 11:01:04 AEST
Target 5.1 (assuming we can make it work :-)
Comment 16 Scott McAskill 2008-06-18 04:12:08 AEST
Created attachment 1532 [details]
Output from configure and make after applying patch

make still fails with error:
 
cc: Error: atomicio.c, line 106: In this statement, "f" and "readv" cannot be compared for equality or inequality. (noequality)
	pfd.events = f == readv ? POLLIN : POLLOUT;
---------------------^
*** Exit 1
Stop.
Comment 17 Scott McAskill 2008-06-18 04:14:57 AEST
Created attachment 1533 [details]
Output from configure and make after applying patch

make still fails with error:
 
cc: Error: atomicio.c, line 106: In this statement, "f" and "readv" cannot be compared for equality or inequality. (noequality)
	pfd.events = f == readv ? POLLIN : POLLOUT;
---------------------^
*** Exit 1
Stop.
Comment 18 Darren Tucker 2008-06-29 04:40:40 AEST
Created attachment 1534 [details]
#ifdef out the readv poll() calls on Tru64

OK, I give up trying do to it the clean way.

Please try this one.  Note that you will either need to run "autoreconf" to rebuild configure, or download the premade configure which I will upload shortly.

We've got to run out of wrong ways to do this eventually, right?

If someone is sufficiently motivated this could be made into a proper build-time configure test.
Comment 19 Darren Tucker 2008-06-29 04:42:06 AEST
Created attachment 1535 [details]
Configure from 5.0p1 rebuilt with patch #1534.
Comment 20 Damien Miller 2008-07-04 14:20:53 AEST
Hi Scott,

We are about to close accepting patches for the openssh-5.1 release, but we would love to get this one verified and submitted so it will make the cut. Could you please apply the patch from comment #18 and configure from comment #19 and tell us if they solve your problem?
Comment 21 Damien Miller 2008-07-05 09:37:33 AEST
Patch applied. Please reopen this bug if it fails to fix the problem.
Comment 22 Scott McAskill 2008-07-11 00:35:37 AEST
Created attachment 1545 [details]
Output from configure and make

I applied the patches to atomicio.c and configure.ac and ran the new configure script. This failed because of an extraneous ")" at line 9924. After removing the extraneous ")", configure ran OK but make failed:

cc: Error: atomicio.c, line 106: In this statement, "f" and "readv" cannot be compared for equality or inequality. (noequality)
	pfd.events = f == readv ? POLLIN : POLLOUT;
---------------------^
*** Exit 1
Comment 23 Damien Miller 2008-07-11 14:32:42 AEST
Thanks for testing again.

Applying the patch to configure.ac is insufficient, you need to either regenerate configure (using GNU autoconf) or use the prebuild one in attachement #1535.

Alternately, you could also try a 5.1 prerelease snapshot from http://www.mindrot.org/openssh_snap - these have the patch committed already.
Comment 24 Darren Tucker 2008-07-13 21:47:54 AEST
Did the modified configure define BROKEN_READV_COMPARISON in config.h?  That's where the it should end up.

If it doesn't does adding "#define BROKEN_READV_COMPARISON 1" to config.h make if compile?
Comment 25 Damien Miller 2008-07-22 12:20:16 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1