Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

18 changed files with 531 additions and 71 deletions

6
.gitignore vendored
View File

@ -1 +1,5 @@
SOURCES/which-2.21.tar.gz
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

View File

@ -1 +1 @@
6b6bec3d2b3d4661c164feb81b9b1d22d1359ded SOURCES/which-2.21.tar.gz
6b6bec3d2b3d4661c164feb81b9b1d22d1359ded which-2.21.tar.gz

View File

@ -1,27 +0,0 @@
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;
}

7
STAGE1-which Normal file
View File

@ -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}

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
097ff1a324ae02e0a3b0369f07a7544a which-2.21.tar.gz

View File

@ -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 <ksrot@redhat.com>
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

1
tests/artifacts/test.log Normal file
View File

@ -0,0 +1 @@
PASS basic-functionality-test

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/which/Sanity/basic-functionality-test
# Description: tests basic functionality
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <ksrot@redhat.com>" > $(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)

View File

@ -0,0 +1,11 @@
PURPOSE of /CoreOS/which/Sanity/basic-functionality-test
Description: tests basic functionality
Author: Karel Srot <ksrot@redhat.com>
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

View File

@ -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 <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

1
tests/tests.retry Normal file
View File

@ -0,0 +1 @@
localhost

13
tests/tests.yml Normal file
View File

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

View File

@ -1,7 +1,7 @@
diff -up which-2.21/tilde/tilde.c.coverity2 which-2.21/tilde/tilde.c
--- which-2.21/tilde/tilde.c.coverity2 2021-03-21 21:04:34.691775991 +0100
+++ which-2.21/tilde/tilde.c 2021-03-21 21:13:36.853129481 +0100
@@ -193,9 +193,8 @@ tilde_expand (string)
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;
@ -9,10 +9,13 @@ diff -up which-2.21/tilde/tilde.c.coverity2 which-2.21/tilde/tilde.c
+ int result_size = 0, result_index = 0;
- result_index = result_size = 0;
result = strchr (string, '~');
if (result)
- if (result = strchr (string, '~'))
+ result = strchr (string, '~');
+ if (result)
result = (char *)xmalloc (result_size = (strlen (string) + 16));
@@ -271,7 +270,7 @@ isolate_tilde_prefix (fname, lenp)
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));
@@ -270,7 +270,7 @@ isolate_tilde_prefix (fname, lenp)
char *ret;
int i;
@ -21,21 +24,21 @@ diff -up which-2.21/tilde/tilde.c.coverity2 which-2.21/tilde/tilde.c
#if defined (__MSDOS__)
for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
#else
diff -up which-2.21/which.c.coverity2 which-2.21/which.c
--- which-2.21/which.c.coverity2 2021-03-21 21:04:34.691775991 +0100
+++ which-2.21/which.c 2021-03-21 21:04:34.692775983 +0100
@@ -76,8 +76,9 @@ static int skip_functions = 0, read_func
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;
+ char *p;
name_len = strlen(name);
+ char *p;
@@ -85,7 +86,6 @@ static char *find_command_in_path(const
if (!absolute_program(name))
absolute_path_given = 0;
else
{

View File

@ -1,17 +1,17 @@
Summary: Displays where a particular program in your path is located
Name: which
Version: 2.21
Release: 20%{?dist}
Release: 29%{?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-coverity.patch
Patch2: which-2.21-path_max.patch
Patch1: which-2.21-path_max.patch
Url: https://savannah.gnu.org/projects/which/
Requires: coreutils
BuildRequires: gcc
BuildRequires: make
BuildRequires: gcc
BuildRequires: readline-devel
%description
@ -21,8 +21,7 @@ the specified program is in your PATH.
%prep
%setup -q
%patch0 -p1 -b .coverity
%patch1 -p1 -b .coverity2
%patch2 -p1 -b .path_max
%patch1 -p1 -b .path_max
%build
%configure
@ -44,38 +43,63 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%{_mandir}/man1/which.1*
%changelog
* Wed Mar 22 2023 Than Ngo <than@redhat.com> - 2.21-20
- Related: #2140566, bring test over from Brew dist-git
* Mon Mar 27 2023 Than Ngo <than@redhat.com> - 2.21-29
- Resolves: #2181974, which fails for long path
* Tue Mar 21 2023 Than Ngo <than@redhat.com> - 2.21-19
- Resolves: #2140566, which fails for long path
* Fri Apr 15 2022 Than Ngo <than@redhat.com> - 2.21-28
- Resolves: #2050996, error on login when using ksh as the default shell
* Mon Apr 11 2022 Than Ngo <than@redhat.com> - 2.21-18
- Resolves: #2044450 - custom profile generates shell error
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-27
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Nov 25 2021 Than Ngo <than@redhat.com> - 2.21-17
- Resolves: #2025709, check shell correctly
- Resolves: #2009547, which treats function contents as aliases when parsing ksh
* Fri May 07 2021 Than Ngo <than@redhat.com> - 2.21-26
- Related: #1940464, fixed unbound variable
* Wed May 05 2021 Than Ngo <than@redhat.com> - 2.21-16
- Related: #1940468, fixed unbound variable
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-25
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-24
- fix regression in zsh
* Fri Apr 30 2021 Than Ngo <than@redhat.com> - 2.21-15
- Related: #1940468, fix error when the user runs which in bash with strict bash environment
* Sun Mar 21 2021 Than Ngo <than@redhat.com> - 2.21-23
- improved which2.sh
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-14
- Related: #1940468, fix regression if SHELL=zsh
* Thu Mar 18 2021 Than Ngo <than@redhat.com> - 2.21-22
- Resolves: #1940464, fixed syntax error testcase: a=b which ls
* Fri Mar 19 2021 Than Ngo <than@redhat.com> - 2.21-13
- Resolves: #1940468, fixed syntax error caused by testcase: a=b which ls
Coverity issue
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Nov 19 2019 Than Ngo <than@redhat.com> - 2.21-12
- Fixed coverity issue
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Nov 19 2019 Than Ngo <than@redhat.com> - 2.21-11
- Resolves: #1768506, fix wrong alias
* Wed Mar 25 2020 Than Ngo <than@redhat.com> - 2.21-19
- fixed #1817138 - Invalid syntax in /etc/profile.d/which2
* Tue Mar 24 2020 Than Ngo <than@redhat.com> - 2.21-18
- set correct alias for mksh
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Nov 05 2019 Than Ngo <than@redhat.com> - 2.21-16
- set correct alias for ksh
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 04 2019 Than Ngo <than@redhat.com> - 2.21-14
- bump release
* Mon Feb 04 2019 Than Ngo <than@redhat.com> - 2.21-13
- bump release
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 26 2018 Than Ngo <than@redhat.com> - 2.21-11
- fixed more coverity issue
* Mon Jul 23 2018 Than Ngo <than@redhat.com> - 2.21-10
- Fix coverity issues