bug-ed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ed] Ed scripts failing in versions after ~1.10


From: David Given
Subject: [Bug-ed] Ed scripts failing in versions after ~1.10
Date: Mon, 21 May 2018 23:42:11 +0200

Hello,

I maintain the Amsterdam Compiler Kit, a compiler toolchain dating from about 1984. It makes extensive use of code generation using a variety of slightly dubious scripts in many languages, including ed.

Since about ed 1.11, the ACK fails to build because some of the ed scripts won't run any more. Here is an example of one:

#!/bin/sh
echo "/* this part is generated from $1 at: " `date` "*/"
ed -s $1 <<'EOI' 
1,/^$/d
1,/^$/d
1,$s/^\(...\) \(.\).*/\1:\2/
g/:d/s/^\(...\):\(.\).*/#define C_\1(c) CC_opcst(op_\1, c)/
g/:[cslnfzor]/s/^\(...\):\(.\).*/#define C_\1(c) CC_opcst(op_\1, c)/
g/:w/s/^\(...\).*/#define C_\1(w) CC_opcst(op_\1, w)\
#define C_\1_narg() CC_opnarg(op_\1)/
g/:g/s/^\(...\).*/#define C_\1(g) CC_opcst(op_\1, g)\
#define C_\1_dnam(g, o) CC_opdnam(op_\1, g, o)\
#define C_\1_dlb(g, o) CC_opdlb(op_\1, g, o)/
g/:p/s/^\(...\).*/#define C_\1(p) CC_oppnam(op_\1, p)/
g/:b/s/^\(...\).*/#define C_\1(b) CC_opilb(op_\1, b)/
g/:-/s/^\(...\).*/#define C_\1() CC_op(op_\1)/
1,$p
EOI

(from https://github.com/davidgiven/ack/blob/default/modules/src/em_code/make.em.gen)

When run with ed 1.13, the script fails with an exit status of 1. No diagnostics are produced and the file contents looks correct.

This looks like I'm running afoul of the warning-on-unsaved-buffer behaviour; however, changing the script to end with:

1,$p
Q
EOI

...has no effect; even though the Q command has been issued, and I've verified it's been executed, the exit status is still 1.

Does anyone know what's happening here, and if there's a way to persuade ed to quit with an exit status of 0? (I'd rather not discard ed's exit status as that would hide processing errors in the scripts.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]