fabriziotappero/Free-Range-VHDL-book

clean.cmd has `del *~*` which is dangerous

Closed this issue · 2 comments

I wanted to build the book with solutions.tex, so using Windows I installed MinTex and ran the build (clean.cmd followed by compile.cmd).

I noticed that not only were the solutions absent, but several later chapters were missing.

On investigation I saw that the clean has del *~*... so does the Bash one (rm *~*), but in Windows the *~* bit is very dangerous because of short filenames: any file that has more than the standard DOS 8.3 characters gets a short name associated with it, containing a tilde. This is normally invisible, but it's a gotcha when wildcarding with tildes.

To see this in action, let's look at the output of dir /x *~* on a fresh clone:

01/13/2021  02:03                75 GITIGN~1     .gitignore
01/13/2021  02:03               717 ACKNOW~1.TEX acknowledgments.tex
01/13/2021  02:03            15,605 CHAPTE~1.TEX chapter10.tex
01/13/2021  02:03            26,527 CHAPTE~2.TEX chapter11.tex
01/13/2021  02:03            10,739 CHAPTE~3.TEX chapter12.tex
01/13/2021  02:03            10,289 CHAPTE~4.TEX chapter13.tex
01/13/2021  02:03             9,227 CHB685~1.TEX chapter14.tex
01/13/2021  02:03             1,442 CONTRI~1     contribute
01/13/2021  02:03             4,209 INTROD~1.TEX introduction.tex
01/13/2021  02:03            63,378 SOLUTI~1.TEX solutions.tex

del *~* will delete every single one of those files. If you're unlucky enough to have the .git not hidden (say after a copy) it'll try to delete that too (as it's short name is GIT~1). The subsequent build will be missing key elements.

I'm not sure what this is supposed to be matching (perhaps ~filename.ext temp files?) but *~* should NOT be present in clean.cmd

Without that del *~* line things work very normally, and I can generate the book with all the chapters and the solutions.

The script has been fixed