From 4ba5b3addc9acabf06c158af2e4a5d9f42467667 Mon Sep 17 00:00:00 2001 From: Serhii Turivnyi Date: Mon, 11 Dec 2017 12:40:44 +0200 Subject: [PATCH 01/54] Add CI tests using the standard test interface --- .../test.basic-functionality-test.log | 261 ++++++++++++++++++ tests/artifacts/test.log | 1 + tests/basic-functionality-test/Makefile | 64 +++++ tests/basic-functionality-test/PURPOSE | 11 + tests/basic-functionality-test/runtest.sh | 90 ++++++ tests/tests.retry | 1 + tests/tests.yml | 13 + 7 files changed, 441 insertions(+) create mode 100644 tests/artifacts/test.basic-functionality-test.log create mode 100644 tests/artifacts/test.log create mode 100644 tests/basic-functionality-test/Makefile create mode 100644 tests/basic-functionality-test/PURPOSE create mode 100755 tests/basic-functionality-test/runtest.sh create mode 100644 tests/tests.retry create mode 100644 tests/tests.yml diff --git a/tests/artifacts/test.basic-functionality-test.log b/tests/artifacts/test.basic-functionality-test.log new file mode 100644 index 0000000..5c74efd --- /dev/null +++ b/tests/artifacts/test.basic-functionality-test.log @@ -0,0 +1,261 @@ +posix on +:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off +:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off +:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang +:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: Setup +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +which-2.21-4.fc27.x86_64 +:: [ PASS ] :: Checking for the presence of which rpm +:: [ 12:25:31 ] :: Package versions: +:: [ 12:25:31 ] :: Package versions: +:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64 +:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64 +:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)' +:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)' +:: [ PASS ] :: Creating tmp directory (Expected 0, got 0) +:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL' +:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL' +/tmp/tmp.cVaYqMMJWL /usr/local/bin/basic-functionality-test +:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) +:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' +:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' +:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test --version +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )' +:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )' +:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0) +:: [ BEGIN ] :: Running 'which --version' +:: [ BEGIN ] :: Running 'which --version' +GNU which v2.21, Copyright (C) 1999 - 2015 Carlo Wood. +GNU which comes with ABSOLUTELY NO WARRANTY; +This program is free software; your freedom to use, change +and distribute this program is protected by the GPL. +:: [ PASS ] :: Command 'which --version' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test locating the bash binary +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'which bash' +:: [ BEGIN ] :: Running 'which bash' +/bin/bash +:: [ PASS ] :: Command 'which bash' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test an alias +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc' +:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc' +:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0) +:: [ BEGIN ] :: Running 'echo -e 'alias foo=true +which foo' | bash -i' +:: [ BEGIN ] :: Running 'echo -e 'alias foo=true +which foo' | bash -i' +[root@localhost tmp.cVaYqMMJWL]# alias foo=true +[root@localhost tmp.cVaYqMMJWL]# which foo +]0;root@localhost:/tmp/tmp.cVaYqMMJWL]0;root@localhost:/tmp/tmp.cVaYqMMJWLalias foo='true' + /bin/true +[root@localhost tmp.cVaYqMMJWL]# exit +]0;root@localhost:/tmp/tmp.cVaYqMMJWL:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true'' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test non existing command +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'which foobar' +:: [ BEGIN ] :: Running 'which foobar' +which: no foobar in (/sbin:/bin:/usr/sbin:/usr/bin) +:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test with customized PATH +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' +/tmp/tmp.cVaYqMMJWL/true +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test options -a / --all +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' +/tmp/tmp.cVaYqMMJWL/true +/bin/true +/usr/bin/true +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true' +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' +:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' +/tmp/tmp.cVaYqMMJWL/true +/bin/true +/usr/bin/true +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true' + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: Cleanup +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ BEGIN ] :: Running 'popd' +:: [ BEGIN ] :: Running 'popd' +/usr/local/bin/basic-functionality-test +:: [ PASS ] :: Command 'popd' (Expected 0, got 0) +:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL' +:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL' +:: [ PASS ] :: Removing tmp directory (Expected 0, got 0) + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: TEST PROTOCOL +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ LOG ] :: Package : unknown +:: [ LOG ] :: Installed : which-2.21-4.fc27.x86_64 +:: [ LOG ] :: beakerlib RPM : beakerlib-1.16-4.fc27 +:: [ LOG ] :: bl-redhat RPM : not installed +:: [ LOG ] :: Test started : 2017-12-11 12:25:31 EET +:: [ LOG ] :: Test finished : 2017-12-11 12:25:34 EET +:: [ LOG ] :: Test name : basic-functionality-test +:: [ LOG ] :: Distro : Fedora release 27 (Twenty Seven) +:: [ LOG ] :: Hostname : localhost.localdomain +:: [ LOG ] :: Architecture : x86_64 + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: Test description +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +PURPOSE of /CoreOS/which/Sanity/basic-functionality-test +Description: tests basic functionality +Author: Karel Srot + +tests following scenarios: + * test --version + * test locating the bash binary + * test an alias + * test non existing command + * test with customized PATH + * test options -a / --all + +:: [ WARNING ] :: POSIX mode detected and switched off +:: [ WARNING ] :: Please fix your test to have /bin/bash shebang + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: Setup +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Checking for the presence of which rpm +:: [ LOG ] :: Package versions: +:: [ LOG ] :: which-2.21-4.fc27.x86_64 +:: [ PASS ] :: Creating tmp directory (Expected 0, got 0) +:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) +:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) +:: [ LOG ] :: Duration: 1s +:: [ LOG ] :: Assertions: 4 good, 0 bad +:: [ PASS ] :: RESULT: Setup + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test --version +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0) +:: [ PASS ] :: Command 'which --version' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21' +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 3 good, 0 bad +:: [ PASS ] :: RESULT: test --version + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test locating the bash binary +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'which bash' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash' +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 2 good, 0 bad +:: [ PASS ] :: RESULT: test locating the bash binary + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test an alias +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0) +:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true'' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true' +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 4 good, 0 bad +:: [ PASS ] :: RESULT: test an alias + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test non existing command +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)' +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 2 good, 0 bad +:: [ PASS ] :: RESULT: test non existing command + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test with customized PATH +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true' +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 2 good, 0 bad +:: [ PASS ] :: RESULT: test with customized PATH + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: test options -a / --all +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true' +:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0) +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true' +:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true' +:: [ LOG ] :: Duration: 1s +:: [ LOG ] :: Assertions: 6 good, 0 bad +:: [ PASS ] :: RESULT: test options -a / --all + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: Cleanup +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ PASS ] :: Command 'popd' (Expected 0, got 0) +:: [ PASS ] :: Removing tmp directory (Expected 0, got 0) +:: [ LOG ] :: Duration: 0s +:: [ LOG ] :: Assertions: 2 good, 0 bad +:: [ PASS ] :: RESULT: Cleanup + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: [ LOG ] :: basic-functionality-test +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ LOG ] :: Phases: 8 good, 0 bad +:: [ PASS ] :: RESULT: basic-functionality-test +:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml +:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml +:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt +:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt diff --git a/tests/artifacts/test.log b/tests/artifacts/test.log new file mode 100644 index 0000000..efaf4f6 --- /dev/null +++ b/tests/artifacts/test.log @@ -0,0 +1 @@ +PASS basic-functionality-test diff --git a/tests/basic-functionality-test/Makefile b/tests/basic-functionality-test/Makefile new file mode 100644 index 0000000..e782b94 --- /dev/null +++ b/tests/basic-functionality-test/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/which/Sanity/basic-functionality-test +# Description: tests basic functionality +# Author: Karel Srot +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/which/Sanity/basic-functionality-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Karel Srot " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: tests basic functionality" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: which" >> $(METADATA) + @echo "Requires: which" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/basic-functionality-test/PURPOSE b/tests/basic-functionality-test/PURPOSE new file mode 100644 index 0000000..d609efa --- /dev/null +++ b/tests/basic-functionality-test/PURPOSE @@ -0,0 +1,11 @@ +PURPOSE of /CoreOS/which/Sanity/basic-functionality-test +Description: tests basic functionality +Author: Karel Srot + +tests following scenarios: + * test --version + * test locating the bash binary + * test an alias + * test non existing command + * test with customized PATH + * test options -a / --all diff --git a/tests/basic-functionality-test/runtest.sh b/tests/basic-functionality-test/runtest.sh new file mode 100755 index 0000000..d46f002 --- /dev/null +++ b/tests/basic-functionality-test/runtest.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/which/Sanity/basic-functionality-test +# Description: tests basic functionality +# Author: Karel Srot +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="which" + +TRUE_BINARY=/bin/true +BASHBIN=/bin/bash + +rlIsRHEL 6 && TRUE_BINARY=/bin/true + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "cp -p $TRUE_BINARY $TmpDir" + rlPhaseEnd + + rlPhaseStartTest "test --version" + rlRun "VERSION=\$( rpm -q --qf '%{VERSION}' which )" + rlRun -s "which --version" + rlAssertGrep "GNU which v${VERSION}" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "test locating the bash binary" + rlRun -s "which bash" + rlAssertGrep "$BASHBIN" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "test an alias" + rlRun "echo 'alias foo=bar' > bashrc" + rlRun -s "echo -e 'alias foo=true\nwhich foo' | bash -i" + rlAssertGrep "alias foo='true'" $rlRun_LOG + rlAssertGrep "$TRUE_BINARY" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "test non existing command" + rlRun -s "which foobar" 1 + rlAssertGrep "no foobar in ($PATH)" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "test with customized PATH" + rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which true'" + rlAssertGrep $TmpDir/true $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "test options -a / --all" + rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which -a true'" + rlAssertGrep $TmpDir/true $rlRun_LOG + rlAssertGrep $TRUE_BINARY $rlRun_LOG + rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which --all true'" + rlAssertGrep $TmpDir/true $rlRun_LOG + rlAssertGrep $TRUE_BINARY $rlRun_LOG + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/tests.retry b/tests/tests.retry new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/tests.retry @@ -0,0 +1 @@ +localhost diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b5b96d8 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,13 @@ +--- +# Run tests in all contexts +- hosts: localhost + tags: + - classic + - container + - atomic + roles: + - role: standard-test-beakerlib + tests: + - basic-functionality-test + required_packages: + - which From 7128ddbd689c34c1fd4f7790a91b9be243f2d304 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 31 Jan 2018 15:55:28 +0100 Subject: [PATCH 02/54] fixed bz#1526500 - 'declare' not found under ksh --- which.spec | 6 ++++-- which2.sh | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/which.spec b/which.spec index 780fa43..e6dcdd0 100644 --- a/which.spec +++ b/which.spec @@ -1,14 +1,13 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3 Group: Applications/System Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Url: https://savannah.gnu.org/projects/which/ -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: readline-devel Requires(preun): /sbin/install-info Requires(post): /sbin/install-info @@ -57,6 +56,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Wed Jan 31 2018 Than Ngo - 2.21-5 +- fixed bz#1526500 - 'declare' not found under ksh + * Thu Aug 03 2017 Fedora Release Engineering - 2.21-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/which2.sh b/which2.sh index fe1afc8..3f06746 100644 --- a/which2.sh +++ b/which2.sh @@ -1,3 +1,7 @@ # Initialization script for bash and sh -alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +if [ "$0" == ksh ] ; then + alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +else + alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +fi From 28b3e4f6f1db56101c176480da0846f9db24400e Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 5 Feb 2018 14:28:16 +0100 Subject: [PATCH 03/54] added CI tests using the standard test interface --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index e6dcdd0..dbd6045 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3 Group: Applications/System Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz @@ -56,6 +56,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Mon Feb 05 2018 Than Ngo - 2.21-6 +- added CI tests using the standard test interface + * Wed Jan 31 2018 Than Ngo - 2.21-5 - fixed bz#1526500 - 'declare' not found under ksh From 62b6be0612dc80926321b797e6c15301bb86af20 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 9 Feb 2018 20:54:20 +0000 Subject: [PATCH 04/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index dbd6045..5211416 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3 Group: Applications/System Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz @@ -56,6 +56,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Fri Feb 09 2018 Fedora Release Engineering - 2.21-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Mon Feb 05 2018 Than Ngo - 2.21-6 - added CI tests using the standard test interface From bc81d7f1369bcdde841618fcb9ede367a49d567e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 08:58:59 +0100 Subject: [PATCH 05/54] Remove %clean section None of currently supported distributions need that. Last one was EL5 which is EOL for a while. Signed-off-by: Igor Gnatenko --- which.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/which.spec b/which.spec index 5211416..cee5f76 100644 --- a/which.spec +++ b/which.spec @@ -43,9 +43,6 @@ if [ $1 = 0 ]; then fi exit 0 -%clean -rm -rf $RPM_BUILD_ROOT - %files %defattr(-,root,root) %license COPYING From 5f17e95f07550548ca7fd7127706b53374709dbe Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Fri, 16 Feb 2018 11:02:23 -0600 Subject: [PATCH 06/54] Fix sh syntax issue in which2.sh This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546221. I also included three small spec cleanups: * Removed Group tag. * Removed buildroot cleaning in %install. * Removed needless %defattr in %files. --- which.spec | 11 ++++++----- which2.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/which.spec b/which.spec index cee5f76..56ae8cb 100644 --- a/which.spec +++ b/which.spec @@ -1,9 +1,8 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3 -Group: Applications/System Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh @@ -25,8 +24,6 @@ the specified program is in your PATH. make %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT - make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d @@ -44,7 +41,6 @@ fi exit 0 %files -%defattr(-,root,root) %license COPYING %doc EXAMPLES README AUTHORS NEWS %attr(0644,root,root) %{_sysconfdir}/profile.d/which2.* @@ -53,6 +49,11 @@ exit 0 %{_mandir}/*/* %changelog +* Fri Feb 16 2018 Jason L Tibbitts III - 2.21-8 +- Fix invalid [ ... ] syntax which results in complaints by zsh. + https://bugzilla.redhat.com/show_bug.cgi?id=1546221 +- Remove pointless Group tag, buildroot cleaning and %%defattr. + * Fri Feb 09 2018 Fedora Release Engineering - 2.21-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 3f06746..d7e5373 100644 --- a/which2.sh +++ b/which2.sh @@ -1,6 +1,6 @@ # Initialization script for bash and sh -if [ "$0" == ksh ] ; then +if [ "$0" = ksh ] ; then alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' else alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' From a723e62ca069e2b6b55a5d03598e8d1ddbbdcd6c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 9 Jul 2018 19:06:53 +0200 Subject: [PATCH 07/54] add BuildRequires: gcc Reference: https://fedoraproject.org/wiki/Changes/Remove_GCC_from_BuildRoot --- which.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/which.spec b/which.spec index 56ae8cb..099eb15 100644 --- a/which.spec +++ b/which.spec @@ -7,6 +7,7 @@ Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Url: https://savannah.gnu.org/projects/which/ +BuildRequires: gcc BuildRequires: readline-devel Requires(preun): /sbin/install-info Requires(post): /sbin/install-info From 20982793aa5cd0e84c97f04f372bc40b25b510d1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Thu, 12 Jul 2018 10:30:53 +0200 Subject: [PATCH 08/54] remove install-info Those are not needed as per guidelines. Signed-off-by: Igor Gnatenko --- which.spec | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/which.spec b/which.spec index 099eb15..5bc6f75 100644 --- a/which.spec +++ b/which.spec @@ -9,8 +9,6 @@ Source2: which2.csh Url: https://savannah.gnu.org/projects/which/ BuildRequires: gcc BuildRequires: readline-devel -Requires(preun): /sbin/install-info -Requires(post): /sbin/install-info %description The which command shows the full pathname of a specified program, if @@ -21,33 +19,22 @@ the specified program is in your PATH. %build %configure - -make %{?_smp_mflags} +%make_build %install -make install DESTDIR=$RPM_BUILD_ROOT +%make_install mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ rm -f $RPM_BUILD_ROOT%{_infodir}/dir -%post -/sbin/install-info --quiet --info-dir=%{_infodir} %{_infodir}/which.info.gz -exit 0 - -%preun -if [ $1 = 0 ]; then - /sbin/install-info --quiet --info-dir=%{_infodir} --delete %{_infodir}/which.info.gz -fi -exit 0 - %files %license COPYING %doc EXAMPLES README AUTHORS NEWS %attr(0644,root,root) %{_sysconfdir}/profile.d/which2.* -%{_bindir}/* -%{_infodir}/which.info.gz -%{_mandir}/*/* +%{_bindir}/which +%{_infodir}/which.info* +%{_mandir}/man1/which.1* %changelog * Fri Feb 16 2018 Jason L Tibbitts III - 2.21-8 From ec53838b7fd9ed4c9ca0a39b5e5d0976ae8fc760 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 14 Jul 2018 08:49:13 +0000 Subject: [PATCH 09/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 5bc6f75..595d75f 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -37,6 +37,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jul 14 2018 Fedora Release Engineering - 2.21-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Fri Feb 16 2018 Jason L Tibbitts III - 2.21-8 - Fix invalid [ ... ] syntax which results in complaints by zsh. https://bugzilla.redhat.com/show_bug.cgi?id=1546221 From d60c7c584fe48f228a6b317ee12b80bb14c2b772 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 24 Jul 2018 14:23:15 +0200 Subject: [PATCH 10/54] Fix coverity issues --- which-2.21-coverity-fixes.patch | 14 ++++++++++++++ which.spec | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 which-2.21-coverity-fixes.patch diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch new file mode 100644 index 0000000..50ba4e8 --- /dev/null +++ b/which-2.21-coverity-fixes.patch @@ -0,0 +1,14 @@ +diff -up which-2.21/tilde/tilde.c.me which-2.21/tilde/tilde.c +--- which-2.21/tilde/tilde.c.me 2018-07-23 14:32:47.002225732 +0200 ++++ which-2.21/tilde/tilde.c 2018-07-23 14:49:06.363623898 +0200 +@@ -196,7 +196,8 @@ tilde_expand (string) + int result_size, result_index; + + result_index = result_size = 0; +- if (result = strchr (string, '~')) ++ result = strchr (string, '~'); ++ if (result) + result = (char *)xmalloc (result_size = (strlen (string) + 16)); + else + result = (char *)xmalloc (result_size = (strlen (string) + 1)); +diff -up which-2.21/which.c.me which-2.21/which.c diff --git a/which.spec b/which.spec index 595d75f..97b3c7c 100644 --- a/which.spec +++ b/which.spec @@ -1,11 +1,12 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh +Patch0: which-2.21-coverity-fixes.patch Url: https://savannah.gnu.org/projects/which/ BuildRequires: gcc BuildRequires: readline-devel @@ -16,6 +17,7 @@ the specified program is in your PATH. %prep %setup -q +%patch0 -p1 -b .coverity %build %configure @@ -37,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Jul 23 2018 Than Ngo - 2.21-10 +- Fix coverity issues + * Sat Jul 14 2018 Fedora Release Engineering - 2.21-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 34132615bb86c8aabf40baa6ed6ba18c8bc05cf6 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 26 Jul 2018 13:07:17 +0200 Subject: [PATCH 11/54] fixed resouce leak --- which-2.21-coverity-fixes.patch | 13 +++++++++++++ which.spec | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch index 50ba4e8..0be9e3f 100644 --- a/which-2.21-coverity-fixes.patch +++ b/which-2.21-coverity-fixes.patch @@ -12,3 +12,16 @@ diff -up which-2.21/tilde/tilde.c.me which-2.21/tilde/tilde.c else result = (char *)xmalloc (result_size = (strlen (string) + 1)); diff -up which-2.21/which.c.me which-2.21/which.c +diff -up which-2.21/which.c.me which-2.21/which.c +--- which-2.21/which.c.me 2018-07-23 15:09:04.355222509 +0200 ++++ which-2.21/which.c 2018-07-25 14:57:43.696309701 +0200 +@@ -671,6 +671,9 @@ int main(int argc, char *argv[]) + } + } + ++ if (abs_path) ++ free(abs_path); ++ + return fail_count; + } + diff --git a/which.spec b/which.spec index 97b3c7c..f6fc61d 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Thu Jul 26 2018 Than Ngo - 2.21-11 +- fixed more coverity issue + * Mon Jul 23 2018 Than Ngo - 2.21-10 - Fix coverity issues From 39937137b103aafb39bca70192e83b6d761f72f2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 3 Feb 2019 11:40:57 +0000 Subject: [PATCH 12/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index f6fc61d..588ede1 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Feb 03 2019 Fedora Release Engineering - 2.21-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Thu Jul 26 2018 Than Ngo - 2.21-11 - fixed more coverity issue From bf887760047d6aa86583a72685f6926e03c822a7 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 4 Feb 2019 14:15:49 +0100 Subject: [PATCH 13/54] bump release --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 588ede1..c1c79da 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Feb 04 2019 Than Ngo - 2.21-13 +- bump release + * Sun Feb 03 2019 Fedora Release Engineering - 2.21-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From fecec0b0e0d30f53b2c7c02d74f1020db559ef16 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 4 Feb 2019 15:35:45 +0100 Subject: [PATCH 14/54] bump release --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index c1c79da..ebfe0d4 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 13%{?dist} +Release: 14%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Feb 04 2019 Than Ngo - 2.21-14 +- bump release + * Mon Feb 04 2019 Than Ngo - 2.21-13 - bump release From 6a8b4dd2295e4f1a4d45a987c9a3480b92b66c0d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jul 2019 03:26:03 +0000 Subject: [PATCH 15/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index ebfe0d4..2dbee15 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jul 27 2019 Fedora Release Engineering - 2.21-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Mon Feb 04 2019 Than Ngo - 2.21-14 - bump release From 82a0a5968d858df1754459b0984f14ad24b90fe9 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 5 Nov 2019 15:15:08 +0100 Subject: [PATCH 16/54] set correct alias for ksh --- which.spec | 5 ++++- which2.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index 2dbee15..199a732 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue Nov 05 2019 Than Ngo - 2.21-16 +- set correct alias for ksh + * Sat Jul 27 2019 Fedora Release Engineering - 2.21-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/which2.sh b/which2.sh index d7e5373..1f394ac 100644 --- a/which2.sh +++ b/which2.sh @@ -1,6 +1,6 @@ # Initialization script for bash and sh -if [ "$0" = ksh ] ; then +if [ "$0" == "ksh" -o "$0" == "-ksh" ] ; then alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' else alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' From 608ab1c4cda01de06ad516c4c0f39c6d7890d285 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 31 Jan 2020 03:39:43 +0000 Subject: [PATCH 17/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 199a732..764f363 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 16%{?dist} +Release: 17%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Fri Jan 31 2020 Fedora Release Engineering - 2.21-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Tue Nov 05 2019 Than Ngo - 2.21-16 - set correct alias for ksh From d07598b6fa9087ddad2815fc1f3841333411cc33 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 24 Mar 2020 15:23:27 +0100 Subject: [PATCH 18/54] set correct alias for mksh --- which.spec | 5 ++++- which2.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index 764f363..a1c29f4 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 17%{?dist} +Release: 18%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue Mar 24 2020 Than Ngo - 2.21-18 +- set correct alias for mksh + * Fri Jan 31 2020 Fedora Release Engineering - 2.21-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 1f394ac..4e69626 100644 --- a/which2.sh +++ b/which2.sh @@ -1,6 +1,6 @@ # Initialization script for bash and sh -if [ "$0" == "ksh" -o "$0" == "-ksh" ] ; then +if [ "$0" == "ksh" -o "$0" == "-ksh" -o "$0" == "mksh" -o "$0" == "-mksh" ] ; then alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' else alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' From f988253071708f84212fe66479988b3b18c48425 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 25 Mar 2020 18:07:24 +0100 Subject: [PATCH 19/54] fixed 1817138 - Invalid syntax in /etc/profile.d/which2.sh:3: = not found --- which.spec | 5 ++++- which2.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index a1c29f4..944b624 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Mar 25 2020 Than Ngo - 2.21-19 +- fixed #1817138 - Invalid syntax in /etc/profile.d/which2 + * Tue Mar 24 2020 Than Ngo - 2.21-18 - set correct alias for mksh diff --git a/which2.sh b/which2.sh index 4e69626..53458f3 100644 --- a/which2.sh +++ b/which2.sh @@ -1,6 +1,6 @@ # Initialization script for bash and sh -if [ "$0" == "ksh" -o "$0" == "-ksh" -o "$0" == "mksh" -o "$0" == "-mksh" ] ; then +if [ "$0" = "ksh" -o "$0" = "-ksh" -o "$0" = "mksh" -o "$0" = "-mksh" ] ; then alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' else alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' From bec780888626816d6da8a175532cde3140f0e08d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 14:06:38 +0000 Subject: [PATCH 20/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 944b624..23ec778 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -39,6 +39,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 2.21-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Wed Mar 25 2020 Than Ngo - 2.21-19 - fixed #1817138 - Invalid syntax in /etc/profile.d/which2 From 8f25db9b3a32c0b5a3db24e81bd6d753f56343bf Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sat, 9 Jan 2021 00:54:08 +0000 Subject: [PATCH 21/54] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- which.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/which.spec b/which.spec index 23ec778..fcae822 100644 --- a/which.spec +++ b/which.spec @@ -8,6 +8,7 @@ Source1: which2.sh Source2: which2.csh Patch0: which-2.21-coverity-fixes.patch Url: https://savannah.gnu.org/projects/which/ +BuildRequires: make BuildRequires: gcc BuildRequires: readline-devel From 75909450e94d506c2797317b03668bb876da23e4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 23:28:03 +0000 Subject: [PATCH 22/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index fcae822..5b780cc 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 20%{?dist} +Release: 21%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 2.21-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Jul 29 2020 Fedora Release Engineering - 2.21-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From e3c52e86868c88e613eefbb95172a1e38abf0059 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 18 Mar 2021 17:47:02 +0100 Subject: [PATCH 23/54] fixed syntax error testcase: a=b which ls --- which.spec | 5 ++++- which2.sh | 18 +++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/which.spec b/which.spec index 5b780cc..222a377 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 21%{?dist} +Release: 22%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Thu Mar 18 2021 Than Ngo - 2.21-22 +- fixed syntax error testcase: a=b which ls + * Wed Jan 27 2021 Fedora Release Engineering - 2.21-21 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 53458f3..f73023f 100644 --- a/which2.sh +++ b/which2.sh @@ -1,7 +1,11 @@ -# Initialization script for bash and sh - -if [ "$0" = "ksh" -o "$0" = "-ksh" -o "$0" = "mksh" -o "$0" = "-mksh" ] ; then - alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' -else - alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' -fi +# Initialization script for bash, sh, mksh and ksh +which () +{ + if [ "$0" = "ksh" -o "$0" = "-ksh" -o "$0" = "mksh" -o "$0" = "-mksh" ] ; then + (alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ + export which + else + (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ + export -f which + fi +} From 88199b80146c5da0901c8ac9c8489ee55ba70302 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sun, 21 Mar 2021 14:30:10 +0100 Subject: [PATCH 24/54] - fixed coverity issues - improved which2.sh --- which-2.21-coverity-fixes.patch | 70 +++++++++++++++++++++++++-------- which.spec | 6 ++- which2.sh | 19 +++++---- 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch index 0be9e3f..fbcb636 100644 --- a/which-2.21-coverity-fixes.patch +++ b/which-2.21-coverity-fixes.patch @@ -1,27 +1,65 @@ -diff -up which-2.21/tilde/tilde.c.me which-2.21/tilde/tilde.c ---- which-2.21/tilde/tilde.c.me 2018-07-23 14:32:47.002225732 +0200 -+++ which-2.21/tilde/tilde.c 2018-07-23 14:49:06.363623898 +0200 -@@ -196,7 +196,8 @@ tilde_expand (string) - int result_size, result_index; +diff -up which-2.21/tilde/tilde.c.coverity which-2.21/tilde/tilde.c +--- which-2.21/tilde/tilde.c.coverity 2008-01-16 18:51:57.000000000 +0100 ++++ which-2.21/tilde/tilde.c 2021-03-21 11:43:00.338160051 +0100 +@@ -193,10 +193,10 @@ tilde_expand (string) + const char *string; + { + char *result; +- int result_size, result_index; ++ int result_size = 0, result_index = 0; - result_index = result_size = 0; +- result_index = result_size = 0; - if (result = strchr (string, '~')) + result = strchr (string, '~'); + if (result) result = (char *)xmalloc (result_size = (strlen (string) + 16)); else result = (char *)xmalloc (result_size = (strlen (string) + 1)); -diff -up which-2.21/which.c.me which-2.21/which.c -diff -up which-2.21/which.c.me which-2.21/which.c ---- which-2.21/which.c.me 2018-07-23 15:09:04.355222509 +0200 -+++ which-2.21/which.c 2018-07-25 14:57:43.696309701 +0200 -@@ -671,6 +671,9 @@ int main(int argc, char *argv[]) - } +@@ -270,7 +270,7 @@ isolate_tilde_prefix (fname, lenp) + char *ret; + int i; + +- ret = (char *)xmalloc (strlen (fname)); ++ ret = (char *)xmalloc (strlen (fname) + 1); + #if defined (__MSDOS__) + for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++) + #else +diff -up which-2.21/which.c.coverity which-2.21/which.c +--- which-2.21/which.c.coverity 2015-03-19 17:50:24.000000000 +0100 ++++ which-2.21/which.c 2021-03-21 12:19:31.289160885 +0100 +@@ -76,16 +76,16 @@ static int skip_functions = 0, read_func + + static char *find_command_in_path(const char *name, const char *path_list, int *path_index) + { +- char *found = NULL, *full_path; ++ char *found = NULL, *full_path = NULL; + int status, name_len; + + name_len = strlen(name); ++ char *p; + + if (!absolute_program(name)) + absolute_path_given = 0; + else + { +- char *p; + absolute_path_given = 1; + + if (abs_path) +@@ -159,6 +159,7 @@ static char *find_command_in_path(const + free(full_path); } -+ if (abs_path) -+ free(abs_path); -+ - return fail_count; ++ name = NULL; p = NULL; path_list = NULL; + return (found); } +@@ -540,7 +541,7 @@ int main(int argc, char *argv[]) + int function_start_type = 0; + if (read_alias || read_functions) + { +- char buf[1024]; ++ char buf[1024] = {}; + int processing_aliases = read_alias; + + if (isatty(0)) diff --git a/which.spec b/which.spec index 222a377..a3bf2c3 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 22%{?dist} +Release: 23%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,10 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Mar 21 2021 Than Ngo - 2.21-23 +- fixed coverity issues +- improved which2.sh + * Thu Mar 18 2021 Than Ngo - 2.21-22 - fixed syntax error testcase: a=b which ls diff --git a/which2.sh b/which2.sh index f73023f..9b5e0b0 100644 --- a/which2.sh +++ b/which2.sh @@ -1,11 +1,16 @@ # Initialization script for bash, sh, mksh and ksh + +_declare="declare -f" +_opt="-f" + +if [ "$0" = "ksh" ] || [ "$0" = "-ksh" ] || [ "$0" = "mksh" ] || [ "$0" = "-mksh" ] ; then + _declare="typeset -f" + _opt="" +fi + which () { - if [ "$0" = "ksh" -o "$0" = "-ksh" -o "$0" = "mksh" -o "$0" = "-mksh" ] ; then - (alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ - export which - else - (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ - export -f which - fi +(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" } + +export ${_opt} which From 9542d05e680325f7d0ffddced31bd7923244c310 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 23 Mar 2021 20:15:21 +0100 Subject: [PATCH 25/54] fixed regression if SHELL=zsh --- which.spec | 5 ++++- which2.sh | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index a3bf2c3..fac26a9 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue Mar 23 2021 Than Ngo - 2.21-24 +- fixed regression if SHELL=zsh + * Sun Mar 21 2021 Than Ngo - 2.21-23 - fixed coverity issues - improved which2.sh diff --git a/which2.sh b/which2.sh index 9b5e0b0..2b8b20a 100644 --- a/which2.sh +++ b/which2.sh @@ -1,9 +1,11 @@ +# shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh _declare="declare -f" _opt="-f" +_shell="$(basename $SHELL)" -if [ "$0" = "ksh" ] || [ "$0" = "-ksh" ] || [ "$0" = "mksh" ] || [ "$0" = "-mksh" ] ; then +if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = "zsh" ] ; then _declare="typeset -f" _opt="" fi From 98662a9c460f663b1bef1887cfd28c6f7f1bfe5f Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 26 Apr 2021 14:02:33 +0200 Subject: [PATCH 26/54] improved which2.sh --- which.spec | 6 +++++- which2.sh | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/which.spec b/which.spec index fac26a9..676c9a0 100644 --- a/which.spec +++ b/which.spec @@ -1,13 +1,14 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 24%{?dist} +Release: 25%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Patch0: which-2.21-coverity-fixes.patch Url: https://savannah.gnu.org/projects/which/ +Requires: coreutils BuildRequires: make BuildRequires: gcc BuildRequires: readline-devel @@ -40,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Apr 26 2021 Than Ngo - 2.21-25 +- improved which2.sh + * Tue Mar 23 2021 Than Ngo - 2.21-24 - fixed regression if SHELL=zsh diff --git a/which2.sh b/which2.sh index 2b8b20a..16b930c 100644 --- a/which2.sh +++ b/which2.sh @@ -1,18 +1,18 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -_declare="declare -f" -_opt="-f" -_shell="$(basename $SHELL)" +which_declare="declare -f" +which_opt="-f" +which_shell="$(cat /proc/$$/comm)" -if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = "zsh" ] ; then - _declare="typeset -f" - _opt="" +if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then + which_declare="typeset -f" + which_opt="" fi which () { -(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" +(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" } -export ${_opt} which +export ${which_opt} which From 8fcb51a814dbc161fc67c7b0bc3e63678937157d Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 4 May 2021 09:26:33 +0200 Subject: [PATCH 27/54] Resolves: #1942153, fixed unbound variable --- which.spec | 5 ++++- which2.sh | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 676c9a0..a9c6df7 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue May 04 2021 Than Ngo - 2.21-26 +- Resolves: #1942153, fixed unbound variable + * Mon Apr 26 2021 Than Ngo - 2.21-25 - improved which2.sh diff --git a/which2.sh b/which2.sh index 16b930c..6ef7979 100644 --- a/which2.sh +++ b/which2.sh @@ -15,4 +15,5 @@ which () (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" } +export which_declare export ${which_opt} which From 996c9e58cca0efa7fb41ea3b3060c2a23c4f8841 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 20:54:58 +0000 Subject: [PATCH 28/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index a9c6df7..ad06ed9 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 26%{?dist} +Release: 27%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 2.21-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue May 04 2021 Than Ngo - 2.21-26 - Resolves: #1942153, fixed unbound variable From a9da4a55f24f6767129dcc51c32779f010039cb3 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sun, 10 Oct 2021 14:19:32 +0200 Subject: [PATCH 29/54] Resolves: #2009547, which treats function contents as aliases when parsing ksh --- which.spec | 5 ++++- which2.sh | 13 ++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/which.spec b/which.spec index ad06ed9..b644114 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 27%{?dist} +Release: 28%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Oct 10 2021 Than Ngo - 2.21-28 +- Resolves: #2009547, which treats function contents as aliases when parsing ksh + * Fri Jul 23 2021 Fedora Release Engineering - 2.21-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 6ef7979..2a108e6 100644 --- a/which2.sh +++ b/which2.sh @@ -1,19 +1,18 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -which_declare="declare -f" -which_opt="-f" which_shell="$(cat /proc/$$/comm)" if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then - which_declare="typeset -f" + alias which_declare="typeset -fS" which_opt="" +else + which_opt="-f" + alias which_declare="declare -f" fi -which () -{ -(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" +which () { + (alias; which_declare) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } -export which_declare export ${which_opt} which From 1fa13a9bffb7057b9d33519cc63bc7efa5be1192 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 15 Oct 2021 11:34:21 +0200 Subject: [PATCH 30/54] - Fixed regression, use export instead alias --- which.spec | 5 ++++- which2.sh | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/which.spec b/which.spec index b644114..4424768 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 28%{?dist} +Release: 29%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Fri Oct 15 2021 Than Ngo - 2.21-29 +- Fixed regression, use export instead alias + * Sun Oct 10 2021 Than Ngo - 2.21-28 - Resolves: #2009547, which treats function contents as aliases when parsing ksh diff --git a/which2.sh b/which2.sh index 2a108e6..610a415 100644 --- a/which2.sh +++ b/which2.sh @@ -1,18 +1,24 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -which_shell="$(cat /proc/$$/comm)" +case "$(cat /proc/$$/comm)" in +ksh|mksh) + which_declare="typeset -fS" + which_opt="" + ;; +zsh) + which_declare="typeset -f" + which_opt="" + ;; +*) + which_declare="declare -f" + which_opt="-f" + ;; +esac -if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then - alias which_declare="typeset -fS" - which_opt="" -else - which_opt="-f" - alias which_declare="declare -f" -fi - which () { - (alias; which_declare) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ + (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } +export which_declare export ${which_opt} which From 1784ef6a01853d2f68720539b5cab604d332d378 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 26 Oct 2021 18:03:43 +0200 Subject: [PATCH 31/54] disable the --read-functions option in korn shells --- which.spec | 5 ++++- which2.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/which.spec b/which.spec index 4424768..474b530 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 29%{?dist} +Release: 30%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue Oct 26 2021 Than Ngo - 2.21-30 +- disable the --read-functions option in korn shells + * Fri Oct 15 2021 Than Ngo - 2.21-29 - Fixed regression, use export instead alias diff --git a/which2.sh b/which2.sh index 610a415..ae2a254 100644 --- a/which2.sh +++ b/which2.sh @@ -3,7 +3,7 @@ case "$(cat /proc/$$/comm)" in ksh|mksh) - which_declare="typeset -fS" + which_declare="" which_opt="" ;; zsh) @@ -17,7 +17,7 @@ zsh) esac which () { - (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ + (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } export which_declare From 0811db734b52717ea74eac13a36452e46de4ae35 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 2 Dec 2021 15:53:11 +0100 Subject: [PATCH 32/54] check shell correctly --- which.spec | 5 ++++- which2.sh | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/which.spec b/which.spec index 474b530..e37062f 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 30%{?dist} +Release: 31%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Thu Dec 02 2021 Than Ngo - 2.21-31 +- check shell correctly + * Tue Oct 26 2021 Than Ngo - 2.21-30 - disable the --read-functions option in korn shells diff --git a/which2.sh b/which2.sh index ae2a254..0f47f9e 100644 --- a/which2.sh +++ b/which2.sh @@ -1,8 +1,8 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -case "$(cat /proc/$$/comm)" in -ksh|mksh) +case "$(basename $(readlink /proc/$$/exe))" in +*ksh*) which_declare="" which_opt="" ;; @@ -10,10 +10,14 @@ zsh) which_declare="typeset -f" which_opt="" ;; -*) +bash|sh) which_declare="declare -f" which_opt="-f" ;; +*) + which_declare="" + which_opt="" + ;; esac which () { From 372c1bae6c290bc4bfab51c92e984fe93e5eb89f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jan 2022 04:26:22 +0000 Subject: [PATCH 33/54] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index e37062f..7598a4f 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 31%{?dist} +Release: 32%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jan 22 2022 Fedora Release Engineering - 2.21-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Thu Dec 02 2021 Than Ngo - 2.21-31 - check shell correctly From 1be483011a8a2f9948dfc10cb88deb300abbbaaf Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 9 Feb 2022 16:17:41 +0100 Subject: [PATCH 34/54] make which2.sh script more robust --- which.spec | 5 ++++- which2.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index 7598a4f..f064b05 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 32%{?dist} +Release: 33%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Feb 09 2022 Than Ngo - 2.21-33 +- make which2.sh script more robust, + * Sat Jan 22 2022 Fedora Release Engineering - 2.21-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 0f47f9e..bca5347 100644 --- a/which2.sh +++ b/which2.sh @@ -20,7 +20,7 @@ bash|sh) ;; esac -which () { +function which { (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } From c109904502043b128a2dc3495e4214e3ec3db564 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 23 Jul 2022 12:23:18 +0000 Subject: [PATCH 35/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index f064b05..99dda85 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 33%{?dist} +Release: 34%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jul 23 2022 Fedora Release Engineering - 2.21-34 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Wed Feb 09 2022 Than Ngo - 2.21-33 - make which2.sh script more robust, From b5fc0eb6b1ab10d5564859347e64b84313cc57e0 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 5 Aug 2022 15:04:50 +0200 Subject: [PATCH 36/54] disable which2 alias and function by default as it caused more problems than benefits --- which.spec | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/which.spec b/which.spec index 99dda85..2eb0ebd 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,9 @@ +%globale has_which2_alias 0 + Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 34%{?dist} +Release: 35%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -29,18 +31,25 @@ the specified program is in your PATH. %make_install mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d -install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ -rm -f $RPM_BUILD_ROOT%{_infodir}/dir +%if %{has_which2_alias} + install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ + rm -f $RPM_BUILD_ROOT%{_infodir}/dir +%endif %files %license COPYING %doc EXAMPLES README AUTHORS NEWS +%if %{has_which2_alias} %attr(0644,root,root) %{_sysconfdir}/profile.d/which2.* +%endif %{_bindir}/which %{_infodir}/which.info* %{_mandir}/man1/which.1* %changelog +* Fri Aug 05 2022 Than Ngo - 2.21-35 +- disable which2 alias and function by default as it caused more problems than benefits + * Sat Jul 23 2022 Fedora Release Engineering - 2.21-34 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 9ec53577bd09c5ff3d107a177c92780feafede63 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 5 Aug 2022 15:12:48 +0200 Subject: [PATCH 37/54] fixed typo --- which.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 2eb0ebd..a6eccf6 100644 --- a/which.spec +++ b/which.spec @@ -1,4 +1,4 @@ -%globale has_which2_alias 0 +%global has_which2_alias 0 Summary: Displays where a particular program in your path is located Name: which From 1fd77d25337423283696307a9dcd203bf1a854f5 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 5 Aug 2022 15:20:47 +0200 Subject: [PATCH 38/54] drop dir file --- which.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/which.spec b/which.spec index a6eccf6..c820dac 100644 --- a/which.spec +++ b/which.spec @@ -33,8 +33,8 @@ the specified program is in your PATH. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d %if %{has_which2_alias} install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ - rm -f $RPM_BUILD_ROOT%{_infodir}/dir %endif +rm -f $RPM_BUILD_ROOT%{_infodir}/dir %files %license COPYING From 9a3c8653505ecfae0c5b44ca9d97b43b98aa4ba0 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 7 Nov 2022 16:29:33 +0100 Subject: [PATCH 39/54] which fails for long path --- which-2.21-path_max.patch | 46 +++++++++++++++++++++++++++++++++++++++ which.spec | 11 ++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 which-2.21-path_max.patch diff --git a/which-2.21-path_max.patch b/which-2.21-path_max.patch new file mode 100644 index 0000000..eec9958 --- /dev/null +++ b/which-2.21-path_max.patch @@ -0,0 +1,46 @@ +diff -up which-2.21/which.c.me which-2.21/which.c +--- which-2.21/which.c.me 2022-11-07 13:11:03.580798950 +0100 ++++ which-2.21/which.c 2022-11-07 15:45:41.366085798 +0100 +@@ -19,10 +19,15 @@ + #include "sys.h" + #include + #include ++#include + #include "getopt.h" + #include "tilde/tilde.h" + #include "bash.h" + ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif ++ + static const char *progname; + + static void print_usage(FILE *out) +@@ -63,7 +68,7 @@ static void print_fail(const char *name, + fprintf(stderr, "%s: no %s in (%s)\n", progname, name, path_list); + } + +-static char home[256]; ++static char home[PATH_MAX]; + static size_t homelen = 0; + + static int absolute_path_given; +@@ -163,7 +168,7 @@ static char *find_command_in_path(const + return (found); + } + +-static char cwd[256]; ++static char cwd[PATH_MAX]; + static size_t cwdlen; + + static void get_current_working_directory(void) +@@ -195,7 +200,7 @@ static void get_current_working_director + + static char *path_clean_up(const char *path) + { +- static char result[256]; ++ static char result[PATH_MAX]; + + const char *p1 = path; + char *p2 = result; diff --git a/which.spec b/which.spec index c820dac..07fe94b 100644 --- a/which.spec +++ b/which.spec @@ -3,12 +3,13 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 35%{?dist} +Release: 36%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Patch0: which-2.21-coverity-fixes.patch +Patch1: which-2.21-path_max.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make @@ -20,9 +21,8 @@ The which command shows the full pathname of a specified program, if the specified program is in your PATH. %prep -%setup -q -%patch0 -p1 -b .coverity - +%autosetup -p1 + %build %configure %make_build @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Nov 07 2022 Than Ngo - 2.21-36 +- which fails for long path + * Fri Aug 05 2022 Than Ngo - 2.21-35 - disable which2 alias and function by default as it caused more problems than benefits From 53706aeb4c9c437ccd0c9d1d62187e422cf3ac46 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 7 Nov 2022 16:37:08 +0100 Subject: [PATCH 40/54] using alias instead export --- which2.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/which2.sh b/which2.sh index bca5347..a7db49c 100644 --- a/which2.sh +++ b/which2.sh @@ -2,27 +2,12 @@ # Initialization script for bash, sh, mksh and ksh case "$(basename $(readlink /proc/$$/exe))" in -*ksh*) - which_declare="" - which_opt="" - ;; -zsh) - which_declare="typeset -f" - which_opt="" +*ksh*|zsh) + alias which='alias | /usr/bin/which --tty-only --read-alias --show-tilde --show-dot' ;; bash|sh) - which_declare="declare -f" - which_opt="-f" + alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' ;; *) - which_declare="" - which_opt="" ;; esac - -function which { - (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ -} - -export which_declare -export ${which_opt} which From e3c4a9361790471df80b817777c2d6c59b8bf5d3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 21 Jan 2023 06:47:34 +0000 Subject: [PATCH 41/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 07fe94b..a3d34dc 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 36%{?dist} +Release: 37%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jan 21 2023 Fedora Release Engineering - 2.21-37 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Mon Nov 07 2022 Than Ngo - 2.21-36 - which fails for long path From a358eb3b08d12cb05df5c85ea2c4b39dd34cf1fe Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sun, 19 Feb 2023 11:30:53 +0100 Subject: [PATCH 42/54] migrated to SPDX license --- which.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index a3d34dc..e8035c8 100644 --- a/which.spec +++ b/which.spec @@ -3,8 +3,8 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 37%{?dist} -License: GPLv3 +Release: 38%{?dist} +License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Feb 19 2023 Than Ngo - 2.21-38 +- migrated to SPDX license + * Sat Jan 21 2023 Fedora Release Engineering - 2.21-37 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 1d13651d9f0985ad3564813de8ef8e985ad34dc8 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 8 Mar 2023 11:42:53 +0100 Subject: [PATCH 43/54] fixed #2175953, enable which2 alias --- which.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/which.spec b/which.spec index e8035c8..22533b7 100644 --- a/which.spec +++ b/which.spec @@ -1,9 +1,9 @@ -%global has_which2_alias 0 +%global has_which2_alias 1 Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 38%{?dist} +Release: 39%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -13,7 +13,7 @@ Patch1: which-2.21-path_max.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make -BuildRequires: gcc +BuildRequires: gcc BuildRequires: readline-devel %description @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Mar 08 2023 Than Ngo - 2.21-39 +- fixed #2175953, enable which2 alias + * Sun Feb 19 2023 Than Ngo - 2.21-38 - migrated to SPDX license From 1f2a5801fc5aeb9706db11a1a87ddd32afa94dc1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jul 2023 18:10:40 +0000 Subject: [PATCH 44/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 22533b7..491e253 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 39%{?dist} +Release: 40%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jul 22 2023 Fedora Release Engineering - 2.21-40 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Wed Mar 08 2023 Than Ngo - 2.21-39 - fixed #2175953, enable which2 alias From 34aba6f9e40e476d3b286c18082228ce255ae42e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 08:43:54 +0000 Subject: [PATCH 45/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 491e253..9a568b1 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 40%{?dist} +Release: 41%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jan 27 2024 Fedora Release Engineering - 2.21-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sat Jul 22 2023 Fedora Release Engineering - 2.21-40 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From f9cdb1c07820e9796e94a6f2aee62f3e7e0d7240 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 09:18:36 +0000 Subject: [PATCH 46/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 9a568b1..18ebe1a 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 41%{?dist} +Release: 42%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 2.21-42 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Sat Jan 27 2024 Fedora Release Engineering - 2.21-41 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 01febed4623519db7e796a97946a27b6536ec71f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 14:58:54 +0000 Subject: [PATCH 47/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 18ebe1a..0fe0527 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 42%{?dist} +Release: 43%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -47,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 2.21-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Sat Jul 20 2024 Fedora Release Engineering - 2.21-42 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From af5b87327273b13d96fd9c3928012543b04c3653 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 27 Jan 2025 10:35:14 +0100 Subject: [PATCH 48/54] Fixed rhbz#2342020, update to 2.22 --- .gitignore | 1 + sources | 2 +- which-2.21-coverity-fixes.patch | 65 --------------------------------- which-2.21-path_max.patch | 46 ----------------------- which-2.21-warning.patch | 13 +++++++ which.spec | 10 +++-- 6 files changed, 21 insertions(+), 116 deletions(-) delete mode 100644 which-2.21-coverity-fixes.patch delete mode 100644 which-2.21-path_max.patch create mode 100644 which-2.21-warning.patch diff --git a/.gitignore b/.gitignore index e93fa2c..f2decb0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ which-2.18.tar.gz which-2.19.tar.gz /which-2.20.tar.gz /which-2.21.tar.gz +/which-2.22.tar.gz diff --git a/sources b/sources index 4b6d13d..0effe33 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -097ff1a324ae02e0a3b0369f07a7544a which-2.21.tar.gz +SHA512 (which-2.22.tar.gz) = faa56d0ba1e4bd33c5e2adee5f580884d8dc8b0835a0e5360485e1d0a6fd581bcb3115d550750c7a2f867372034375d00aa9362312aede5d814e116bcacfe627 diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch deleted file mode 100644 index fbcb636..0000000 --- a/which-2.21-coverity-fixes.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -up which-2.21/tilde/tilde.c.coverity which-2.21/tilde/tilde.c ---- which-2.21/tilde/tilde.c.coverity 2008-01-16 18:51:57.000000000 +0100 -+++ which-2.21/tilde/tilde.c 2021-03-21 11:43:00.338160051 +0100 -@@ -193,10 +193,10 @@ tilde_expand (string) - const char *string; - { - char *result; -- int result_size, result_index; -+ int result_size = 0, result_index = 0; - -- result_index = result_size = 0; -- if (result = strchr (string, '~')) -+ result = strchr (string, '~'); -+ if (result) - result = (char *)xmalloc (result_size = (strlen (string) + 16)); - else - result = (char *)xmalloc (result_size = (strlen (string) + 1)); -@@ -270,7 +270,7 @@ isolate_tilde_prefix (fname, lenp) - char *ret; - int i; - -- ret = (char *)xmalloc (strlen (fname)); -+ ret = (char *)xmalloc (strlen (fname) + 1); - #if defined (__MSDOS__) - for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++) - #else -diff -up which-2.21/which.c.coverity which-2.21/which.c ---- which-2.21/which.c.coverity 2015-03-19 17:50:24.000000000 +0100 -+++ which-2.21/which.c 2021-03-21 12:19:31.289160885 +0100 -@@ -76,16 +76,16 @@ static int skip_functions = 0, read_func - - static char *find_command_in_path(const char *name, const char *path_list, int *path_index) - { -- char *found = NULL, *full_path; -+ char *found = NULL, *full_path = NULL; - int status, name_len; - - name_len = strlen(name); -+ char *p; - - if (!absolute_program(name)) - absolute_path_given = 0; - else - { -- char *p; - absolute_path_given = 1; - - if (abs_path) -@@ -159,6 +159,7 @@ static char *find_command_in_path(const - free(full_path); - } - -+ name = NULL; p = NULL; path_list = NULL; - return (found); - } - -@@ -540,7 +541,7 @@ int main(int argc, char *argv[]) - int function_start_type = 0; - if (read_alias || read_functions) - { -- char buf[1024]; -+ char buf[1024] = {}; - int processing_aliases = read_alias; - - if (isatty(0)) diff --git a/which-2.21-path_max.patch b/which-2.21-path_max.patch deleted file mode 100644 index eec9958..0000000 --- a/which-2.21-path_max.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -up which-2.21/which.c.me which-2.21/which.c ---- which-2.21/which.c.me 2022-11-07 13:11:03.580798950 +0100 -+++ which-2.21/which.c 2022-11-07 15:45:41.366085798 +0100 -@@ -19,10 +19,15 @@ - #include "sys.h" - #include - #include -+#include - #include "getopt.h" - #include "tilde/tilde.h" - #include "bash.h" - -+#ifndef PATH_MAX -+#define PATH_MAX 4096 -+#endif -+ - static const char *progname; - - static void print_usage(FILE *out) -@@ -63,7 +68,7 @@ static void print_fail(const char *name, - fprintf(stderr, "%s: no %s in (%s)\n", progname, name, path_list); - } - --static char home[256]; -+static char home[PATH_MAX]; - static size_t homelen = 0; - - static int absolute_path_given; -@@ -163,7 +168,7 @@ static char *find_command_in_path(const - return (found); - } - --static char cwd[256]; -+static char cwd[PATH_MAX]; - static size_t cwdlen; - - static void get_current_working_directory(void) -@@ -195,7 +200,7 @@ static void get_current_working_director - - static char *path_clean_up(const char *path) - { -- static char result[256]; -+ static char result[PATH_MAX]; - - const char *p1 = path; - char *p2 = result; diff --git a/which-2.21-warning.patch b/which-2.21-warning.patch new file mode 100644 index 0000000..6031014 --- /dev/null +++ b/which-2.21-warning.patch @@ -0,0 +1,13 @@ +diff -up which-2.22/tilde.c.me which-2.22/tilde.c +--- which-2.22/tilde.c.me 2025-01-27 10:30:39.731725763 +0100 ++++ which-2.22/tilde.c 2025-01-27 10:32:11.158379146 +0100 +@@ -189,7 +189,8 @@ char *tilde_expand(const char *string) + int result_size, result_index; + + result_index = result_size = 0; +- if (result = strchr(string, '~')) ++ result = strchr(string, '~'); ++ if (result) + result = (char *) xmalloc(result_size = (strlen(string) + 16)); + else + result = (char *) xmalloc(result_size = (strlen(string) + 1)); diff --git a/which.spec b/which.spec index 0fe0527..d5d0559 100644 --- a/which.spec +++ b/which.spec @@ -2,14 +2,13 @@ Summary: Displays where a particular program in your path is located Name: which -Version: 2.21 -Release: 43%{?dist} +Version: 2.22 +Release: 1%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh -Patch0: which-2.21-coverity-fixes.patch -Patch1: which-2.21-path_max.patch +Patch0: which-2.21-warning.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make @@ -47,6 +46,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Jan 27 2025 Than Ngo - 2.22-1 +- Fixed rhbz#2342020, update to 2.22 + * Sun Jan 19 2025 Fedora Release Engineering - 2.21-43 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From eaa063e13ee0ee38934a9a1dbb6892a09565eec9 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 27 Jan 2025 11:16:27 +0100 Subject: [PATCH 49/54] Add BR on gcc-c++ --- which.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/which.spec b/which.spec index d5d0559..de922ac 100644 --- a/which.spec +++ b/which.spec @@ -12,7 +12,7 @@ Patch0: which-2.21-warning.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make -BuildRequires: gcc +BuildRequires: gcc gcc-c++ BuildRequires: readline-devel %description From 7868f048fbcce35aafc6c00b2fda3ff381fa192b Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sat, 1 Feb 2025 22:38:21 +0100 Subject: [PATCH 50/54] Fixed rhbz#2343113, regression --- which-2.22-regression.patch | 12 ++++++++++++ which.spec | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 which-2.22-regression.patch diff --git a/which-2.22-regression.patch b/which-2.22-regression.patch new file mode 100644 index 0000000..1eb652b --- /dev/null +++ b/which-2.22-regression.patch @@ -0,0 +1,12 @@ +diff -up which-2.22/which.c.me which-2.22/which.c +--- which-2.22/which.c.me 2025-02-01 22:35:34.519760450 +0100 ++++ which-2.22/which.c 2025-02-01 22:35:48.988116981 +0100 +@@ -278,7 +278,7 @@ static char *path_clean_up(const char *p + strcpy(result, path); + return result; + } +- if (!IS_DIRSEP(*p2)) ++ if (IS_DIRSEP(*p2)) + ++cnt; + } + while (cnt != 3); diff --git a/which.spec b/which.spec index de922ac..17d8a6e 100644 --- a/which.spec +++ b/which.spec @@ -3,12 +3,13 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.22 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Patch0: which-2.21-warning.patch +Patch1: which-2.22-regression.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make @@ -46,6 +47,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sat Feb 01 2025 Than Ngo - 2.22-2 +- Fixed rhbz#2343113, regression + * Mon Jan 27 2025 Than Ngo - 2.22-1 - Fixed rhbz#2342020, update to 2.22 From 227e833d5306dfce404a209f1fed24a9ff4cd178 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 3 Feb 2025 15:49:08 +0100 Subject: [PATCH 51/54] Fixed rhbz#2343361, update to 2.23 --- .gitignore | 1 + sources | 2 +- which-2.22-regression.patch | 12 ------------ which.spec | 8 +++++--- 4 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 which-2.22-regression.patch diff --git a/.gitignore b/.gitignore index f2decb0..ebf70cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ which-2.19.tar.gz /which-2.20.tar.gz /which-2.21.tar.gz /which-2.22.tar.gz +/which-2.23.tar.gz diff --git a/sources b/sources index 0effe33..493334d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (which-2.22.tar.gz) = faa56d0ba1e4bd33c5e2adee5f580884d8dc8b0835a0e5360485e1d0a6fd581bcb3115d550750c7a2f867372034375d00aa9362312aede5d814e116bcacfe627 +SHA512 (which-2.23.tar.gz) = 738807f79e8cfc5967541a28ae7021247c04c4177279f09be2c19c069af450a7e3b19baf9079fe5569b25b4630bb400be242a123647e52c9fe54f0ad007317bf diff --git a/which-2.22-regression.patch b/which-2.22-regression.patch deleted file mode 100644 index 1eb652b..0000000 --- a/which-2.22-regression.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up which-2.22/which.c.me which-2.22/which.c ---- which-2.22/which.c.me 2025-02-01 22:35:34.519760450 +0100 -+++ which-2.22/which.c 2025-02-01 22:35:48.988116981 +0100 -@@ -278,7 +278,7 @@ static char *path_clean_up(const char *p - strcpy(result, path); - return result; - } -- if (!IS_DIRSEP(*p2)) -+ if (IS_DIRSEP(*p2)) - ++cnt; - } - while (cnt != 3); diff --git a/which.spec b/which.spec index 17d8a6e..85af794 100644 --- a/which.spec +++ b/which.spec @@ -2,14 +2,13 @@ Summary: Displays where a particular program in your path is located Name: which -Version: 2.22 -Release: 2%{?dist} +Version: 2.23 +Release: 1%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh Source2: which2.csh Patch0: which-2.21-warning.patch -Patch1: which-2.22-regression.patch Url: https://savannah.gnu.org/projects/which/ Requires: coreutils BuildRequires: make @@ -47,6 +46,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Mon Feb 03 2025 Than Ngo - 2.23-1 +- Fixed rhbz#2343361, update to 2.23 + * Sat Feb 01 2025 Than Ngo - 2.22-2 - Fixed rhbz#2343113, regression From d6c3c6e51783bc42154a81e0ad53e45723fabc86 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 18 Jun 2025 17:36:05 +0200 Subject: [PATCH 52/54] Add a check to ensure that /proc/$$/exe can be read --- which.spec | 5 ++++- which2.sh | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index 85af794..317c1e3 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.23 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -46,6 +46,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed Jun 18 2025 Than Ngo - 2.23-2 +- Add a check to ensure that /proc/$$/exe can be read + * Mon Feb 03 2025 Than Ngo - 2.23-1 - Fixed rhbz#2343361, update to 2.23 diff --git a/which2.sh b/which2.sh index a7db49c..9829a06 100644 --- a/which2.sh +++ b/which2.sh @@ -1,7 +1,12 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -case "$(basename $(readlink /proc/$$/exe))" in +if [ -r /proc/$$/exe ]; then + SHELLNAME=$(basename $(readlink /proc/$$/exe)) +else + SHELLNAME="unknown" +fi +case "$SHELLNAME" in *ksh*|zsh) alias which='alias | /usr/bin/which --tty-only --read-alias --show-tilde --show-dot' ;; From c68f9f566f6121338a25628ecea8ced339f087bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Mon, 7 Jul 2025 12:54:06 +0200 Subject: [PATCH 53/54] tests: migrate from STI to TMT Related: https://fedoraproject.org/wiki/Changes/DisableSTI --- .fmf/version | 1 + plans/ci.fmf | 5 + .../test.basic-functionality-test.log | 261 ------------------ tests/artifacts/test.log | 1 - tests/basic-functionality-test/main.fmf | 14 + tests/basic-functionality-test/runtest.sh | 1 - tests/tests.retry | 1 - tests/tests.yml | 13 - 8 files changed, 20 insertions(+), 277 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/ci.fmf delete mode 100644 tests/artifacts/test.basic-functionality-test.log delete mode 100644 tests/artifacts/test.log create mode 100644 tests/basic-functionality-test/main.fmf delete mode 100644 tests/tests.retry delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/artifacts/test.basic-functionality-test.log b/tests/artifacts/test.basic-functionality-test.log deleted file mode 100644 index 5c74efd..0000000 --- a/tests/artifacts/test.basic-functionality-test.log +++ /dev/null @@ -1,261 +0,0 @@ -posix on -:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off -:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off -:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang -:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: Setup -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -which-2.21-4.fc27.x86_64 -:: [ PASS ] :: Checking for the presence of which rpm -:: [ 12:25:31 ] :: Package versions: -:: [ 12:25:31 ] :: Package versions: -:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64 -:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64 -:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)' -:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)' -:: [ PASS ] :: Creating tmp directory (Expected 0, got 0) -:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL' -:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL' -/tmp/tmp.cVaYqMMJWL /usr/local/bin/basic-functionality-test -:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) -:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' -:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' -:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test --version -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )' -:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )' -:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0) -:: [ BEGIN ] :: Running 'which --version' -:: [ BEGIN ] :: Running 'which --version' -GNU which v2.21, Copyright (C) 1999 - 2015 Carlo Wood. -GNU which comes with ABSOLUTELY NO WARRANTY; -This program is free software; your freedom to use, change -and distribute this program is protected by the GPL. -:: [ PASS ] :: Command 'which --version' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test locating the bash binary -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'which bash' -:: [ BEGIN ] :: Running 'which bash' -/bin/bash -:: [ PASS ] :: Command 'which bash' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test an alias -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc' -:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc' -:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0) -:: [ BEGIN ] :: Running 'echo -e 'alias foo=true -which foo' | bash -i' -:: [ BEGIN ] :: Running 'echo -e 'alias foo=true -which foo' | bash -i' -[root@localhost tmp.cVaYqMMJWL]# alias foo=true -[root@localhost tmp.cVaYqMMJWL]# which foo -]0;root@localhost:/tmp/tmp.cVaYqMMJWL]0;root@localhost:/tmp/tmp.cVaYqMMJWLalias foo='true' - /bin/true -[root@localhost tmp.cVaYqMMJWL]# exit -]0;root@localhost:/tmp/tmp.cVaYqMMJWL:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true'' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test non existing command -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'which foobar' -:: [ BEGIN ] :: Running 'which foobar' -which: no foobar in (/sbin:/bin:/usr/sbin:/usr/bin) -:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test with customized PATH -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' -/tmp/tmp.cVaYqMMJWL/true -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test options -a / --all -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' -/tmp/tmp.cVaYqMMJWL/true -/bin/true -/usr/bin/true -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true' -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' -:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' -/tmp/tmp.cVaYqMMJWL/true -/bin/true -/usr/bin/true -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true' - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: Cleanup -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ BEGIN ] :: Running 'popd' -:: [ BEGIN ] :: Running 'popd' -/usr/local/bin/basic-functionality-test -:: [ PASS ] :: Command 'popd' (Expected 0, got 0) -:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL' -:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL' -:: [ PASS ] :: Removing tmp directory (Expected 0, got 0) - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: TEST PROTOCOL -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ LOG ] :: Package : unknown -:: [ LOG ] :: Installed : which-2.21-4.fc27.x86_64 -:: [ LOG ] :: beakerlib RPM : beakerlib-1.16-4.fc27 -:: [ LOG ] :: bl-redhat RPM : not installed -:: [ LOG ] :: Test started : 2017-12-11 12:25:31 EET -:: [ LOG ] :: Test finished : 2017-12-11 12:25:34 EET -:: [ LOG ] :: Test name : basic-functionality-test -:: [ LOG ] :: Distro : Fedora release 27 (Twenty Seven) -:: [ LOG ] :: Hostname : localhost.localdomain -:: [ LOG ] :: Architecture : x86_64 - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: Test description -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -PURPOSE of /CoreOS/which/Sanity/basic-functionality-test -Description: tests basic functionality -Author: Karel Srot - -tests following scenarios: - * test --version - * test locating the bash binary - * test an alias - * test non existing command - * test with customized PATH - * test options -a / --all - -:: [ WARNING ] :: POSIX mode detected and switched off -:: [ WARNING ] :: Please fix your test to have /bin/bash shebang - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: Setup -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Checking for the presence of which rpm -:: [ LOG ] :: Package versions: -:: [ LOG ] :: which-2.21-4.fc27.x86_64 -:: [ PASS ] :: Creating tmp directory (Expected 0, got 0) -:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) -:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0) -:: [ LOG ] :: Duration: 1s -:: [ LOG ] :: Assertions: 4 good, 0 bad -:: [ PASS ] :: RESULT: Setup - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test --version -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0) -:: [ PASS ] :: Command 'which --version' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21' -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 3 good, 0 bad -:: [ PASS ] :: RESULT: test --version - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test locating the bash binary -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'which bash' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash' -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 2 good, 0 bad -:: [ PASS ] :: RESULT: test locating the bash binary - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test an alias -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0) -:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true'' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true' -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 4 good, 0 bad -:: [ PASS ] :: RESULT: test an alias - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test non existing command -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)' -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 2 good, 0 bad -:: [ PASS ] :: RESULT: test non existing command - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test with customized PATH -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true' -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 2 good, 0 bad -:: [ PASS ] :: RESULT: test with customized PATH - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: test options -a / --all -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true' -:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0) -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true' -:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true' -:: [ LOG ] :: Duration: 1s -:: [ LOG ] :: Assertions: 6 good, 0 bad -:: [ PASS ] :: RESULT: test options -a / --all - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: Cleanup -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ PASS ] :: Command 'popd' (Expected 0, got 0) -:: [ PASS ] :: Removing tmp directory (Expected 0, got 0) -:: [ LOG ] :: Duration: 0s -:: [ LOG ] :: Assertions: 2 good, 0 bad -:: [ PASS ] :: RESULT: Cleanup - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: [ LOG ] :: basic-functionality-test -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: [ LOG ] :: Phases: 8 good, 0 bad -:: [ PASS ] :: RESULT: basic-functionality-test -:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml -:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml -:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt -:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt diff --git a/tests/artifacts/test.log b/tests/artifacts/test.log deleted file mode 100644 index efaf4f6..0000000 --- a/tests/artifacts/test.log +++ /dev/null @@ -1 +0,0 @@ -PASS basic-functionality-test diff --git a/tests/basic-functionality-test/main.fmf b/tests/basic-functionality-test/main.fmf new file mode 100644 index 0000000..5c98a29 --- /dev/null +++ b/tests/basic-functionality-test/main.fmf @@ -0,0 +1,14 @@ +summary: tests basic functionality +description: "tests following scenarios:\n * test --version\n * test locating the + bash binary\n * test an alias\n * test non existing command\n * test with customized + PATH\n * test options -a / --all\n" +contact: Karel Srot +component: + - which +test: ./runtest.sh +framework: beakerlib +recommend: + - which +duration: 5m +extra-summary: /CoreOS/which/Sanity/basic-functionality-test +extra-task: /CoreOS/which/Sanity/basic-functionality-test diff --git a/tests/basic-functionality-test/runtest.sh b/tests/basic-functionality-test/runtest.sh index d46f002..c33c1c6 100755 --- a/tests/basic-functionality-test/runtest.sh +++ b/tests/basic-functionality-test/runtest.sh @@ -27,7 +27,6 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Include Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="which" diff --git a/tests/tests.retry b/tests/tests.retry deleted file mode 100644 index 2fbb50c..0000000 --- a/tests/tests.retry +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index b5b96d8..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# Run tests in all contexts -- hosts: localhost - tags: - - classic - - container - - atomic - roles: - - role: standard-test-beakerlib - tests: - - basic-functionality-test - required_packages: - - which From ac38d264ed7d568632294389b9245f4272156986 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 20:24:07 +0000 Subject: [PATCH 54/54] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- which.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/which.spec b/which.spec index 317c1e3..7174222 100644 --- a/which.spec +++ b/which.spec @@ -3,7 +3,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.23 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-3.0-only Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -46,6 +46,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 2.23-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Wed Jun 18 2025 Than Ngo - 2.23-2 - Add a check to ensure that /proc/$$/exe can be read