From owner-freebsd-current@FreeBSD.ORG Mon Sep 1 13:12:00 2008 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB1D81065674 for ; Mon, 1 Sep 2008 13:12:00 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from capeta.freebsdbrasil.com.br (capeta.freebsdbrasil.com.br [201.48.151.3]) by mx1.freebsd.org (Postfix) with SMTP id C9F758FC21 for ; Mon, 1 Sep 2008 13:11:59 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: (qmail 84712 invoked from network); 1 Sep 2008 09:45:18 -0300 Received: by simscan 1.1.0 ppid: 84292, pid: 84329, t: 14.2356s scanners: clamav: 0.91.1/m: spam: 3.1.1 X-Spam-Checker-Version: SpamAssassin: -last, FreeBSD Brasil LTDA rulesets: Yes X-Spam-Status: No, hits=-1.9 required=3.7 Received: from unknown (HELO botelhor.bluepex.com) (garga@189.19.84.134) by capeta.freebsdbrasil.com.br with SMTP; 1 Sep 2008 09:45:03 -0300 Received: (qmail 27089 invoked by uid 1001); 1 Sep 2008 09:46:28 -0300 Date: Mon, 1 Sep 2008 09:46:28 -0300 From: Renato Botelho To: freebsd-current@FreeBSD.org Message-ID: <20080901124627.GC13194@bluepex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: [mgleason@ncftp.com: Re: [wxs@FreeBSD.org: Re: cvs commit: ports/ftp/ncftp3 pkg-plist]] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 13:12:00 -0000 Can anyone take a look at this problem happened with ncftp3 at 8.0-CURRENT, i'm just wondering if it could or not happen with other port(s). Thanks ----- Forwarded message from Mike Gleason ----- Date: Sun, 31 Aug 2008 18:51:24 -0500 From: Mike Gleason To: Renato Botelho Cc: wxs@FreeBSD.org, obrien@FreeBSD.org Subject: Re: [wxs@FreeBSD.org: Re: cvs commit: ports/ftp/ncftp3 pkg-plist] X-Mailer: Apple Mail (2.926) OK, I have a workaround for this problem. However, I believe there is a bug in the 8.0-CURRENT version of select(), which is returning an incorrect number of ready descriptors. This bug does not occur on 7.0- RELEASE. NcFTP's sio library function, _SConnect, wants to select() for one descriptor. It creates fd_set structures for writeable fds and exception fds, with each fd set having only one bit set corresponding to the single descriptor it is selecting. Select() then returns 2, rather than 1. NcFTP was essentially checking if select returned 1, and if so, OK, if not 1, error. Since 2 was returned, this was causing the problem that Renato reported. If a descriptor was both writeable and exceptioned, I suppose that select could count that descriptor twice (I'm not sure what the official semantics are). In that scenario, select could return 2, so regardless of any select bug, NcFTP will now check to see if a value greater than or equal to 1 is returned, rather than simply checking for equality to 1 (and this is the first patch for NcFTP 3.2.x appended below). However, there is still a problem in select() somewhere, since as you can see below, select() returns 2, but according to the resulting fd_sets, only the writeable fd_set has my fd. It should either return 1, or have the fd set in both the writers and exceptions fd_sets. (The second patch adds these debug prints, if you want to reproduce this.) > ./bin/ncftpls ftp://ftp.freebsd.org/pub/ fd 3 is set in writers fd 3 is set in exceptions select = 2 fd 3 is set in writers Mike Gleason NcFTP Software http://www.NcFTP.com diff -wurd ncftp-3.2.2/sio/SConnect.c ncftp-3.2.2-WORKAROUND/sio/ SConnect.c --- ncftp-3.2.2/sio/SConnect.c 2007-10-27 14:14:05.000000000 -0400 +++ ncftp-3.2.2-WORKAROUND/sio/SConnect.c 2008-08-31 19:00:56.000000000 -0400 @@ -154,7 +154,7 @@ tv.tv_sec = (tv_sec_t) tlen; tv.tv_usec = 0; result = select(sfd + 1, NULL, SELECT_TYPE_ARG234 &ss, SELECT_TYPE_ARG234 &xx, SELECT_TYPE_ARG5 &tv); - if (result == 1) { + if (result >= 1) { /* ready */ break; } else if (result == 0) { diff -wurd ncftp-3.2.2/sio/SConnect.c ncftp-3.2.2-SELECT-BUG/sio/ SConnect.c --- ncftp-3.2.2/sio/SConnect.c 2007-10-27 14:14:05.000000000 -0400 +++ ncftp-3.2.2-SELECT-BUG/sio/SConnect.c 2008-08-31 19:10:04.000000000 -0400 @@ -151,10 +151,25 @@ #if defined(__DECC) || defined(__DECCXX) # pragma message restore #endif +{ +int x; +for (x=0; x<=sfd; x++) { +if (MY_FD_ISSET(x, &ss)) {fprintf(stderr, "fd %d is set in writers\n", x); } +if (MY_FD_ISSET(x, &xx)) {fprintf(stderr, "fd %d is set in exceptions\n", x); } +} +} tv.tv_sec = (tv_sec_t) tlen; tv.tv_usec = 0; result = select(sfd + 1, NULL, SELECT_TYPE_ARG234 &ss, SELECT_TYPE_ARG234 &xx, SELECT_TYPE_ARG5 &tv); - if (result == 1) { +fprintf(stderr, "select = %d\n", result); +{ +int x; +for (x=0; x<=sfd; x++) { +if (MY_FD_ISSET(x, &ss)) {fprintf(stderr, "fd %d is set in writers\n", x); } +if (MY_FD_ISSET(x, &xx)) {fprintf(stderr, "fd %d is set in exceptions\n", x); } +} +} + if (result >= 1) { /* ready */ break; } else if (result == 0) { On Aug 27, 2008, at 11:05 AM, Renato Botelho wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello Mike, > > What do you think about it? > > Regards > > - ----- Forwarded message from Wesley Shields ----- > > Date: Wed, 27 Aug 2008 11:04:15 -0400 > From: Wesley Shields > To: Renato Botelho > Cc: "David E. O'Brien" , cvs-ports@FreeBSD.org > Subject: Re: cvs commit: ports/ftp/ncftp3 pkg-plist > > On Wed, Aug 27, 2008 at 11:49:52AM -0300, Renato Botelho wrote: >> On Wed, Aug 27, 2008 at 02:31:01PM +0000, David E. O'Brien wrote: >>> obrien 2008-08-27 14:31:01 UTC >>> >>> FreeBSD ports repository >>> >>> Modified files: >>> ftp/ncftp3 pkg-plist >>> Log: >>> Upgrade to version 3.2.2. >> >> This version still doesn't work at recent -CURRENT (since 800041 for >> me). >> >> garga@botelhor:~> ncftp >> NcFTP 3.2.2 (Aug 18, 2008) by Mike Gleason >> (http://www.NcFTP.com/contact/). >> ncftp> open ftp.FreeBSD.org >> Could not connect to ftp.FreeBSD.org: Operation now in progress. >> Could not open host ftp.FreeBSD.org: could not connect to remote >> host. >> >> What do you think to mark it as BROKEN? >> >> btw, i've notified ncftp people about this problem, but the guy >> couldn't >> install -CURRENT on his vmware and couldn't reproduce, but me and >> more 2 >> people that i've assked tested and had the same. > > I can give him/her access to an amd64 -current box for testing if (s)he > wants. > > - -- WXS > > - ----- End forwarded message ----- > > - -- > Renato Botelho > > GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc > > Dianetics is a milestone for man comparable to his discovery of > fire and superior to his invention of the wheel and the arch. > -- L. Ron Hubbard > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.9 (FreeBSD) > > iEYEARECAAYFAki1e0UACgkQ6CRbiSJE7anb2gCeOJIhB+OzS/XFiVnDZh6Wl+Yl > u/AAoJEG69J0gf2+6unuIi4PhxeLZ2L7 > =CjJA > -----END PGP SIGNATURE----- > > ----- End forwarded message ----- -- Renato Botelho GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc I think your opinions are reasonable, except for the one about my mental instability. -- Psychology Professor, Farifield University