Master

A wrong page as ordered prints

A page that is wrong is a page that was wrong at one step. The prints are the steps in order, and the order is why the answer is a step rather than a guess.

What you will see

A byte count. Right page and wrong count is a write that is the answer.

About 1 min of reading

Try It

Find the first wrong print

1

Print the matter

printf 'title=Ship date=2027-01-05\n' > /tmp/1.txt; cat /tmp/1.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Names and values. A right matter means the wrongness is later.
2

Print the holes

printf 'title\ndate\nbody\n' > /tmp/2.txt; comm -1 /tmp/2.txt /dev/null | head -1

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A name. A hole that was not filled is the answer.
3

Print the written bytes

printf '

Ship

\n' > /tmp/3.txt; wc -c < /tmp/3.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A byte count. Right page and wrong count is a write that is the answer.

Data Flow

A wrong page to a step
1 The matter is printed first
↓
2 The holes are printed second
↓
3 The written bytes are printed third
↓
4 The first wrong print is the step
Why this works
Why the prints are ordered

The first wrong print is the step. Ordered is what makes the first wrong print findable.

The one print that must not be skipped

The written file. Skipping it is guessing, and guessing is what makes a fix wrong.

Examples

The first print is the matter

The names and values that were read. A wrong matter is a wrong page, and the wrongness stops there.

The second print is the holes

The names the template asked for. A hole that was not filled is the answer, and the answer is a name.

The third print is the written file

The bytes that were written. A right page and wrong bytes is a write that is the answer.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Building a large site in chunks
Previous Lesson
Building a large site in chunks
Next Lesson
Shipping with every limit in one file
Shipping with every limit in one file →