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/.gitignore b/.gitignore index e93fa2c..ebf70cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ 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 +/which-2.23.tar.gz 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/sources b/sources index 4b6d13d..493334d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -097ff1a324ae02e0a3b0369f07a7544a which-2.21.tar.gz +SHA512 (which-2.23.tar.gz) = 738807f79e8cfc5967541a28ae7021247c04c4177279f09be2c19c069af450a7e3b19baf9079fe5569b25b4630bb400be242a123647e52c9fe54f0ad007317bf 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 diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch deleted file mode 100644 index 0be9e3f..0000000 --- a/which-2.21-coverity-fixes.patch +++ /dev/null @@ -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; - } - 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 2dbee15..7174222 100644 --- a/which.spec +++ b/which.spec @@ -1,14 +1,18 @@ +%global has_which2_alias 1 + Summary: Displays where a particular program in your path is located Name: which -Version: 2.21 -Release: 15%{?dist} -License: GPLv3 +Version: 2.23 +Release: 3%{?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 +Patch0: which-2.21-warning.patch Url: https://savannah.gnu.org/projects/which/ -BuildRequires: gcc +Requires: coreutils +BuildRequires: make +BuildRequires: gcc gcc-c++ BuildRequires: readline-devel %description @@ -16,9 +20,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 @@ -27,18 +30,122 @@ 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/ +%if %{has_which2_alias} + install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ +%endif rm -f $RPM_BUILD_ROOT%{_infodir}/dir %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 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 + +* 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 + +* 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 + +* 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 + +* 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 + +* 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 + +* 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 + +* 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, + +* 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 + +* 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 + +* 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 + +* 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 + +* 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 + +* 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 + +* 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 diff --git a/which2.sh b/which2.sh index d7e5373..9829a06 100644 --- a/which2.sh +++ b/which2.sh @@ -1,7 +1,18 @@ -# Initialization script for bash and sh +# shellcheck shell=sh +# Initialization script for bash, sh, mksh and ksh -if [ "$0" = ksh ] ; then - alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +if [ -r /proc/$$/exe ]; then + SHELLNAME=$(basename $(readlink /proc/$$/exe)) else - alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' + SHELLNAME="unknown" fi +case "$SHELLNAME" in +*ksh*|zsh) + alias which='alias | /usr/bin/which --tty-only --read-alias --show-tilde --show-dot' + ;; +bash|sh) + alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' + ;; +*) + ;; +esac