diff options
| -rw-r--r-- | bin/sh/parser.c | 126 | ||||
| -rw-r--r-- | bin/sh/tests/parser/Makefile | 6 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps1-expand1.0 | 7 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps1-expand2.0 | 7 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps1-expand3.0 | 8 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps1-expand4.0 | 8 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps1-expand5.0 | 8 | ||||
| -rw-r--r-- | bin/sh/tests/parser/ps2-expand1.0 | 12 | ||||
| -rw-r--r-- | cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 10 | ||||
| -rw-r--r-- | release/Makefile | 2 | ||||
| -rw-r--r-- | share/man/man4/safe.4 | 16 | ||||
| -rw-r--r-- | sys/dev/random/fenestrasX/fx_pool.c | 14 | ||||
| -rw-r--r-- | sys/dev/random/random_harvestq.c | 6 | ||||
| -rw-r--r-- | sys/dev/safe/safe.c | 2 | ||||
| -rw-r--r-- | sys/netlink/netlink_generic.c | 4 | ||||
| -rw-r--r-- | sys/sys/random.h | 6 | ||||
| -rw-r--r-- | usr.sbin/bsdinstall/partedit/gpart_ops.c | 14 | ||||
| -rw-r--r-- | usr.sbin/utx/utx.8 | 2 |
18 files changed, 232 insertions, 26 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 0c1b7a91c257..3e42d41caec4 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -55,6 +55,8 @@ #include "show.h" #include "eval.h" #include "exec.h" /* to check for special builtins */ +#include "main.h" +#include "jobs.h" #ifndef NO_HISTORY #include "myhistedit.h" #endif @@ -2050,7 +2052,129 @@ getprompt(void *unused __unused) * Format prompt string. */ for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++) { - if (*fmt != '\\') { + if (*fmt == '$') { + const char *varname_start, *varname_end, *value; + char varname[256]; + int namelen, braced = 0; + + fmt++; /* Skip the '$' */ + + /* Check for ${VAR} syntax */ + if (*fmt == '{') { + braced = 1; + fmt++; + } + + varname_start = fmt; + + /* Extract variable name */ + if (is_digit(*fmt)) { + /* Positional parameter: $0, $1, etc. */ + fmt++; + varname_end = fmt; + } else if (is_special(*fmt)) { + /* Special parameter: $?, $!, $$, etc. */ + fmt++; + varname_end = fmt; + } else if (is_name(*fmt)) { + /* Regular variable name */ + do + fmt++; + while (is_in_name(*fmt)); + varname_end = fmt; + } else { + /* + * Not a valid variable reference. + * Output literal '$'. + */ + ps[i] = '$'; + if (braced && i < PROMPTLEN - 2) + ps[++i] = '{'; + fmt = varname_start - 1; + continue; + } + + namelen = varname_end - varname_start; + if (namelen == 0 || namelen >= (int)sizeof(varname)) { + /* Invalid or too long, output literal */ + ps[i] = '$'; + fmt = varname_start - 1; + continue; + } + + /* Copy variable name */ + memcpy(varname, varname_start, namelen); + varname[namelen] = '\0'; + + /* Handle closing brace for ${VAR} */ + if (braced) { + if (*fmt == '}') { + fmt++; + } else { + /* Missing closing brace, treat as literal */ + ps[i] = '$'; + if (i < PROMPTLEN - 2) + ps[++i] = '{'; + fmt = varname_start - 1; + continue; + } + } + + /* Look up the variable */ + if (namelen == 1 && is_digit(*varname)) { + /* Positional parameters - check digits FIRST */ + int num = *varname - '0'; + if (num == 0) + value = arg0 ? arg0 : ""; + else if (num > 0 && num <= shellparam.nparam) + value = shellparam.p[num - 1]; + else + value = ""; + } else if (namelen == 1 && is_special(*varname)) { + /* Special parameters */ + char valbuf[20]; + int num; + + switch (*varname) { + case '$': + num = rootpid; + break; + case '?': + num = exitstatus; + break; + case '#': + num = shellparam.nparam; + break; + case '!': + num = backgndpidval(); + break; + default: + num = 0; + break; + } + snprintf(valbuf, sizeof(valbuf), "%d", num); + value = valbuf; + } else { + /* Regular variables */ + value = lookupvar(varname); + if (value == NULL) + value = ""; + } + + /* Copy value to output, respecting buffer size */ + while (*value != '\0' && i < PROMPTLEN - 1) { + ps[i++] = *value++; + } + + /* + * Adjust fmt and i for the loop increment. + * fmt will be incremented by the for loop, + * so position it one before where we want. + */ + fmt--; + i--; + continue; + } else if (*fmt != '\\') { ps[i] = *fmt; continue; } diff --git a/bin/sh/tests/parser/Makefile b/bin/sh/tests/parser/Makefile index afeb604710e4..c22af5414526 100644 --- a/bin/sh/tests/parser/Makefile +++ b/bin/sh/tests/parser/Makefile @@ -86,6 +86,12 @@ ${PACKAGE}FILES+= only-redir2.0 ${PACKAGE}FILES+= only-redir3.0 ${PACKAGE}FILES+= only-redir4.0 ${PACKAGE}FILES+= pipe-not1.0 +${PACKAGE}FILES+= ps1-expand1.0 +${PACKAGE}FILES+= ps1-expand2.0 +${PACKAGE}FILES+= ps1-expand3.0 +${PACKAGE}FILES+= ps1-expand4.0 +${PACKAGE}FILES+= ps1-expand5.0 +${PACKAGE}FILES+= ps2-expand1.0 ${PACKAGE}FILES+= set-v1.0 set-v1.0.stderr ${PACKAGE}FILES+= var-assign1.0 diff --git a/bin/sh/tests/parser/ps1-expand1.0 b/bin/sh/tests/parser/ps1-expand1.0 new file mode 100644 index 000000000000..351e6437a023 --- /dev/null +++ b/bin/sh/tests/parser/ps1-expand1.0 @@ -0,0 +1,7 @@ +# Test simple variable expansion in PS1 +testvar=abcdef +output=$(testvar=abcdef PS1='$testvar:' ENV=/dev/null ${SH} +m -i </dev/null 2>&1) +case $output in +*abcdef*) exit 0 ;; +*) echo "Expected 'abcdef' in prompt output"; exit 1 ;; +esac diff --git a/bin/sh/tests/parser/ps1-expand2.0 b/bin/sh/tests/parser/ps1-expand2.0 new file mode 100644 index 000000000000..ed31a7c17136 --- /dev/null +++ b/bin/sh/tests/parser/ps1-expand2.0 @@ -0,0 +1,7 @@ +# Test braced variable expansion in PS1 +testvar=xyz123 +output=$(testvar=xyz123 PS1='prefix-${testvar}-suffix:' ENV=/dev/null ${SH} +m -i </dev/null 2>&1) +case $output in +*xyz123*) exit 0 ;; +*) echo "Expected 'xyz123' in prompt output"; exit 1 ;; +esac diff --git a/bin/sh/tests/parser/ps1-expand3.0 b/bin/sh/tests/parser/ps1-expand3.0 new file mode 100644 index 000000000000..0b6270c300ff --- /dev/null +++ b/bin/sh/tests/parser/ps1-expand3.0 @@ -0,0 +1,8 @@ +# Test special parameter $$ (PID) in PS1 +output=$(PS1='pid:$$:' ENV=/dev/null ${SH} +m -i </dev/null 2>&1) +# Check that output contains "pid:" followed by a number (not literal $$) +case $output in +*pid:\$\$:*) echo "PID not expanded, got literal \$\$"; exit 1 ;; +*pid:[0-9]*) exit 0 ;; +*) echo "Expected PID after 'pid:' in output"; exit 1 ;; +esac diff --git a/bin/sh/tests/parser/ps1-expand4.0 b/bin/sh/tests/parser/ps1-expand4.0 new file mode 100644 index 000000000000..623c52707eec --- /dev/null +++ b/bin/sh/tests/parser/ps1-expand4.0 @@ -0,0 +1,8 @@ +# Test special parameter $? (exit status) in PS1 +output=$(PS1='status:$?:' ENV=/dev/null ${SH} +m -i </dev/null 2>&1) +# Should start with exit status 0 +case $output in +*status:\$?:*) echo "Exit status not expanded, got literal \$?"; exit 1 ;; +*status:0:*) exit 0 ;; +*) echo "Expected 'status:0:' in initial prompt"; exit 1 ;; +esac diff --git a/bin/sh/tests/parser/ps1-expand5.0 b/bin/sh/tests/parser/ps1-expand5.0 new file mode 100644 index 000000000000..73fe3ba5a3d5 --- /dev/null +++ b/bin/sh/tests/parser/ps1-expand5.0 @@ -0,0 +1,8 @@ +# Test positional parameter $0 in PS1 +output=$(PS1='shell:$0:' ENV=/dev/null ${SH} +m -i </dev/null 2>&1) +# $0 should contain the shell name/path +case $output in +*shell:\$0:*) echo "Positional parameter not expanded, got literal \$0"; exit 1 ;; +*shell:*sh*:*) exit 0 ;; +*) echo "Expected shell name after 'shell:' in output"; exit 1 ;; +esac diff --git a/bin/sh/tests/parser/ps2-expand1.0 b/bin/sh/tests/parser/ps2-expand1.0 new file mode 100644 index 000000000000..f0a3a77ded1c --- /dev/null +++ b/bin/sh/tests/parser/ps2-expand1.0 @@ -0,0 +1,12 @@ +# Test variable expansion in PS2 (continuation prompt) +testvar=continue +# Send incomplete command (backslash at end) to trigger PS2 +output=$(testvar=continue PS2='$testvar>' ENV=/dev/null ${SH} +m -i <<EOF 2>&1 +echo \\ +done +EOF +) +case $output in +*continue\>*) exit 0 ;; +*) echo "Expected 'continue>' in PS2 output"; exit 1 ;; +esac diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 1a9f8029e6de..5115d16a1286 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2025 +.Dd November 8, 2025 .Dt DTRACE 1 .Os .Sh NAME @@ -1252,6 +1252,14 @@ command line to define a set of macro variables and so forth). The additional arguments can be used in D programs specified using the .Fl s option or on the command line. +.Sh ENVIRONMENT +.Bl -tag -width 'DTRACE_DEBUG' +.It Ev DTRACE_DEBUG +When defined, +.Nm +will output debug log messages to +.Xr stderr 4 . +.El .Sh FILES .Bl -tag -width /boot/dtrace.dof -compact .It Pa /boot/dtrace.dof diff --git a/release/Makefile b/release/Makefile index a777ded3c429..fc91b31df579 100644 --- a/release/Makefile +++ b/release/Makefile @@ -56,7 +56,7 @@ TARGET_ARCH= ${TARGET} .endif .endif IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} \ - -DNO_ROOT -DDB_FROM_SRC + -DNO_ROOT -DWITHOUT_QEMU -DDB_FROM_SRC DISTDIR= dist # Define OSRELEASE by using newvers.sh diff --git a/share/man/man4/safe.4 b/share/man/man4/safe.4 index 89375d058bf7..914b2dd0dd1c 100644 --- a/share/man/man4/safe.4 +++ b/share/man/man4/safe.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 22, 2024 +.Dd October 31, 2025 .Dt SAFE 4 .Os .Sh NAME @@ -57,6 +57,11 @@ In .Cd hw.safe.rngbufsize .Cd hw.safe.rngmaxalarm .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is deprecated and is scheduled for removal in +.Fx 16.0 . .Sh DESCRIPTION The .Nm @@ -128,5 +133,14 @@ packet processing. .Xr random 4 , .Xr crypto 7 , .Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 5.2 . +It is deprecated in +.Fx 15.0 +and removed in +.Fx 16.0 . .Sh BUGS Public key support is not implemented. diff --git a/sys/dev/random/fenestrasX/fx_pool.c b/sys/dev/random/fenestrasX/fx_pool.c index b6ffc202769e..59273a0a3f9d 100644 --- a/sys/dev/random/fenestrasX/fx_pool.c +++ b/sys/dev/random/fenestrasX/fx_pool.c @@ -167,10 +167,7 @@ static const struct fxrng_ent_char { [RANDOM_RANDOMDEV] = { .entc_cls = &fxrng_lo_push, }, - [RANDOM_PURE_SAFE] = { - .entc_cls = &fxrng_hi_push, - }, - [RANDOM_PURE_GLXSB] = { + [RANDOM_PURE_TPM] = { .entc_cls = &fxrng_hi_push, }, [RANDOM_PURE_RDRAND] = { @@ -197,9 +194,6 @@ static const struct fxrng_ent_char { [RANDOM_PURE_DARN] = { .entc_cls = &fxrng_hi_pull, }, - [RANDOM_PURE_TPM] = { - .entc_cls = &fxrng_hi_push, - }, [RANDOM_PURE_VMGENID] = { .entc_cls = &fxrng_hi_push, }, @@ -212,6 +206,12 @@ static const struct fxrng_ent_char { [RANDOM_PURE_ARM_TRNG] = { .entc_cls = &fxrng_hi_pull, }, + [RANDOM_PURE_SAFE] = { + .entc_cls = &fxrng_hi_push, + }, + [RANDOM_PURE_GLXSB] = { + .entc_cls = &fxrng_hi_push, + }, }; CTASSERT(nitems(fxrng_ent_char) == ENTROPYSOURCE); diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index b591ffd3b544..296721d2c4e9 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -662,8 +662,7 @@ static const char *random_source_descr[/*ENTROPYSOURCE*/] = { [RANDOM_UMA] = "UMA", [RANDOM_CALLOUT] = "CALLOUT", [RANDOM_RANDOMDEV] = "RANDOMDEV", /* ENVIRONMENTAL_END */ - [RANDOM_PURE_SAFE] = "PURE_SAFE", /* PURE_START */ - [RANDOM_PURE_GLXSB] = "PURE_GLXSB", + [RANDOM_PURE_TPM] = "PURE_TPM", /* PURE_START */ [RANDOM_PURE_RDRAND] = "PURE_RDRAND", [RANDOM_PURE_RDSEED] = "PURE_RDSEED", [RANDOM_PURE_NEHEMIAH] = "PURE_NEHEMIAH", @@ -672,11 +671,12 @@ static const char *random_source_descr[/*ENTROPYSOURCE*/] = { [RANDOM_PURE_BROADCOM] = "PURE_BROADCOM", [RANDOM_PURE_CCP] = "PURE_CCP", [RANDOM_PURE_DARN] = "PURE_DARN", - [RANDOM_PURE_TPM] = "PURE_TPM", [RANDOM_PURE_VMGENID] = "PURE_VMGENID", [RANDOM_PURE_QUALCOMM] = "PURE_QUALCOMM", [RANDOM_PURE_ARMV8] = "PURE_ARMV8", [RANDOM_PURE_ARM_TRNG] = "PURE_ARM_TRNG", + [RANDOM_PURE_SAFE] = "PURE_SAFE", + [RANDOM_PURE_GLXSB] = "PURE_GLXSB", /* "ENTROPYSOURCE" */ }; CTASSERT(nitems(random_source_descr) == ENTROPYSOURCE); diff --git a/sys/dev/safe/safe.c b/sys/dev/safe/safe.c index c512f3fc62c0..21824ba8de8d 100644 --- a/sys/dev/safe/safe.c +++ b/sys/dev/safe/safe.c @@ -424,6 +424,8 @@ safe_attach(device_t dev) #ifdef SAFE_DEBUG safec = sc; /* for use by hw.safe.dump */ #endif + gone_in(16, "%s(4) is deprecated in 15.0 and removed in 16.0\n", + safe_driver.name); return (0); bad4: crypto_unregister_all(sc->sc_cid); diff --git a/sys/netlink/netlink_generic.c b/sys/netlink/netlink_generic.c index 00f47e60f013..d20ec4c7545f 100644 --- a/sys/netlink/netlink_generic.c +++ b/sys/netlink/netlink_generic.c @@ -366,8 +366,10 @@ genl_register_family(const char *family_name, size_t hdrsize, GENL_LOCK(); for (u_int i = 0; i < MAX_FAMILIES; i++) if (families[i].family_name != NULL && - strcmp(families[i].family_name, family_name) == 0) + strcmp(families[i].family_name, family_name) == 0) { + GENL_UNLOCK(); return (0); + } /* Microoptimization: index 0 is reserved for the control family. */ gf = NULL; diff --git a/sys/sys/random.h b/sys/sys/random.h index 803c07bbdfba..d801b04e5686 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -89,8 +89,7 @@ enum random_entropy_source { RANDOM_ENVIRONMENTAL_END = RANDOM_RANDOMDEV, /* Fast hardware random-number sources from here on. */ RANDOM_PURE_START, - RANDOM_PURE_SAFE = RANDOM_PURE_START, - RANDOM_PURE_GLXSB, + RANDOM_PURE_TPM = RANDOM_PURE_START, RANDOM_PURE_RDRAND, RANDOM_PURE_RDSEED, RANDOM_PURE_NEHEMIAH, @@ -99,11 +98,12 @@ enum random_entropy_source { RANDOM_PURE_BROADCOM, RANDOM_PURE_CCP, RANDOM_PURE_DARN, - RANDOM_PURE_TPM, RANDOM_PURE_VMGENID, RANDOM_PURE_QUALCOMM, RANDOM_PURE_ARMV8, RANDOM_PURE_ARM_TRNG, + RANDOM_PURE_SAFE, + RANDOM_PURE_GLXSB, ENTROPYSOURCE }; _Static_assert(ENTROPYSOURCE <= 32, diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index 0bcd17950daf..8da85a805545 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -139,16 +139,16 @@ newfs_command(const char *fstype, int use_default) } else if (strcmp(fstype, "freebsd-zfs") == 0) { int i; struct bsddialog_menuitem items[] = { - {"", 0, true, "fletcher4", "checksum algorithm: fletcher4", + {"", true, 0, "fletcher4", "checksum algorithm: fletcher4", "Use fletcher4 for data integrity checking. " "(default)"}, - {"", 0, false, "fletcher2", "checksum algorithm: fletcher2", + {"", false, 0, "fletcher2", "checksum algorithm: fletcher2", "Use fletcher2 for data integrity checking. " "(not recommended)"}, - {"", 0, false, "sha256", "checksum algorithm: sha256", + {"", false, 0, "sha256", "checksum algorithm: sha256", "Use sha256 for data integrity checking. " "(not recommended)"}, - {"", 0, false, "atime", "Update atimes for files", + {"", false, 0, "atime", "Update atimes for files", "Disable atime update"}, }; @@ -188,11 +188,11 @@ newfs_command(const char *fstype, int use_default) strcmp(fstype, "ms-basic-data") == 0) { int i; struct bsddialog_menuitem items[] = { - {"", 0, true, "FAT32", "FAT Type 32", + {"", true, 0, "FAT32", "FAT Type 32", "Create a FAT32 filesystem (default)"}, - {"", 0, false, "FAT16", "FAT Type 16", + {"", false, 0, "FAT16", "FAT Type 16", "Create a FAT16 filesystem"}, - {"", 0, false, "FAT12", "FAT Type 12", + {"", false, 0, "FAT12", "FAT Type 12", "Create a FAT12 filesystem"}, }; diff --git a/usr.sbin/utx/utx.8 b/usr.sbin/utx/utx.8 index ddcdcc08b2d2..354691e7138f 100644 --- a/usr.sbin/utx/utx.8 +++ b/usr.sbin/utx/utx.8 @@ -92,4 +92,4 @@ utility replaced in .Fx 10.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org |
