[10721] in Athena Bugs
SYSV ed is broken
daemon@ATHENA.MIT.EDU (Calvin Clark)
Thu Jul 29 18:38:02 1993
Date: Thu, 29 Jul 93 18:37:47 EDT
From: Calvin Clark <ckclark@MIT.EDU>
To: bug-sparc@Athena.MIT.EDU
Cc: bug-rios@Athena.MIT.EDU, testers@Athena.MIT.EDU, bugs@Athena.MIT.EDU
It seems that ed on the RS/6000 and Sun likes to exit with non-zero
status for no apparent reason. It exits with status 2 when you create
a new file. (I know, I know, only a MORON would use an editor to create
a new file.) Example:
# <ckclark@deathtongue> ~
; ed
e nosuchfile
a
This is a line.
.
w
16
q
# <ckclark@deathtongue> ~
; echo $status
2 <<<<<<< WHAT???
# <ckclark@deathtongue> ~
; cat nosuchfile
This is a line. <<<<<<< See, it worked.
Okay. Now that we've determined that the creation of a file is an
abnormal condition, I will now demonstrate how failed string searches
are also ultimately fatal:
# <ckclark@deathtongue> ~
; cp /etc/motd . <<<<<<< Since creation of files fails
# <ckclark@deathtongue> ~
; ed motd
69
,p
Athena Workstation (SUN4c) Version 7.6F Tue Jul 27 12:29:06 EDT 1993
/sysvmushforbrains
?
w
69
q
# <ckclark@deathtongue> ~
; echo $status
2
# <ckclark@deathtongue> ~
; cat motd
Athena Workstation (SUN4c) Version 7.6F Tue Jul 27 12:29:06 EDT 1993
Actually, it seems that the SYSV ed is merciless.
If you make any mistake at all, say a typo, like:
# <ckclark@deathtongue> ~
; ed motd
69
eat flaming death
?
w
69
q
# <ckclark@deathtongue> ~
; echo $status
2
it loses.
On real systems (read: BSD and ULTRIX) these are not fatal errors.
See ANSI X3.159-1989 4.10.4.3, where the exit() function is described
using common English words like ``successful.''
Oh, and for the record, EXIT_SUCCESS and EXIT_FAILURE are 0 and 1,
respectively in <stdlib.h> on these machines. No where is
the integer `2' mentioned. No where is it documented, especially
in the man page.
This means, among other things, that ed, the Standard Text Editor,
cannot be used as $EDITOR. I can't use it for MH or sendbug or
discuss or mail or anything else (unless I'm a perfect typist,
which I am not.)
Thank you for your time. I hope this will put your kernel
difficulties in perspective.
-Calvin