Compare commits

..

No commits in common. "rawhide" and "f25" have entirely different histories.

11 changed files with 35 additions and 382 deletions

View file

@ -1 +0,0 @@
1

2
.gitignore vendored
View file

@ -3,5 +3,3 @@ 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

View file

@ -1,5 +0,0 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View file

@ -1 +1 @@
SHA512 (which-2.23.tar.gz) = 738807f79e8cfc5967541a28ae7021247c04c4177279f09be2c19c069af450a7e3b19baf9079fe5569b25b4630bb400be242a123647e52c9fe54f0ad007317bf
097ff1a324ae02e0a3b0369f07a7544a which-2.21.tar.gz

View file

@ -1,64 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

@ -1,11 +0,0 @@
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

@ -1,14 +0,0 @@
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 <ksrot@redhat.com>
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

View file

@ -1,89 +0,0 @@
#!/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/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

View file

@ -1,13 +0,0 @@
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));

View file

@ -1,195 +1,62 @@
%global has_which2_alias 1
Summary: Displays where a particular program in your path is located
Name: which
Version: 2.23
Release: 3%{?dist}
License: GPL-3.0-only
Version: 2.21
Release: 1%{?dist}
License: GPLv3
Group: Applications/System
Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz
Source1: which2.sh
Source2: which2.csh
Patch0: which-2.21-warning.patch
Url: https://savannah.gnu.org/projects/which/
Requires: coreutils
BuildRequires: make
BuildRequires: gcc gcc-c++
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
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
the specified program is in your PATH.
%prep
%autosetup -p1
%setup -q
%build
%configure
%make_build
make %{?_smp_mflags}
%install
%make_install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
%if %{has_which2_alias}
install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/
%endif
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
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%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*
%{_bindir}/*
%{_infodir}/which.info.gz
%{_mandir}/*/*
%changelog
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.23-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Wed Jun 18 2025 Than Ngo <than@redhat.com> - 2.23-2
- Add a check to ensure that /proc/$$/exe can be read
* Mon Feb 03 2025 Than Ngo <than@redhat.com> - 2.23-1
- Fixed rhbz#2343361, update to 2.23
* Sat Feb 01 2025 Than Ngo <than@redhat.com> - 2.22-2
- Fixed rhbz#2343113, regression
* Mon Jan 27 2025 Than Ngo <than@redhat.com> - 2.22-1
- Fixed rhbz#2342020, update to 2.22
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Mar 08 2023 Than Ngo <than@redhat.com> - 2.21-39
- fixed #2175953, enable which2 alias
* Sun Feb 19 2023 Than Ngo <than@redhat.com> - 2.21-38
- migrated to SPDX license
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Nov 07 2022 Than Ngo <than@redhat.com> - 2.21-36
- which fails for long path
* Fri Aug 05 2022 Than Ngo <than@redhat.com> - 2.21-35
- disable which2 alias and function by default as it caused more problems than benefits
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Feb 09 2022 Than Ngo <than@redhat.com> - 2.21-33
- make which2.sh script more robust,
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Dec 02 2021 Than Ngo <than@redhat.com> - 2.21-31
- check shell correctly
* Tue Oct 26 2021 Than Ngo <than@redhat.com> - 2.21-30
- disable the --read-functions option in korn shells
* Fri Oct 15 2021 Than Ngo <than@redhat.com> - 2.21-29
- Fixed regression, use export instead alias
* Sun Oct 10 2021 Than Ngo <than@redhat.com> - 2.21-28
- Resolves: #2009547, which treats function contents as aliases when parsing ksh
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue May 04 2021 Than Ngo <than@redhat.com> - 2.21-26
- Resolves: #1942153, fixed unbound variable
* Mon Apr 26 2021 Than Ngo <than@redhat.com> - 2.21-25
- improved which2.sh
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-24
- fixed regression if SHELL=zsh
* Sun Mar 21 2021 Than Ngo <than@redhat.com> - 2.21-23
- fixed coverity issues
- improved which2.sh
* Thu Mar 18 2021 Than Ngo <than@redhat.com> - 2.21-22
- fixed syntax error testcase: a=b which ls
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* 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
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 16 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 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 <releng@fedoraproject.org> - 2.21-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Feb 05 2018 Than Ngo <than@redhat.com> - 2.21-6
- added CI tests using the standard test interface
* Wed Jan 31 2018 Than Ngo <than@redhat.com> - 2.21-5
- fixed bz#1526500 - 'declare' not found under ksh
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Jun 27 2016 Than Ngo <than@redhat.com> - 2.21-1
- update to 2.21

View file

@ -1,18 +1,3 @@
# shellcheck shell=sh
# Initialization script for bash, sh, mksh and ksh
# Initialization script for bash and sh
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'
;;
bash|sh)
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'
;;
*)
;;
esac
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'