From 2ee422a215cfdc75330deb257c19b073a3f11725 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Thu, 15 Oct 2020 13:43:32 -0700 Subject: [PATCH] RHEL 9.0.0 Alpha bootstrap The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/which#bec780888626816d6da8a175532cde3140f0e08d --- .gitignore | 5 + STAGE1-which | 7 + sources | 1 + .../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 + which-2.21-coverity-fixes.patch | 27 ++ which.spec | 322 ++++++++++++++++++ which2.csh | 3 + which2.sh | 7 + 14 files changed, 813 insertions(+) create mode 100644 STAGE1-which create mode 100644 sources 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 create mode 100644 which-2.21-coverity-fixes.patch create mode 100644 which.spec create mode 100644 which2.csh create mode 100644 which2.sh diff --git a/.gitignore b/.gitignore index e69de29..e93fa2c 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,5 @@ +which-2.16.tar.gz +which-2.18.tar.gz +which-2.19.tar.gz +/which-2.20.tar.gz +/which-2.21.tar.gz diff --git a/STAGE1-which b/STAGE1-which new file mode 100644 index 0000000..f80f9ca --- /dev/null +++ b/STAGE1-which @@ -0,0 +1,7 @@ +srpm $1 +mcd $BUILDDIR/$1 +$SRC/${1}-*/configure $TCONFIGARGS +notparallel +test -d tools/gnulib/lib && make $J V=1 -C tools/gnulib/lib +make $J V=1 +make $J install DESTDIR=${ROOTFS} diff --git a/sources b/sources new file mode 100644 index 0000000..4b6d13d --- /dev/null +++ b/sources @@ -0,0 +1 @@ +097ff1a324ae02e0a3b0369f07a7544a which-2.21.tar.gz 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 diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch new file mode 100644 index 0000000..0be9e3f --- /dev/null +++ b/which-2.21-coverity-fixes.patch @@ -0,0 +1,27 @@ +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 -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 new file mode 100644 index 0000000..23ec778 --- /dev/null +++ b/which.spec @@ -0,0 +1,322 @@ +Summary: Displays where a particular program in your path is located +Name: which +Version: 2.21 +Release: 20%{?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 + +%description +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 + +%build +%configure +%make_build + +%install +%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 + +%files +%license COPYING +%doc EXAMPLES README AUTHORS NEWS +%attr(0644,root,root) %{_sysconfdir}/profile.d/which2.* +%{_bindir}/which +%{_infodir}/which.info* +%{_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 + +* 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 + +* 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 + +* Mon Feb 04 2019 Than Ngo - 2.21-14 +- bump release + +* 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 + +* 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 + +* 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 +- 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 + +* 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 + +* Thu Aug 03 2017 Fedora Release Engineering - 2.21-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.21-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 2.21-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Jun 27 2016 Than Ngo - 2.21-1 +- update to 2.21 + +* Fri Feb 05 2016 Fedora Release Engineering - 2.20-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 2.20-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Feb 21 2015 Till Maas - 2.20-11 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Thu Feb 19 2015 Till Maas - 2.20-10 +- Use alias instead of exported function for which to avoid bashism, +http://unix.stackexchange.com/questions/59360/#59431 + +* Wed Feb 18 2015 Till Maas - 2.20-9 +- Check functions (#1194044) +- Use %%license + +* Mon Aug 18 2014 Fedora Release Engineering - 2.20-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 2.20-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 2.20-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri Feb 15 2013 Fedora Release Engineering - 2.20-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 2.20-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 2.20-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Feb 07 2011 Fedora Release Engineering - 2.20-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jan 19 2011 Than Ngo - 2.20-1 +- 2.2.0 +- disable alias which for cshell + +* Mon Jul 27 2009 Fedora Release Engineering - 2.19-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 2.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Mar 06 2008 Warren Togami 2.19-3 +- install-info should exit gracefully when --nodocs + +* Fri Feb 15 2008 Than Ngo 2.19-2 +- rebuilt + +* Fri Jan 25 2008 Than Ngo 2.19-1 +- 2.19, fix #399551, #430159 + +* Tue Nov 27 2007 Than Ngo - 2.18-5 +- fix permission which-2 scripts + +* Tue Nov 27 2007 Than Ngo 2.18-4 +- fix permission which-2 scripts + +* Mon Nov 26 2007 Karsten Hopp 2.18-3 +- add dir entry for info page + +* Tue Nov 20 2007 Than Ngo 2.18-2 +- cleanup specfile + +* Tue Nov 13 2007 Than Ngo 2.18-1 +- 2.18 + +* Tue Nov 13 2007 Than Ngo 2.16-10 +- cleanup specfile +- get rid of dev dependency + +* Mon Apr 23 2007 Than Ngo - 2.16-9 +- add missing which-2 script for csh +- cleanup specfile #226539 + +* Mon Jan 22 2007 Than Ngo - 2.16-8 +- install-info scriptlet failures + +* Fri Jul 14 2006 Jesse Keating - 2.16-7 +- rebuild + +* Fri Feb 10 2006 Jesse Keating - 2.16-6.2.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 2.16-6.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Mon Mar 07 2005 Than Ngo 2.16-6 +- rebuilt + +* Wed Feb 09 2005 Than Ngo 2.16-5 +- rebuilt + +* Sat Aug 07 2004 Than Ngo 2.16-4 +- add missing URL (thanks to Robert Scheck) + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Wed Sep 24 2003 Florian La Roche +- update to 2.16 +- fix %%preun + +* Thu Jul 17 2003 Than Ngo 2.14-8 +- rebuild + +* Thu Jul 17 2003 Than Ngo 2.14-7 +- added Prereq: dev (bug #99275) + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Tue Dec 10 2002 Than Ngo 2.14-4 +- cleanup code (bug #78478) + +* Thu Nov 14 2002 Tim Powers 2.14-3 +- redirect info dir warnings to /dev/null + +* Thu Nov 7 2002 Than Ngo 2.14-1 +- add missing info file + +* Mon Jul 29 2002 Florian La Roche +- update to 2.14 wih better support for current bash + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Wed Feb 27 2002 Than Ngo 2.13-3 +- use access instead stat in AFS environment (bug #60353) + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Wed Dec 05 2001 Florian La Roche +- update to 2.13 + +* Sat Aug 4 2001 Than Ngo +- fix bug 50844 + +* Sun Jun 24 2001 Elliot Lee +- Bump release + rebuild. + +* Sun Sep 10 2000 Florian La Roche +- 2.12 (only man-page fix) + +* Thu Jul 13 2000 Prospector +- automatic rebuild + +* Sun Jun 18 2000 Than Ngo +- FHS packaging. + +* Sun May 21 2000 Ngo Than +- put man pages in /usr/share/man/* + +* Thu Apr 20 2000 Florian La Roche +- update to 2.11 +- change from root:bin -> root:root + +* Mon Feb 07 2000 Preston Brown +- rebuild to gzip man page + +* Sun Jan 16 2000 Preston Brown +- newer stuff rom Carlo (2.10). Author's email: carlo@gnu.org + +* Thu Jan 13 2000 Preston Brown +- adopted Carlo's specfile. + +* Fri Sep 24 1999 Carlo Wood +- There should not be a reason anymore to include README.alias in the rpm docs. +- Don't install as root.root in RPM_BUILD_ROOT, in order to allow to build + rpm as non-root. +- Bug fix +- Added /etc/profile.d for automatic alias inclusion. + +* Wed Aug 25 1999 Carlo Wood +- Added README.alias. + +* Wed Aug 11 1999 Carlo Wood +- Typo in comment. + +* Thu May 27 1999 Carlo Wood +- Typo fix +- Moved maintainer targets from makefile to Makefile.am. + +* Tue May 18 1999 Carlo Wood +- Typo in appended changelog. +- Appended the old change log of `which-2.0.spec' to (this) changelog, + which is generated from the CVS log of `which-2.0.spec.in'. +- Generate which-2.spec from which-2.spec.in with automatic VERSION + and CHANGELOG substitution. + +* Fri May 14 1999 Carlo Wood +- Moved assignment of CFLAGS to the configure line, using RPM_OPT_FLAGS now. +- Corrected Source: line to point to ftp.gnu.org. + +* Sat Apr 17 1999 Carlo Wood +- Started to use automake and autoconf + +* Fri Apr 09 1999 Carlo Wood +- Renamed which-2.0.spec to which-2.spec + diff --git a/which2.csh b/which2.csh new file mode 100644 index 0000000..da9655e --- /dev/null +++ b/which2.csh @@ -0,0 +1,3 @@ +# Initialization script for csh + +# alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' diff --git a/which2.sh b/which2.sh new file mode 100644 index 0000000..53458f3 --- /dev/null +++ b/which2.sh @@ -0,0 +1,7 @@ +# 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