Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/bin/sh
Hi,
After this commit, I have gotten the following error:
In file included from /usr/src/bin/sh/miscbltin.c:64:
/usr/src/bin/sh/syntax.h:50: error: "CEOF" redefined [-Werror]
50 | #define CEOF 10 /* end of file */
|
In file included from /usr/world/10.99/amd64/dest/usr/include/termios.h:313,
from /usr/src/bin/sh/miscbltin.c:59:
/usr/world/10.99/amd64/dest/usr/include/sys/ttydefaults.h:58: note: this is the
location of the previous definition
58 | #define CEOF CTRL('d')
Could you take a look at this error?
Thank you.
"Robert Elz" <kre%netbsd.org@localhost> writes:
> Module Name: src
> Committed By: kre
> Date: Thu Jul 3 03:54:40 UTC 2025
>
> Modified Files:
> src/bin/sh: miscbltin.c
>
> Log Message:
> Don't allow read to make use of the shell's internal '='
> terminates var names feature (which exists so in things
> like "external foo=bar" the shell can simply set the "variable"
> "foo=bar" to "bar" and doesn't need to put \0 on top of the '=',
> or copy the var name part elsewhere, and other similar internal
> advantages) - in most cases either allowing the '=' is intended, (as
> in the export example) or other checks make it impossible (${var} etc),
> but nothing was checking the var names passed to the read command.
>
> Fix that ... (side effect is that now if an invalid name is
> given, it will be detected before anything is read, before a
> prompt is written, rather than after the read, when the vars
> are being set to the fields from the line read).
>
> Don't bother doing this in SMALL shells, avoid the (small) extra
> code bloat - SMALL shells can just treat being able to say
> read a b=hello c (which means the same as read a b c)
> as a harmless foible...
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.56 -r1.57 src/bin/sh/miscbltin.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>
> Modified files:
>
> Index: src/bin/sh/miscbltin.c
> diff -u src/bin/sh/miscbltin.c:1.56 src/bin/sh/miscbltin.c:1.57
> --- src/bin/sh/miscbltin.c:1.56 Sat Oct 12 23:34:56 2024
> +++ src/bin/sh/miscbltin.c Thu Jul 3 03:54:40 2025
> @@ -1,4 +1,4 @@
> -/* $NetBSD: miscbltin.c,v 1.56 2024/10/12 23:34:56 kre Exp $ */
> +/* $NetBSD: miscbltin.c,v 1.57 2025/07/03 03:54:40 kre Exp $ */
>
> /*-
> * Copyright (c) 1991, 1993
> @@ -37,7 +37,7 @@
> #if 0
> static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95";
> #else
> -__RCSID("$NetBSD: miscbltin.c,v 1.56 2024/10/12 23:34:56 kre Exp $");
> +__RCSID("$NetBSD: miscbltin.c,v 1.57 2025/07/03 03:54:40 kre Exp $");
> #endif
> #endif /* not lint */
>
> @@ -61,6 +61,7 @@ __RCSID("$NetBSD: miscbltin.c,v 1.56 202
> #include <unistd.h>
>
> #include "shell.h"
> +#include "syntax.h"
> #include "options.h"
> #include "var.h"
> #include "input.h" /* for whichprompt */
> @@ -263,6 +264,13 @@ readcmd(int argc, char **argv)
> #else
> "Usage: read [-br] [-d C] [-n len] [-p prompt] var...");
>
> + while (*ap != NULL) {
> + if (!validname(*ap, '\0', NULL))
> + error("'%s': invalid variable name", *ap);
> + ap++;
> + }
> + ap = argptr;
> +
> (void)next_read_char(0, 0); /* make sure the buffer is empty */
> #endif
>
> @@ -478,7 +486,7 @@ umaskcmd(int argc, char **argv)
> out1fmt("%.4o\n", mask);
> }
> } else {
> - if (isdigit((unsigned char)*ap)) {
> + if (is_digit(*ap)) {
> int range = 0;
>
> mask = 0;
>
--
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
Home |
Main Index |
Thread Index |
Old Index