Compare commits

...
Sign in to create a new pull request.

97 commits

Author SHA1 Message Date
Fedora Release Engineering
ac38d264ed Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 20:24:07 +00:00
Lukáš Zaoral
c68f9f566f
tests: migrate from STI to TMT
Related: https://fedoraproject.org/wiki/Changes/DisableSTI
2025-07-07 12:54:06 +02:00
Than Ngo
d6c3c6e517 Add a check to ensure that /proc/$$/exe can be read 2025-06-18 17:36:05 +02:00
Than Ngo
227e833d53 Fixed rhbz#2343361, update to 2.23 2025-02-03 15:49:08 +01:00
Than Ngo
7868f048fb Fixed rhbz#2343113, regression 2025-02-01 22:38:21 +01:00
Than Ngo
eaa063e13e Add BR on gcc-c++ 2025-01-27 11:16:27 +01:00
Than Ngo
af5b873272 Fixed rhbz#2342020, update to 2.22 2025-01-27 10:35:14 +01:00
Fedora Release Engineering
01febed462 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 14:58:54 +00:00
Fedora Release Engineering
f9cdb1c078 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-20 09:18:36 +00:00
Fedora Release Engineering
34aba6f9e4 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-27 08:43:54 +00:00
Fedora Release Engineering
1f2a5801fc Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-22 18:10:40 +00:00
Than Ngo
1d13651d9f fixed #2175953, enable which2 alias 2023-03-08 11:42:53 +01:00
Than Ngo
a358eb3b08 migrated to SPDX license 2023-02-19 11:30:53 +01:00
Fedora Release Engineering
e3c4a93617 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-21 06:47:34 +00:00
Than Ngo
53706aeb4c using alias instead export 2022-11-07 16:37:08 +01:00
Than Ngo
9a3c865350 which fails for long path 2022-11-07 16:29:33 +01:00
Than Ngo
1fd77d2533 drop dir file 2022-08-05 15:20:47 +02:00
Than Ngo
9ec53577bd fixed typo 2022-08-05 15:12:48 +02:00
Than Ngo
b5fc0eb6b1 disable which2 alias and function by default as it caused more problems than benefits 2022-08-05 15:04:50 +02:00
Fedora Release Engineering
c109904502 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-23 12:23:18 +00:00
Than Ngo
1be483011a make which2.sh script more robust 2022-02-09 16:17:41 +01:00
Fedora Release Engineering
372c1bae6c - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-22 04:26:22 +00:00
Than Ngo
0811db734b check shell correctly 2021-12-02 15:53:11 +01:00
Than Ngo
1784ef6a01 disable the --read-functions option in korn shells 2021-10-26 18:03:43 +02:00
Than Ngo
1fa13a9bff - Fixed regression, use export instead alias 2021-10-15 11:34:21 +02:00
Than Ngo
a9da4a55f2 Resolves: #2009547, which treats function contents as aliases when parsing ksh 2021-10-10 14:19:32 +02:00
Fedora Release Engineering
996c9e58cc - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 20:54:58 +00:00
Than Ngo
8fcb51a814 Resolves: #1942153, fixed unbound variable 2021-05-04 09:26:33 +02:00
Than Ngo
98662a9c46 improved which2.sh 2021-04-26 14:02:33 +02:00
Than Ngo
9542d05e68 fixed regression if SHELL=zsh 2021-03-23 20:15:21 +01:00
Than Ngo
88199b8014 - fixed coverity issues
- improved which2.sh
2021-03-21 14:30:10 +01:00
Than Ngo
e3c52e8686 fixed syntax error testcase: a=b which ls 2021-03-18 17:47:02 +01:00
Fedora Release Engineering
75909450e9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 23:28:03 +00:00
Tom Stellard
8f25db9b3a Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-09 00:54:08 +00:00
Fedora Release Engineering
bec7808886 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-29 14:06:38 +00:00
Than Ngo
f988253071 fixed 1817138 - Invalid syntax in /etc/profile.d/which2.sh:3: = not found 2020-03-25 18:07:24 +01:00
Than Ngo
d07598b6fa set correct alias for mksh 2020-03-24 15:23:27 +01:00
Fedora Release Engineering
608ab1c4cd - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-31 03:39:43 +00:00
Than Ngo
82a0a5968d set correct alias for ksh 2019-11-05 15:15:08 +01:00
Fedora Release Engineering
6a8b4dd229 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-27 03:26:03 +00:00
Than Ngo
fecec0b0e0 bump release 2019-02-04 15:35:45 +01:00
Than Ngo
bf88776004 bump release 2019-02-04 14:15:49 +01:00
Fedora Release Engineering
39937137b1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-03 11:40:57 +00:00
Than Ngo
34132615bb fixed resouce leak 2018-07-26 13:07:17 +02:00
Than Ngo
d60c7c584f Fix coverity issues 2018-07-24 14:23:15 +02:00
Fedora Release Engineering
ec53838b7f - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-14 08:49:13 +00:00
Igor Gnatenko
20982793aa
remove install-info
Those are not needed as per guidelines.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-07-12 10:30:53 +02:00
Igor Gnatenko
a723e62ca0 add BuildRequires: gcc
Reference: https://fedoraproject.org/wiki/Changes/Remove_GCC_from_BuildRoot
2018-07-09 19:06:53 +02:00
Jason Tibbitts
5f17e95f07 Fix sh syntax issue in which2.sh
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546221.
I also included three small spec cleanups:
* Removed Group tag.
* Removed buildroot cleaning in %install.
* Removed needless %defattr in %files.
2018-02-16 11:02:23 -06:00
Igor Gnatenko
bc81d7f136
Remove %clean section
None of currently supported distributions need that.
Last one was EL5 which is EOL for a while.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-14 08:58:59 +01:00
Fedora Release Engineering
62b6be0612 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 20:54:20 +00:00
Than Ngo
28b3e4f6f1 added CI tests using the standard test interface 2018-02-05 14:28:16 +01:00
Than Ngo
c83d01be41 Merge #1 Add CI tests using the standard test interface 2018-02-05 13:26:07 +00:00
Than Ngo
7128ddbd68 fixed bz#1526500 - 'declare' not found under ksh 2018-01-31 15:55:28 +01:00
Serhii Turivnyi
4ba5b3addc Add CI tests using the standard test interface 2017-12-11 12:40:44 +02:00
Fedora Release Engineering
f06f790764 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-03 10:15:34 +00:00
Fedora Release Engineering
a689e94a2d - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 21:35:24 +00:00
Fedora Release Engineering
dc514d1e2e - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 17:21:30 +00:00
Than Ngo
98b28b26d8 update source 2016-06-27 18:53:49 +02:00
Than Ngo
5c082f8e2c update to 2.21 2016-06-27 18:53:02 +02:00
Fedora Release Engineering
9764fdea91 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-05 03:00:40 +00:00
Till Maas
ec7e696300 Use better upstream URL 2015-11-11 19:11:04 +01:00
Scott Shambarger
037d453731 Fix source URLs 2015-11-11 19:06:11 +01:00
Dennis Gilmore
843aa2f986 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-19 02:23:35 +00:00
Jaromir Capik
028c6026b6 Adding STAGE1 bootstrap recipe 2015-06-15 17:20:26 +02:00
Till Maas
2393219369 Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
2015-02-21 22:28:30 +01:00
Till Maas
0b0356f43c Use alias instead of exported function for which to avoid bashism,
http://unix.stackexchange.com/questions/59360/#59431
2015-02-19 20:06:43 +01:00
Till Maas
aa89ac84da Fix bogus date in %changelog 2015-02-19 17:49:00 +01:00
Till Maas
3aa802cfd1 Check functions (#1194044)
- Use %license
2015-02-18 21:46:20 +01:00
Peter Robinson
7debb1f1bc - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-18 08:33:19 +00:00
Dennis Gilmore
0acafb8033 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 23:29:15 -05:00
Dennis Gilmore
506f653551 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-04 01:52:02 -05:00
Dennis Gilmore
0683921c49 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 2013-02-14 21:06:15 -06:00
Dennis Gilmore
5c40a50954 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-21 22:32:10 -05:00
Dennis Gilmore
1979c07e47 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-14 02:17:38 -06:00
Dennis Gilmore
e73c518ace - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild 2011-02-07 20:31:04 -06:00
Than Ngo
19081d7821 - 2.2.0
- disable alias which for cshell
2011-01-19 18:40:15 +01:00
Fedora Release Engineering
2c7e7bd7f6 dist-git conversion 2010-07-29 15:17:53 +00:00
Bill Nottingham
084315e8e0 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-25 22:43:13 +00:00
Jesse Keating
bb3fb622de - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild 2009-07-27 07:14:13 +00:00
Jesse Keating
e0b17706d7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild 2009-02-25 18:33:32 +00:00
Warren Togami
ad0b379569 bump 2008-03-06 22:43:37 +00:00
Warren Togami
4308229842 install-info should exit gracefully when --nodocs 2008-03-06 22:41:08 +00:00
Than Ngo
92062b0957 rebuilt against gcc 4.3 2008-02-15 22:22:15 +00:00
Than Ngo
6d88f2f37d BR: readline-devel 2008-01-25 11:16:55 +00:00
Than Ngo
51e565651f 2008-01-25 11:06:56 +00:00
Than Ngo
edbfee2288 2.19, fix #399551, #430159 2008-01-25 10:56:15 +00:00
Than Ngo
b24b69cdd7 fix permission which-2 scripts 2007-11-27 22:52:33 +00:00
Than Ngo
563cd4daac - fix permission which-2 scripts 2007-11-27 22:45:34 +00:00
Than Ngo
874e6c0adb fix permission which-2 scripts 2007-11-27 22:43:25 +00:00
Than Ngo
ad7c0a5456 fix permission which-2 scripts 2007-11-27 14:03:49 +00:00
Karsten Hopp
3b6607d722 - add dir entry for info page 2007-11-26 14:42:46 +00:00
Than Ngo
b49882f1e4 cleanup specfile 2007-11-20 13:43:02 +00:00
Than Ngo
825d478439 2007-11-13 14:33:15 +00:00
Than Ngo
2d6bf71622 2007-11-13 14:22:00 +00:00
Than Ngo
95a542240f - cleanup specfile
- get rid of dev dependency
2007-11-13 13:15:41 +00:00
Bill Nottingham
4115656251 makefile update to properly grab makefile.common 2007-10-15 19:30:45 +00:00
19 changed files with 490 additions and 133 deletions

View file

@ -1 +0,0 @@
which-2.16.tar.gz

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
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
/which-2.22.tar.gz
/which-2.23.tar.gz

View file

@ -1,6 +0,0 @@
# Makefile for source rpm: which
# $Id$
NAME := which
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

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}

5
plans/ci.fmf Normal file
View file

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

View file

@ -1 +1 @@
830b83af48347a9a3520f561e47cbc9b which-2.16.tar.gz
SHA512 (which-2.23.tar.gz) = 738807f79e8cfc5967541a28ae7021247c04c4177279f09be2c19c069af450a7e3b19baf9079fe5569b25b4630bb400be242a123647e52c9fe54f0ad007317bf

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

@ -0,0 +1,89 @@
#!/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,40 +0,0 @@
--- which-2.16/bash.c.afs 2003-09-15 03:58:55.000000000 +0200
+++ which-2.16/bash.c 2003-09-24 23:40:25.000000000 +0200
@@ -33,7 +33,6 @@
*/
#define HAVE_GETGROUPS
#undef SHELL
-#undef AFS
#undef NOGROUP
/*
@@ -253,7 +252,7 @@
if (S_ISDIR (finfo.st_mode))
return (FS_EXISTS|FS_DIRECTORY);
-#if defined (AFS)
+ if (getenv("AFS")) {
/* We have to use access(2) to determine access because AFS does not
support Unix file system semantics. This may produce wrong
answers for non-AFS files when ruid != euid. I hate AFS. */
@@ -261,8 +260,9 @@
return (FS_EXISTS | FS_EXECABLE);
else
return (FS_EXISTS);
-#else /* !AFS */
-
+ }
+ else /* !AFS */
+ {
/* Find out if the file is actually executable. By definition, the
only other criteria is that the file has an execute bit set that
we can use. */
@@ -298,7 +298,7 @@
return (FS_EXISTS | FS_EXECABLE);
return (FS_EXISTS);
-#endif /* !AFS */
+ } /* !AFS */
}
/* From bash-2.05b / general.c / line 501 ; Changes: Using 'strchr' instead of 'xstrchr'. */

View file

@ -1,33 +0,0 @@
--- which-2.14/tilde/tilde.c.orig Mon Dec 9 18:52:19 2002
+++ which-2.14/tilde/tilde.c Mon Dec 9 18:58:09 2002
@@ -182,7 +182,10 @@
int result_size, result_index;
result_index = result_size = 0;
- if (result = strchr (string, '~'))
+
+ result = strchr (string, '~');
+
+ if (!result)
result = xmalloc (result_size = (strlen (string) + 16));
else
result = xmalloc (result_size = (strlen (string) + 1));
--- which-2.14/which.c.orig Mon Dec 9 18:58:28 2002
+++ which-2.14/which.c Mon Dec 9 18:59:52 2002
@@ -22,6 +22,7 @@
#include "getopt.h"
#include "tilde/tilde.h"
#include "bash.h"
+#include <ctype.h>
static const char *progname;
@@ -536,7 +537,7 @@
while (fgets(buf, sizeof(buf), stdin))
{
int looks_like_function_start = 0;
- int function_start_version_205b;
+ int function_start_version_205b = 0;
if (read_functions)
{
// bash version 2.0.5a and older output a pattern for `str' like

13
which-2.21-warning.patch Normal file
View file

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

View file

@ -1,4 +0,0 @@
# Initialization script for csh
# export AFS, if you are in AFS environment
alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

View file

@ -1,4 +0,0 @@
# Initialization script for bash and sh
# export AFS, if you are in AFS environment
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

View file

@ -1,63 +1,276 @@
%global has_which2_alias 1
Summary: Displays where a particular program in your path is located
Name: which
Version: 2.16
Release: 9%{?dist}
License: GPL
Group: Applications/System
Source0: http://www.xs4all.nl/~carlo17/which/%{name}-%{version}.tar.gz
Source1: which-2.sh
Source2: which-2.csh
Url: http://www.xs4all.nl/~carlo17/which/
Patch: which-2.13-afs.patch
Patch1: which-2.14-broken.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info
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-warning.patch
Url: https://savannah.gnu.org/projects/which/
Requires: coreutils
BuildRequires: make
BuildRequires: gcc gcc-c++
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
%patch -p1 -b .afs
%patch1 -p1 -b .broken
%autosetup -p1
%build
%configure
make %{?_smp_mflags}
%make_build
%install
rm -rf $RPM_BUILD_ROOT
%make_install
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
install -p -m 755 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d/
%post
/sbin/install-info --quiet --info-dir=%{_infodir} %{_infodir}/which.info.gz > /dev/null 2>&1 || :
%preun
if [ $1 = 0 ]; then
/sbin/install-info --quiet --info-dir=%{_infodir} --delete %{_infodir}/which.info.gz > /dev/null 2>&1 || :
fi
%clean
rm -rf $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
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%files
%defattr(-,root,root)
%doc COPYING AUTHORS LICENSE EXAMPLES README AUTHORS NEWS
%config /etc/profile.d/which-2.*
%{_bindir}/*
%{_infodir}/which.info.gz
%{_mandir}/*/*
%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
* Mon Apr 23 2007 Than Ngo <than@redhat.com> - 2.16-9.fc7
* 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
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.20-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 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 <opensource@till.name> - 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 <opensource@till.name> - 2.20-9
- Check functions (#1194044)
- Use %%license
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Jan 19 2011 Than Ngo <than@redhat.com> - 2.20-1
- 2.2.0
- disable alias which for cshell
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.19-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.19-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Mar 06 2008 Warren Togami <wtogami@redhat.com> 2.19-3
- install-info should exit gracefully when --nodocs
* Fri Feb 15 2008 Than Ngo <than@redhat.com> 2.19-2
- rebuilt
* Fri Jan 25 2008 Than Ngo <than@redhat.com> 2.19-1
- 2.19, fix #399551, #430159
* Tue Nov 27 2007 Than Ngo <than@redhat.com> - 2.18-5
- fix permission which-2 scripts
* Tue Nov 27 2007 Than Ngo <than@redhat.com> 2.18-4
- fix permission which-2 scripts
* Mon Nov 26 2007 Karsten Hopp <karsten@redhat.com> 2.18-3
- add dir entry for info page
* Tue Nov 20 2007 Than Ngo <than@redhat.com> 2.18-2
- cleanup specfile
* Tue Nov 13 2007 Than Ngo <than@redhat.com> 2.18-1
- 2.18
* Tue Nov 13 2007 Than Ngo <than@redhat.com> 2.16-10
- cleanup specfile
- get rid of dev dependency
* Mon Apr 23 2007 Than Ngo <than@redhat.com> - 2.16-9
- add missing which-2 script for csh
- cleanup specfile #226539
@ -189,7 +402,7 @@ rm -rf $RPM_BUILD_ROOT
- Generate which-2.spec from which-2.spec.in with automatic VERSION
and CHANGELOG substitution.
* Tue May 14 1999 Carlo Wood <carlo@gnu.org>
* Fri May 14 1999 Carlo Wood <carlo@gnu.org>
- Moved assignment of CFLAGS to the configure line, using RPM_OPT_FLAGS now.
- Corrected Source: line to point to ftp.gnu.org.

3
which2.csh Normal file
View file

@ -0,0 +1,3 @@
# Initialization script for csh
# alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

18
which2.sh Normal file
View file

@ -0,0 +1,18 @@
# shellcheck shell=sh
# Initialization script for bash, sh, mksh and ksh
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