- fix #280651 - lsof prints entries in multiple lines when SElinux is

disabled
- fix #243976 - mmap'd files with large inode numbers confuse lsof
This commit is contained in:
kzak 2007-10-02 22:52:57 +00:00
parent 16d09a2fbc
commit ab6d748549
5 changed files with 89 additions and 24 deletions

View File

@ -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 <all-non-linux-dialects>
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

View File

@ -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 <kzak@redhat.com> 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 <kzak@redhat.com> 4.78-5
- fix License

12
lsof_4.78C-inode.patch Normal file
View File

@ -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;
/*

View File

@ -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",

43
upstream2downstream.sh Executable file
View File

@ -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 <usptream-tarball>
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
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