From 948d13799c82ef45bee2df2fcccd5bee060ca0e0 Mon Sep 17 00:00:00 2001 From: starlet-dx <15929766099@163.com> Date: Tue, 2 Jan 2024 16:23:11 +0800 Subject: [PATCH] ppsfind: Use /bin/sh, fix possible issues. (cherry picked from commit 9808c5398194ca084f3a93e3642c18fee58ccc69) --- pps-tools.spec | 7 +++- ppsfind-Use-bin-sh-fix-possible-issues.patch | 44 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 ppsfind-Use-bin-sh-fix-possible-issues.patch diff --git a/pps-tools.spec b/pps-tools.spec index f157df6..43d12f2 100644 --- a/pps-tools.spec +++ b/pps-tools.spec @@ -1,12 +1,14 @@ Name: pps-tools Version: 1.0.2 -Release: 4 +Release: 5 Summary: User-space tools for LinuxPPS License: GPLv2+ URL: https://github.com/redlab-i/pps-tools Source0: https://github.com/redlab-i/pps-tools/archive/v%{version}/%{name}-%{version}.tar.gz Patch0001: 0001-ppswatch-Fix-quitting-after-signal.patch +# https://github.com/redlab-i/pps-tools/commit/e2b25049df9a4da28168b7378016f1650d0dfa6b +Patch0002: ppsfind-Use-bin-sh-fix-possible-issues.patch BuildRequires: gcc @@ -45,6 +47,9 @@ install -p -m644 -t $RPM_BUILD_ROOT%{_includedir}/sys timepps.h %{_includedir}/sys/timepps.h %changelog +* Tue Jan 02 2024 yaoxin - 1.0.2-5 +- ppsfind: Use /bin/sh, fix possible issues. + * Thu Oct 12 2023 liyuanyuan - 1.0.2-4 - ppswatch: Fix quitting after signal diff --git a/ppsfind-Use-bin-sh-fix-possible-issues.patch b/ppsfind-Use-bin-sh-fix-possible-issues.patch new file mode 100644 index 0000000..cffd823 --- /dev/null +++ b/ppsfind-Use-bin-sh-fix-possible-issues.patch @@ -0,0 +1,44 @@ +From e2b25049df9a4da28168b7378016f1650d0dfa6b Mon Sep 17 00:00:00 2001 +From: Alexander GQ Gerasiov +Date: Wed, 24 Oct 2018 12:47:07 +0300 +Subject: [PATCH 1/1] ppsfind: Use /bin/sh, fix possible issues. + +Signed-off-by: Alexander GQ Gerasiov +--- + ppsfind | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/ppsfind b/ppsfind +index 2ff7abc..adbcab9 100644 +--- a/ppsfind ++++ b/ppsfind +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # ppsfind -- find pps device by name + # + # Copyright (C) 2005-2007 Rodolfo Giometti +@@ -15,16 +15,14 @@ + + SYS="/sys/class/pps/" + +-if [ $# -lt 1 ] ; then ++if [ $# -ne 1 ] ; then + echo "usage: ppsfind " >&2 + exit 1 + fi + +-for d in $(ls $SYS) ; do +- if grep $1 $SYS/$d/name >& /dev/null || \ +- grep $1 $SYS/$d/path >& /dev/null ; then +- echo "$d: name=$(cat $SYS/$d/name) path=$(cat $SYS/$d/path)" +- fi ++for dev in $SYS/* ; do ++ grep -q "$1" "$dev/name" || grep -q "$1" "$dev/path" && \ ++ echo "$(basename "$dev"): name=$(cat $dev/name) path=$(cat $dev/path)" + done + + exit 0 +-- +2.30.0 + -- Gitee