From owner-freebsd-ports-bugs@freebsd.org Thu Oct 19 15:28:33 2017 Return-Path: Delivered-To: freebsd-ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1CE5E3E7A9 for ; Thu, 19 Oct 2017 15:28:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEC3F6DDFB for ; Thu, 19 Oct 2017 15:28:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9JFSXZV083691 for ; Thu, 19 Oct 2017 15:28:33 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 223117] [PATCH] sysutils/nut USB drivers process errors in wrong way and sometimes kill themselves without real reason Date: Thu, 19 Oct 2017 15:28:33 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: lev@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: cy@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter flagtypes.name attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Oct 2017 15:28:34 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D223117 Bug ID: 223117 Summary: [PATCH] sysutils/nut USB drivers process errors in wrong way and sometimes kill themselves without real reason Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: cy@FreeBSD.org Reporter: lev@FreeBSD.org Keywords: patch Assignee: cy@FreeBSD.org Flags: maintainer-feedback?(cy@FreeBSD.org) Created attachment 187311 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D187311&action= =3Dedit Patch to place into file/ directory. It is well-known problem, mostly with blazer_usb drive, but not limited to = it, that sometimes USB driver reports "Permission error" and exits without any visible reason (permissions are Ok or driver run as root). This problem was reported on mailing lists and forums for FreeBSD 9, 10 and 11, and not for other operating systems. I found reason for these problems: current (2.7.4) version of NUT uses libusb-0.1 API. All processing of USB errors in NUT sources assumes that "return values less than zero" of libusb-0.1 calls means "negated errno cod= es", and have special processing for some errors, like "-EPERM" (which is -1, as EPERM is 1).=20 FreeBSD uses wrappers around libusb-1.0 API to provide libusb-0.1 API and u= ses libusb-1.0 error codes (which are negative!), and -1 is LIBUSB_ERROR_IO, wh= cih should not kill driver but must trigger reconnect. NUT has project to use libusb-1.0 API, and, I hope, they fix this problem in the course of this project (I've reported this problem to NUT developers), = but for now I've hacked up quick-n-dirty patch to fix problem with nut 2.7.4. Main problem with this patch, is I copy'n'pasted error definitions from "/usr/include/libusb.h", as I found that it is hard to include system inclu= de together with project-local include. Patch is attached. Please note, that it is patch for "files/" directory, not patch for port directory, PORTREVISION must be tweaked as well. --=20 You are receiving this mail because: You are the assignee for the bug.=