History log of /netbsd-src/bin/sh/bltin/echo.c (Results 1 – 15 of 15)
Revision Date Author Comments
# e177ba53 18-May-2021 kre <kre@NetBSD.org>

Fix a bug in the built-in echo in /bin/sh reported in private mail by
Oguz <oguzismailuysal@gmail.com>

If echo detects an I/O error, it does exit(1) (that's fine) but then
the next echo also does ex

Fix a bug in the built-in echo in /bin/sh reported in private mail by
Oguz <oguzismailuysal@gmail.com>

If echo detects an I/O error, it does exit(1) (that's fine) but then
the next echo also does exit(1) even without any errors of its own,
and every following echo writing to stdout does the same thing.

eg:

echo foo >&- ; echo $?; echo $?; ( echo $( echo $?; echo $?) ; echo $? )
1
1
1 1
1

The first echo writes nothing (stdout is closed) but does exit(1).
The second echo writes "1" (correct, the exit status of the previous
echo) and should exit(0) - but doesn't. This pattern continues...

While here, conform to the POSIX requirement on echo (and many other
standard utilities, but definitely not all) that when the utility
does exit(>0) a message must be written to stderr (and vice versa
in many cases). Our echo (as shown above) did the exit(1) part
when it detected the I/O error, but no message is sent to stderr.
Fix that while we're here.

Similar changes are required for /bin/echo (coming soon), and
/usr/bin/printf (which is also the sh builtin printf) - except
currently that one kind of conforms, as it ignores errors writing
to stdout (as do large numbers of other utilities). For many
programs that's kind of acceptable, but where the sole purpose of
the program is to write to stdout, it really isn't. Also to be
fixed soon.

show more ...


# 30a14162 12-Oct-2008 dholland <dholland@NetBSD.org>

output.c output.h: expose OUTPUT_ERR (flag for an exposed flags variable)
bltin.h: support ferror()
echo.c: use ferror() to fail on output write errors

Another piece of PR bin/39574.


# bcf893f4 12-Dec-2007 lukem <lukem@NetBSD.org>

use __RCSID()


# 3fa24d78 06-Feb-2005 perry <perry@NetBSD.org>

remove obsolete register declarations


# b5b29542 07-Aug-2003 agc <agc@NetBSD.org>

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 617b132a 04-Jan-2003 wiz <wiz@NetBSD.org>

Spell output with two ts.


# c02b3bbd 24-Nov-2002 christos <christos@NetBSD.org>

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentia

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
(so I could unset -e PS1 before running the test shell...)

show more ...


# 846dce0e 02-Nov-1996 christos <christos@NetBSD.org>

Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)


# 49f0ad86 21-Mar-1995 cgd <cgd@NetBSD.org>

convert to new RCS id conventions.


# cafd1f7e 11-Jun-1994 mycroft <mycroft@NetBSD.org>

Add RCS ids.


# 05a9db8e 11-May-1994 jtc <jtc@NetBSD.org>

sync with 4.4lite


# 8542364e 01-Aug-1993 mycroft <mycroft@NetBSD.org>

Add RCS identifiers.


# 06be6008 23-Mar-1993 cgd <cgd@NetBSD.org>

changed "Id" to "Header" for rcsids


# 346aa5dd 22-Mar-1993 cgd <cgd@NetBSD.org>

added rcs ids to all files


# 61f28255 21-Mar-1993 cgd <cgd@NetBSD.org>

initial import of 386bsd-0.1 sources