From 9e8a101778d7dec07f691add9449741f6141f654 Mon Sep 17 00:00:00 2001 From: Subhaditya Nath Date: Sat, 28 Jan 2023 16:28:00 +0530 Subject: [PATCH] lsof: update to 4.98.0 --- .../fix-github-ci.patch} | 8 +- srcpkgs/lsof/patches/fix-epoll-test.patch | 85 +++++++++++++++++++ srcpkgs/lsof/template | 49 ++++------- 3 files changed, 102 insertions(+), 40 deletions(-) rename srcpkgs/lsof/{patches/fix-tests.patch => files/fix-github-ci.patch} (51%) create mode 100644 srcpkgs/lsof/patches/fix-epoll-test.patch diff --git a/srcpkgs/lsof/patches/fix-tests.patch b/srcpkgs/lsof/files/fix-github-ci.patch similarity index 51% rename from srcpkgs/lsof/patches/fix-tests.patch rename to srcpkgs/lsof/files/fix-github-ci.patch index bd9fa284d19a..05582cf65492 100644 --- a/srcpkgs/lsof/patches/fix-tests.patch +++ b/srcpkgs/lsof/files/fix-github-ci.patch @@ -1,11 +1,8 @@ -This patch eliminates the need to modify /etc/hosts +gethostbyaddr() fails on the hostname of GitHub CI containers --- a/tests/LTsock.c +++ b/tests/LTsock.c -@@ -255,10 +255,7 @@ main(argc, argv) - * Get the host name and its IP address. Convert the IP address to dotted - * ASCII form. - */ +@@ -262,6 +262,3 @@ - if (gethostname(hnm, sizeof(hnm) - 1)) { - cem = "ERROR!!! can't get this host's name"; - goto print_errno; @@ -13,4 +10,3 @@ This patch eliminates the need to modify /etc/hosts + strncpy(hnm, "localhost", sizeof(hnm) - 1); hnm[sizeof(hnm) - 1] = '\0'; if (!(hp = gethostbyname(hnm))) { - (void) snprintf(buf, bufl - 1, "ERROR!!! can't get IP address for %s", diff --git a/srcpkgs/lsof/patches/fix-epoll-test.patch b/srcpkgs/lsof/patches/fix-epoll-test.patch new file mode 100644 index 000000000000..5ea7225119f0 --- /dev/null +++ b/srcpkgs/lsof/patches/fix-epoll-test.patch @@ -0,0 +1,85 @@ +This patch has been upstreamed already, and should be +unnecessary in the next release. + +--- a/dialects/linux/tests/case-20-epoll.bash ++++ b/dialects/linux/tests/case-20-epoll.bash +@@ -8,9 +8,9 @@ + fi + + $TARGET 2>> $report | { +- read pid epfd +- if [[ -z "$pid" || -z "$epfd" ]]; then +- echo "unexpected output form target ( $TARGET )" >> $report ++ read pid epfd evp0 evp1 ++ if [[ -z "$pid" || -z "$epfd" || -z "$evp0" || -z "$evp1" ]]; then ++ echo "unexpected output from target ( $TARGET )" >> $report + exit 1 + fi + if ! [ -e "/proc/$pid" ]; then +@@ -25,7 +25,7 @@ + echo done + } >> $report + if $lsof -p $pid -a -d $epfd | +- grep -q "epoll *[0-9]* *.* *${epfd}u *a_inode *[0-9]*,[0-9]* *[0-9]* *[0-9]* *\[eventpoll:5,6\]"; then ++ grep -q "epoll *[0-9]* *.* *${epfd}u *a_inode *[0-9]*,[0-9]* *[0-9]* *[0-9]* *\[eventpoll:${evp0},${evp1}\]"; then + kill $pid + exit 0 + else +--- a/dialects/linux/tests/epoll.c ++++ b/dialects/linux/tests/epoll.c +@@ -14,42 +14,42 @@ + return 1; + } + +- struct epoll_event ev; +- int fd[2]; +- if (pipe(fd) < 0) +- if (fd < 0) ++ int pipefd[2]; ++ if (pipe(pipefd) < 0) + { + perror ("pipe"); + return 1; + } +- if (dup2(fd[0], 5) < 0) ++ int evfd[2]; ++ if ((evfd[0] = dup(pipefd[0])) < 0) + { +- perror ("dup2(fd[0], 5)"); ++ perror ("dup(pipefd[0])"); + return 1; + } +- if (dup2(fd[1], 6) < 0) ++ if ((evfd[1] = dup(pipefd[1])) < 0) + { +- perror ("dup2(fd[1], 6)"); ++ perror ("dup(pipefd[1])"); + return 1; + } + ++ struct epoll_event ev; + ev.events = EPOLLOUT; +- ev.data.fd = 6; ++ ev.data.fd = evfd[1]; + if (epoll_ctl (epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) + { +- perror ("epoll_ctl<6>"); ++ perror ("epoll_ctl"); + return 1; + } + + ev.events = EPOLLIN; +- ev.data.fd = 5; ++ ev.data.fd = evfd[0]; + if (epoll_ctl (epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) + { +- perror ("epoll_ctl<5>"); ++ perror ("epoll_ctl"); + return 1; + } + +- printf ("%d %d\n", getpid(), epfd); ++ printf ("%d %d %d %d\n", getpid(), epfd, evfd[0], evfd[1]); + fflush (stdout); + pause (); + return 0; diff --git a/srcpkgs/lsof/template b/srcpkgs/lsof/template index 4dcfdb240e43..21a623dad947 100644 --- a/srcpkgs/lsof/template +++ b/srcpkgs/lsof/template @@ -1,48 +1,29 @@ # Template file for 'lsof' pkgname=lsof -version=4.96.3 +version=4.98.0 revision=1 -build_style=configure -configure_script="./Configure" -configure_args="-n linux" -make_check_target="all" -make_check_args="-C tests" -hostmakedepends="perl groff" +build_style=gnu-configure +configure_args="--enable-security" +hostmakedepends=groff +checkdepends="util-linux procps-ng" short_desc="LiSt Open Files" maintainer="Subhaditya Nath " license="custom:lsof" homepage="https://github.com/lsof-org/lsof" changelog="https://raw.githubusercontent.com/lsof-org/lsof/master/00DIST" -distfiles="https://github.com/lsof-org/lsof/archive/refs/tags/${version}/${version}.tar.gz" -checksum=2753fc01452a3d2ee665e8365afdac0e9683197f3ec06231aa684a48b286d11c +distfiles="https://github.com/lsof-org/lsof/releases/download/${version}/lsof-${version}.tar.gz" +checksum=2f8efa62cdf8715348b8f76bf32abf59f109a1441df35c686d23dccdeed34d99 post_extract() { - # See: https://github.com/lsof-org/lsof/issues/61 - # The TestDB was meant for storing known-good configurations, and - # skipping tests if the current system configuration exists in the - # TestDB. But we don't want that. - rm tests/CkTestDB - ln -s /bin/true tests/CkTestDB -} - -pre_configure() { - export LSOF_CC="$CC" - export LSOF_CFGF="$CFLAGS" - export LSOF_CFGL="$LDFLAGS" - export LSOF_INCLUDE="${XBPS_CROSS_BASE}/usr/include" - export LSOF_MAKE="$(command -v make)" + # Fix GitHub CI quirks + if [ $XBPS_BUILD_ENVIRONMENT = void-packages-ci ]; then + patch -Np1 <"$FILESDIR/fix-github-ci.patch" + fi - vsed "s|/\* #define\tHASSECURITY\t1 \*/|#define\tHASSECURITY\t1|" \ - -i dialects/linux/machine.h - - soelim Lsof.8 | grep -vi '^\.lf ' > lsof.8 + # Ensure tests always run + ln -sf /bin/true tests/CkTestDB } -do_install() { - vbin lsof - vman lsof.8 - - # extract license from readme - sed -n 00README -e '/^License/,/\*\/$/p' > License - vlicense License +post_install() { + vlicense COPYING }