Executing an invalid command during an ed session causes it to exit with a non 0 error status.

Bug #1030474 reported by Aaron Howell on 2012-07-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ed (Ubuntu)
Undecided
Unassigned

Bug Description

If an invalid command is executed while ed is being used interactively, the process will exit with a non 0 exit status, even if the editing session is successful.

Steps to reproduce:
1. Open a text file using ed.
2. Immediately write the text file back to disk with the w command.
3. Now press enter until you attempt to display a line beyond the end of the text file (ed will display a ? to show you've entered an invalid command).
4. Now press q to exit ed.

Note that even though you successfully saved the file and quit without making any further changes, ed still indicates an error occurred by exiting with status 1.
This information is not relevant to the calling program when ed is being used as an interactive editor.

This problem will also occur if you do something as simple as entering a letter that has no valid function, or by searching for a string that isn't found, or anything else that will cause ed to respond with ?.

The problem becomes an issue when you are using ed to edit things like email messages, or crontabs, where the calling process expects to get a 0 return from the editor.

Ed should only respond with a non 0 exit code when there was an actual problem reading or writing the file.

This problem is not Ubuntu specific it occurs on other flavours of Linux using the GNU version of ed.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: ed 1.6-2
ProcVersionSignature: Ubuntu 3.5.0-6.6-generic 3.5.0
Uname: Linux 3.5.0-6-generic x86_64
ApportVersion: 2.4-0ubuntu6
Architecture: amd64
Date: Sun Jul 29 19:14:38 2012
ProcEnviron:
 TERM=screen
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=en_AU.UTF-8
SourcePackage: ed
UpgradeStatus: No upgrade log present (probably fresh install)

Aaron Howell (aaron-kitten) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers