From ab6d74854943a14c3c397d4c8886159247b38e38 Mon Sep 17 00:00:00 2001 From: kzak Date: Tue, 2 Oct 2007 22:52:57 +0000 Subject: [PATCH] - fix #280651 - lsof prints entries in multiple lines when SElinux is disabled - fix #243976 - mmap'd files with large inode numbers confuse lsof --- README.maintainer | 23 ------------------ lsof.spec | 21 +++++++++++++++- lsof_4.78C-inode.patch | 12 +++++++++ lsof_4.78C-selinux-strerr.patch | 14 +++++++++++ upstream2downstream.sh | 43 +++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 24 deletions(-) delete mode 100644 README.maintainer create mode 100644 lsof_4.78C-inode.patch create mode 100644 lsof_4.78C-selinux-strerr.patch create mode 100755 upstream2downstream.sh diff --git a/README.maintainer b/README.maintainer deleted file mode 100644 index 405bb94..0000000 --- a/README.maintainer +++ /dev/null @@ -1,23 +0,0 @@ - -Please, remove non-linux dialects from upstream source package before release. -There is problem with copyrights for some UN*Xes ... also .. you can merge all -to the one normal tarball (instead two level tarball that uses upstream) and -rename it to lsof_X.XX-rh. - - -tar zxvf lsof_X.XX_src.tar - -mv lsof_X.XX_src lsof_X.XX-rh - -mv README* 00* lsof_X.XX-rh/ - -cd lsof_X.XX-rh/dialects/ - -rm -rf - -cd ../../ - -tar jcvf lsof_X.XX-rh.tar.bz2 lsof_X.XX-rh - -lsof_X.XX-rh.tar.bz2 <-- use in the lsof.spec file - diff --git a/lsof.spec b/lsof.spec index 7339638..9465d9c 100644 --- a/lsof.spec +++ b/lsof.spec @@ -1,17 +1,27 @@ Summary: A utility which lists open files on a Linux/UNIX system Name: lsof Version: 4.78 -Release: 5%{?dist} +Release: 6%{?dist} License: Distributable Group: Development/Debuggers + +# lsof contains licensed code that we cannot ship. Therefore we use +# upstream2downstream.sh script to remove the code before shipping it. +# +# The script you can found in CVS or download from: +# http://cvs.fedoraproject.org/viewcvs/rpms/lsof/devel/upstream2downstream.sh +# %define lsofrh lsof_4.78C-rh Source0: %{lsofrh}.tar.bz2 URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libselinux-devel Patch1: lsof_4.78C-threads.patch +Patch2: lsof_4.78C-inode.patch +Patch3: lsof_4.78C-selinux-strerr.patch %description Lsof stands for LiSt Open Files, and it does just that: it lists @@ -20,7 +30,12 @@ UNIX system. %prep %setup -q -n %{lsofrh} +# 184338 - allow lsof access nptl threads %patch1 -p1 +# 243976 - mmap'd files with large inode numbers confuse lsof +%patch2 -p1 +# 280651 - lsof prints entries in multiple lines when SElinux is disabled +%patch3 -p1 %build LSOF_VSTR=2.6.16 LINUX_BASE=/proc ./Configure -n linux @@ -44,6 +59,10 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man*/* %changelog +* Tue Oct 2 2007 Karel Zak 4.78-6 +- fix #280651 - lsof prints entries in multiple lines when SElinux is disabled +- fix #243976 - mmap'd files with large inode numbers confuse lsof + * Thu Mar 1 2007 Karel Zak 4.78-5 - fix License diff --git a/lsof_4.78C-inode.patch b/lsof_4.78C-inode.patch new file mode 100644 index 0000000..556ffbe --- /dev/null +++ b/lsof_4.78C-inode.patch @@ -0,0 +1,12 @@ +diff -up lsof_4.78C-rh/dialects/linux/dproc.c.kzak lsof_4.78C-rh/dialects/linux/dproc.c +--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2007-10-02 14:30:25.000000000 +0200 ++++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-02 14:31:46.000000000 +0200 +@@ -790,7 +790,7 @@ process_proc_map(p, s, ss) + dev = (dev_t)makedev((int)maj, (int)min); + if (!fp[5] || !*fp[5]) + continue; +- inode = (INODETYPE)atoi(fp[5]); ++ inode = (INODETYPE)atoll(fp[5]); + if (!dev && !inode) + continue; + /* diff --git a/lsof_4.78C-selinux-strerr.patch b/lsof_4.78C-selinux-strerr.patch new file mode 100644 index 0000000..0729c30 --- /dev/null +++ b/lsof_4.78C-selinux-strerr.patch @@ -0,0 +1,14 @@ +diff -up lsof_4.78C-rh/dialects/linux/dproc.c.kzak lsof_4.78C-rh/dialects/linux/dproc.c +--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2007-10-02 15:34:19.000000000 +0200 ++++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-02 15:36:21.000000000 +0200 +@@ -467,8 +467,8 @@ gather_proc_info() + if (getpidcon(pid, &Lp->cntx) == -1) { + Lp->cntx = (char *)NULL; + if (!Fwarn) { +- (void) snpf(nmabuf, sizeof(nmabuf), +- "(getpidcon: %s)\n", strerror(errno)); ++ (void) snpf(nmabuf, sizeof(nmabuf), "(getpidcon: %s)", ++ strerror(errno)); + if (!(Lp->cntx = strdup(nmabuf))) { + (void) fprintf(stderr, + "%s: no context error space: PID %ld", diff --git a/upstream2downstream.sh b/upstream2downstream.sh new file mode 100755 index 0000000..4ef3e89 --- /dev/null +++ b/upstream2downstream.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# This script removes non-linux dialects from upstream source package before release. +# There is a problem with copyrights for some UN*Xes ... also .. this script merges all +# to the one normal tarball and rename all to lsof_X.XX-rh. +# +# Usage: ./upstream2downstream +# +# Copyright (C) 2007 Karel Zak +# + +UPSTREAM="$1" +NAME=$(basename $UPSTREAM .tar.gz) +MYPWD=$(pwd) +TMP=$(mktemp -d) + +echo +echo -n "Extracting upstream code..." +tar -zxf $UPSTREAM -C $TMP +cd $TMP/$NAME +tar xf "$NAME"_src.tar +echo " done." + +echo -n "Moving files to downstream directory..." +mv "$NAME"_src/ "$NAME"-rh +mv README* 00* "$NAME"-rh +echo " done." + +echo -n "Removing non-Linux dialects..." +rm -rf "$NAME"-rh/dialects/{aix,darwin,du,freebsd,hpux,n+obsd,n+os,osr,sun,uw} +echo " done." + +echo -n "Creating final downstream tarball..." +tar jcf $MYPWD/"$NAME"-rh.tar.bz2 "$NAME"-rh +echo " done." + +rm -rf $TMP +cd $MYPWD + +echo +echo "Linux-only tarball: $MYPWD/"$NAME"-rh.tar.bz2" +echo +