From owner-svn-ports-head@freebsd.org Tue Jun 12 12:44:34 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4316D100D229; Tue, 12 Jun 2018 12:44:34 +0000 (UTC) (envelope-from arrowd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8C0C8146C; Tue, 12 Jun 2018 12:44:33 +0000 (UTC) (envelope-from arrowd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9E0D2955; Tue, 12 Jun 2018 12:44:33 +0000 (UTC) (envelope-from arrowd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5CCiXw5075180; Tue, 12 Jun 2018 12:44:33 GMT (envelope-from arrowd@FreeBSD.org) Received: (from arrowd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5CCiXru075178; Tue, 12 Jun 2018 12:44:33 GMT (envelope-from arrowd@FreeBSD.org) Message-Id: <201806121244.w5CCiXru075178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arrowd set sender to arrowd@FreeBSD.org using -f From: Gleb Popov Date: Tue, 12 Jun 2018 12:44:33 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r472242 - in head/devel/qt5-core: . files X-SVN-Group: ports-head X-SVN-Commit-Author: arrowd X-SVN-Commit-Paths: in head/devel/qt5-core: . files X-SVN-Commit-Revision: 472242 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 12:44:34 -0000 Author: arrowd Date: Tue Jun 12 12:44:33 2018 New Revision: 472242 URL: https://svnweb.freebsd.org/changeset/ports/472242 Log: devel/qt5-core: Add a patch that fixes QLockFilePrivate::processNameByPid() function to return non-truncated name. Reviewed by: rakuco, tcberner Approved by: tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D15673 Added: head/devel/qt5-core/files/patch-src_corelib_io_qlockfile__unix.cpp (contents, props changed) Modified: head/devel/qt5-core/Makefile Modified: head/devel/qt5-core/Makefile ============================================================================== --- head/devel/qt5-core/Makefile Tue Jun 12 11:28:42 2018 (r472241) +++ head/devel/qt5-core/Makefile Tue Jun 12 12:44:33 2018 (r472242) @@ -2,6 +2,7 @@ PORTNAME= core DISTVERSION= ${QT5_VERSION} +PORTREVISION= 1 CATEGORIES= devel PKGNAMEPREFIX= qt5- Added: head/devel/qt5-core/files/patch-src_corelib_io_qlockfile__unix.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/qt5-core/files/patch-src_corelib_io_qlockfile__unix.cpp Tue Jun 12 12:44:33 2018 (r472242) @@ -0,0 +1,148 @@ +--- src/corelib/io/io.pri.orig 2018-02-08 18:24:48 UTC ++++ src/corelib/io/io.pri +@@ -178,6 +178,9 @@ win32 { + SOURCES += \ + io/qstandardpaths_unix.cpp \ + io/qstorageinfo_unix.cpp ++ freebsd { ++ LIBS += -lkvm -lprocstat ++ } + } + + linux|if(qnx:qtConfig(inotify)) { +--- src/corelib/io/qlockfile_unix.cpp.orig 2018-02-08 18:24:48 UTC ++++ src/corelib/io/qlockfile_unix.cpp +@@ -75,6 +75,8 @@ + # include + # if !defined(Q_OS_NETBSD) + # include ++# include ++# include + # endif + #endif + +@@ -246,23 +248,44 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) + struct kinfo_proc kp; + int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 }; + # else ++ QString nameFromProcstat; ++ kvm_t *kvm = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, ""); ++ if (kvm) { ++ int cnt; ++ struct kinfo_proc *kp = kvm_getprocs(kvm, KERN_PROC_PID, getpid(), &cnt); ++ if (kp) { ++ struct procstat *ps = procstat_open_sysctl(); ++ char **argv = procstat_getargv(ps, kp, 0); ++ if (argv != nullptr && argv[0] != nullptr) ++ nameFromProcstat = QString::fromLocal8Bit(argv[0]); ++ procstat_close(ps); ++ } ++ kvm_close(kvm); ++ } + struct kinfo_proc kp; + int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid }; + # endif +- size_t len = sizeof(kp); +- u_int mib_len = sizeof(mib)/sizeof(u_int); ++ if (nameFromProcstat.isEmpty()) { ++ size_t len = sizeof(kp); ++ u_int mib_len = sizeof(mib)/sizeof(u_int); + +- if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) +- return QString(); +- ++ if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) ++ return QString(); ++ } + # if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) + if (kp.p_pid != pid) + return QString(); + QString name = QFile::decodeName(kp.p_comm); + # else +- if (kp.ki_pid != pid) ++ QString name; ++ if (!nameFromProcstat.isEmpty()) { ++ QFileInfo fi(nameFromProcstat); ++ name = fi.fileName(); ++ } ++ else if (kp.ki_pid != pid) + return QString(); +- QString name = QFile::decodeName(kp.ki_comm); ++ else ++ name = QFile::decodeName(kp.ki_comm); + # endif + return name; +--- src/corelib/io/io.pri.orig 2018-02-08 18:24:48 UTC ++++ src/corelib/io/io.pri +@@ -178,6 +178,9 @@ win32 { + SOURCES += \ + io/qstandardpaths_unix.cpp \ + io/qstorageinfo_unix.cpp ++ freebsd { ++ LIBS += -lkvm -lprocstat ++ } + } + + linux|if(qnx:qtConfig(inotify)) { +--- src/corelib/io/qlockfile_unix.cpp.orig 2018-02-08 18:24:48 UTC ++++ src/corelib/io/qlockfile_unix.cpp +@@ -75,6 +75,8 @@ + # include + # if !defined(Q_OS_NETBSD) + # include ++# include ++# include + # endif + #endif + +@@ -246,23 +248,44 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) + struct kinfo_proc kp; + int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 }; + # else ++ QString nameFromProcstat; ++ kvm_t *kvm = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, ""); ++ if (kvm) { ++ int cnt; ++ struct kinfo_proc *kp = kvm_getprocs(kvm, KERN_PROC_PID, getpid(), &cnt); ++ if (kp) { ++ struct procstat *ps = procstat_open_sysctl(); ++ char **argv = procstat_getargv(ps, kp, 0); ++ if (argv != nullptr && argv[0] != nullptr) ++ nameFromProcstat = QString::fromLocal8Bit(argv[0]); ++ procstat_close(ps); ++ } ++ kvm_close(kvm); ++ } + struct kinfo_proc kp; + int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid }; + # endif +- size_t len = sizeof(kp); +- u_int mib_len = sizeof(mib)/sizeof(u_int); ++ if (nameFromProcstat.isEmpty()) { ++ size_t len = sizeof(kp); ++ u_int mib_len = sizeof(mib)/sizeof(u_int); + +- if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) +- return QString(); +- ++ if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) ++ return QString(); ++ } + # if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) + if (kp.p_pid != pid) + return QString(); + QString name = QFile::decodeName(kp.p_comm); + # else +- if (kp.ki_pid != pid) ++ QString name; ++ if (!nameFromProcstat.isEmpty()) { ++ QFileInfo fi(nameFromProcstat); ++ name = fi.fileName(); ++ } ++ else if (kp.ki_pid != pid) + return QString(); +- QString name = QFile::decodeName(kp.ki_comm); ++ else ++ name = QFile::decodeName(kp.ki_comm); + # endif + return name;