Installing Ed-0.2

Estimated build time:           1 minute
Estimated required disk space:  2 MB

Installation of Ed

Ed is an optional package. The only program on a normal LFS system that uses ed is patch. But these days, ed patch files are quite rare in favour of the diff format patch files. So, if you personally have no need to use ed, you can skip it.

Install Ed by running the following commands:

cp buf.c buf.c.backup &&
sed 's/int u/int u, sfd/' buf.c.backup | \
���sed '/.*\*mktemp.*/d' | \
���sed 's/.*if (mktemp.*/  sfd = mkstemp(sfn);\
���if ((sfd == -1) || (sfp = fopen (sfn, "w+")) == NULL)/' > buf.c &&
./configure --prefix=/usr &&
make &&
make install &&
mv /usr/bin/ed /usr/bin/red /bin

Command explanations

The sed commands fix a symlink vulnerability in ed. The ed executable creates files in /tmp with predictable names. By using various symlink attacks, it is possible to have ed write to files it should not, change the permissions of various files, etc.

Contents

The Ed package contains the ed program.

Description

Ed is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files.

Dependencies

Ed-0.2 needs the following to be installed:


sh from the bash package

ar from the binutils package
as from the binutils package
ld from the binutils package

chmod from the fileutils package
cp from the fileutils package
ln from the fileutils package
mv from the fileutils package
rm from the fileutils package
touch from the fileutils package

cc from the gcc package

grep from the grep package
egrep from the grep package

make from the make package

sed from the sed package

cat from the textutils package
tr from the textutils package