opnsense-src/bin/sh
Xin LI 119fb2a288 sh(1): Do not interpret chdir to "" as equivalent to chdir with no argument
A script that does the following:

    cd "${dir}" || exit 1

would incorrectly remain in the current directory when `${dir}` is
an empty string under the current implementation. This behavior,
while historical, is potentially dangerous, as it is likely not
what the script author intended.

Change the command to treat an empty string as an error and emit a
diagnostic message to standard error, as required by
IEEE Std 1003.1-2024.

PR:		standards/287440
Test Plan:	kyua test bin/sh
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D50974
2025-07-01 22:09:29 -07:00
..
bltin bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
funcs bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
tests sh(1): Do not interpret chdir to "" as equivalent to chdir with no argument 2025-07-01 22:09:29 -07:00
alias.c sh: Avoid referencing uninitialized memory in alias 2025-05-16 11:03:09 -03:00
alias.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
arith.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
arith_yacc.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
arith_yacc.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
arith_yylex.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
builtins.def bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
cd.c sh(1): Do not interpret chdir to "" as equivalent to chdir with no argument 2025-07-01 22:09:29 -07:00
cd.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
dot.profile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
dot.shrc dot.shrc: words to words, should be singular 2025-04-28 15:48:12 -06:00
error.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
error.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
eval.c sh(1): Fix typo 2023-12-26 10:44:35 -07:00
eval.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
exec.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
exec.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
expand.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
expand.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
histedit.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
input.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
input.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
jobs.c sh(1): Grammar fix in jobs.c 2024-02-13 14:13:08 +08:00
jobs.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
mail.c sh(1): Fix typo 2023-12-26 10:33:14 -07:00
mail.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
main.c sh(1): add -l option 2024-11-20 13:57:18 +01:00
main.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Update Makefile.depend files 2024-10-14 10:26:17 -07:00
memalloc.c sh(1): Fix typo 2023-12-26 10:44:33 -07:00
memalloc.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
miscbltin.c bin/sh: support RLIMIT_PIPEBUF 2024-09-20 09:46:07 +03:00
mkbuiltins bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
mknodes.c Remove copyright strings ifdef'd out 2023-11-26 22:23:58 -07:00
mksyntax.c Remove copyright strings ifdef'd out 2023-11-26 22:23:58 -07:00
mktokens bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
myhistedit.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
mystring.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
mystring.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
nodes.c.pat bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
nodetypes bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
options.c sh(1): -l is only valid in cli option not as set -l 2024-11-20 14:15:41 +01:00
options.h sh(1): add -l option 2024-11-20 13:57:18 +01:00
output.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
output.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
parser.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
parser.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
profile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
redir.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
redir.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
sh.1 sh.1: Remove a double word 2025-05-01 16:11:52 +02:00
shell.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
show.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
show.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
TOUR bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
trap.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
trap.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
var.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
var.h bin: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00