From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Nov 2 23:20:01 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCBA41065680 for ; Sun, 2 Nov 2008 23:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A9B718FC18 for ; Sun, 2 Nov 2008 23:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mA2NK1u7045175 for ; Sun, 2 Nov 2008 23:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mA2NK1hZ045174; Sun, 2 Nov 2008 23:20:01 GMT (envelope-from gnats) Resent-Date: Sun, 2 Nov 2008 23:20:01 GMT Resent-Message-Id: <200811022320.mA2NK1hZ045174@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Rene Ladan Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 992D91065679 for ; Sun, 2 Nov 2008 23:18:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD358FC0C for ; Sun, 2 Nov 2008 23:18:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mA2NIjN9031875 for ; Sun, 2 Nov 2008 23:18:45 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id mA2NIjXd031874; Sun, 2 Nov 2008 23:18:45 GMT (envelope-from nobody) Message-Id: <200811022318.mA2NIjXd031874@www.freebsd.org> Date: Sun, 2 Nov 2008 23:18:45 GMT From: Rene Ladan To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/128549: devel/libusb : fix runtime error X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2008 23:20:01 -0000 >Number: 128549 >Category: ports >Synopsis: devel/libusb : fix runtime error >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Sun Nov 02 23:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Rene Ladan >Release: 7.0-RELEASE-p5 amd64 >Organization: >Environment: FreeBSD self.rene-ladan.nl 7.0-RELEASE-p5 FreeBSD 7.0-RELEASE-p5 #0: Thu Oct 2 15:01:07 CEST 2008 root@self.rene-ladan.nl:/usr/obj/usr/src70/sys/RENE amd64 >Description: >From the libusb-devel mailing list: >How-To-Repeat: >Fix: Patch attached with submission follows: diff -ruN /usr/ports/devel/libusb/Makefile ./Makefile --- /usr/ports/devel/libusb/Makefile 2008-10-13 19:52:01.000000000 +0200 +++ ./Makefile 2008-11-03 00:06:10.000000000 +0100 @@ -7,7 +7,7 @@ PORTNAME= libusb PORTVERSION= 0.1.12 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff -ruN /usr/ports/devel/libusb/files/patch-bsd.c ./files/patch-bsd.c --- /usr/ports/devel/libusb/files/patch-bsd.c 2008-10-13 19:52:01.000000000 +0200 +++ ./files/patch-bsd.c 2008-11-03 00:09:17.000000000 +0100 @@ -1,14 +1,23 @@ ---- bsd.c.orig Sun Jul 30 11:18:07 2006 -+++ bsd.c Sun Jul 30 11:20:30 2006 +--- bsd.c.orig 2006-03-04 03:52:46.000000000 +0100 ++++ bsd.c 2008-11-03 00:08:15.000000000 +0100 @@ -408,7 +408,7 @@ /* Ensure the endpoint address is correct */ ep |= USB_ENDPOINT_IN; - + - fd = ensure_ep_open(dev, ep, O_RDONLY); + fd = ensure_ep_open(dev, ep, O_RDONLY | O_NONBLOCK); if (fd < 0) { - if (usb_debug >= 2) { - #ifdef __FreeBSD_kernel__ + if (usb_debug >= 2) { + #ifdef __FreeBSD_kernel__ +@@ -477,7 +477,7 @@ + USB_ERROR_STR(-errno, "error sending control message: %s", + strerror(errno)); + +- return UGETW(req.ucr_request.wLength); ++ return req.ucr_actlen; + } + + int usb_os_find_busses(struct usb_bus **busses) @@ -623,9 +623,21 @@ int usb_clear_halt(usb_dev_handle *dev, unsigned int ep) @@ -16,8 +25,7 @@ - /* Not yet done, because I haven't needed it. */ + int ret; + struct usb_ctl_request ctl_req; - -- USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD"); ++ + ctl_req.ucr_addr = 0; // Not used for this type of request + ctl_req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT; + ctl_req.ucr_request.bRequest = UR_CLEAR_FEATURE; @@ -28,7 +36,8 @@ + + if ((ret = ioctl(dev->fd, USB_DO_REQUEST, &ctl_req)) < 0) + USB_ERROR_STR(-errno, "clear_halt: failed for %d", ep); -+ + +- USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD"); + return ret; } >Release-Note: >Audit-Trail: >Unformatted: >> The current FreeBSD port compiles fine, so does it fail at run-time >> for a particular use case? > Yes, this is a runtime failure. While usb_control_msg is supposed to return > the actual number of bytes received, the freebsd version returns the > receiving buffer size instead. Applications inspecting the returned length > for error checking will fail. My patch is based on this excerpt from > FreeBSDs /usr/src/sys/dev/usb/usb.h. The patched port passes 'make'.