From 95a47886af2a9b4a5bdd7f2ad1b3ebdb7e47d770 Mon Sep 17 00:00:00 2001 From: dongyuzhen Date: Wed, 14 Jun 2023 15:31:21 +0800 Subject: [PATCH] backport upstream patches --- backport-fix-Fo-option.patch | 72 ++++++++++++++++++++++++++++++++++++ lsof.spec | 6 ++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 backport-fix-Fo-option.patch diff --git a/backport-fix-Fo-option.patch b/backport-fix-Fo-option.patch new file mode 100644 index 0000000..d883c73 --- /dev/null +++ b/backport-fix-Fo-option.patch @@ -0,0 +1,72 @@ +From 19c6e483982456b9cf78c87b9cf3c90e98d63024 Mon Sep 17 00:00:00 2001 +From: Masatake YAMATO +Date: Sun, 23 Apr 2023 14:48:46 +0800 +Subject: [PATCH] backport fix Fo option + +-Fo option is for printing file offset. For regular files, +the option didn't work. +Here is a command session demonstrating the fix: + + # ./lsof -Fo -o0| grep ^o | sort | uniq -c + 90586 o0t0 + 87 o0t101 + 84 o0t103 + ... + +Signed-off-by: Masatake YAMATO +Reference:https://github.com/lsof-org/lsof/commit/6435e7667cbf5b1a616606aa019892df43f3ade1 +Conflict:NA +--- + main.c | 4 ++++ + tests/case-20-offset-field.bash | 24 ++++++++++++++++++++++++ + 2 files changed, 28 insertions(+) + create mode 100644 tests/case-20-offset-field.bash + +diff --git a/main.c b/main.c +index 169e334..9e3bbd8 100644 +--- a/main.c ++++ b/main.c +@@ -554,6 +554,10 @@ main(argc, argv) + + if (i == LSOF_FIX_TERM) + Terminator = '\0'; ++ ++ if (i == LSOF_FIX_OFFSET) ++ Foffset = 1; ++ + break; + } + } +diff --git a/tests/case-20-offset-field.bash b/tests/case-20-offset-field.bash +new file mode 100644 +index 0000000..a5dc369 +--- /dev/null ++++ b/tests/case-20-offset-field.bash +@@ -0,0 +1,24 @@ ++name=$(basename $0 .bash) ++lsof=$1 ++report=$2 ++base=$(pwd) ++ ++t=/tmp/lsof-test-reg-file-$$ ++p=/tmp/lsof-test-reg-fifo-$$ ++ ++mkfifo $p ++{ ++ printf "%d" 1 ++ read < $p & ++} | cat > $t & ++ ++r=1 ++if [ "$($lsof -Fo $t | grep '^o')" = o0t1 ]; then ++ echo > $p ++ r=0 ++fi ++ ++rm /tmp/lsof-test-reg-file-$$ ++rm /tmp/lsof-test-reg-fifo-$$ ++ ++exit $r +-- +2.27.0 + diff --git a/lsof.spec b/lsof.spec index bb70560..bc552b2 100644 --- a/lsof.spec +++ b/lsof.spec @@ -1,6 +1,6 @@ Name: lsof Version: 4.93.2 -Release: 9 +Release: 10 Summary: A tool for list open files License: zlib and Sendmail and LGPLv2+ URL: https://people.freebsd.org/~abe/ @@ -10,6 +10,7 @@ Patch1: 0052-endpoint-pty-bug-fix-list-the-same-fd-in-a-different.patch Patch2: 0060-endpoint-pseudoterminal-bug-fix-fix-wrong-Unix98-PTY.patch Patch3: Handle-ffff-ffff-in-ipv6-addr-correctly.patch Patch4: backport-Fill-the-buffer-using-pipe-communication-with-zero.patch +Patch5: backport-fix-Fo-option.patch BuildRequires: gcc git libtirpc-devel libselinux-devel @@ -55,6 +56,9 @@ popd %{_mandir}/man*/* %changelog +* Wed Jun 14 2023 dongyuzhen - 4.93.2-10 +- backport upstream patches + * Thu Feb 16 2023 hubin - 4.93.2-9 - Type:testcode - ID:NA -- Gitee