<div dir="ltr"><div><div><div><div><div><div>Dear Karl,<br><br>Thank you for taking the time to digest my patch and commit it to the original source repository.<br><br>The description of what you took and omitted was an interesting reading.<br><br>>  (if ! mv ...) is not portable. <br><br></div>I should have known! I thought it was one of the few things that I could assume across many shells.<br><br></div>Again, thank you so much for the inclusion of the essence of my patch.<br><br></div>I use Debian on my linux installations (basically desktop work, and one server-like service).<br>So once Debian's package gets refreshed (I think Nobert is reading this.),<br></div>I will have a chance to try this new script.<br>Partitions on a few PCs under my control are always near full without my intending to make them so<br></div><div>[I am afraid that Debian's default partition setting does not reflect the bloating of many modern packages especially the ones with good documentation material: I am horrified to look at the default partition size offered by Debian's automatic installer lately. The offered size would be too small to hold <br>many development packages and TeX-related packages altoghether, and I am not hoarding up<br>many development packages myself. Maybe a minimum to compile moizlla firefox from command line.],<br></div>and so would be good test beds.<br><br></div>TIA<br><br><div><div><div><div><div><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-24 3:10 GMT+09:00 Karl Berry <span dir="ltr"><<a href="mailto:karl@freefriends.org" target="_blank">karl@freefriends.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi again Zephyrus, months later,<br>
<br>
I finally had a chance to look at your fmtutil patch (message archived<br>
at <a href="http://tug.org/pipermail/tex-live/2014-May/035443.html" target="_blank">http://tug.org/pipermail/tex-live/2014-May/035443.html</a>), and have<br>
essentially installed it, modulo some stylistic and portability tweaks.<br>
Thank you very very much.<br>
<br>
After installing your changes, I went through and removed half of<br>
"#####..." lines and otherwise tightened up commentary (not related to<br>
your patch).<br>
<br>
I hope you can try out the new version, which you can get from our svn<br>
repository here:<br>
  <a href="http://tug.org/svn/texlive/trunk/Build/source/texk/texlive/tl_scripts/fmtutil.sh" target="_blank">http://tug.org/svn/texlive/trunk/Build/source/texk/texlive/tl_scripts/fmtutil.sh</a><br>
It is working for me, but I did not try to set up a near-diskfull condition<br>
(pace <a href="http://stackoverflow.com/questions/5661966/how-to-make-disk-quota-full" target="_blank">http://stackoverflow.com/questions/5661966/how-to-make-disk-quota-full</a>).<br>
I've also committed it to the TeX Live runtime (Master/...), so people<br>
using tlmgr can get it that way.<br>
<br>
By the way, the native TeX Live fmtutil has never used set -e, so if you<br>
want that, you'll need to add it (as I guess Debian does).  I don't like<br>
set -e, because of its action-at-a-distance effects, resulting logic<br>
contortions, and often-unnecessary-and-confusing aborts.  I think it is<br>
better to check for errors explicitly, as desired, instead of aborting<br>
by default merely because a command exited nonzero.  I know other people<br>
have other opinions, and that's fine, I don't expect to change those<br>
opinions, but I also don't intend to change TL in this regard.<br>
<br>
    [log_warning vs. log_failure]<br>
<br>
I didn't see a reason to distinguish warnings from errors if both result<br>
in a nonzero exit status.  There didn't seem to be any difference left<br>
between them.  So I simply changed the two remaining log_warning calls<br>
into log_failure and got rid of everything about warnings.  Both of the<br>
calls seemed to deserve failure, anyway: the engine -ini invocation<br>
failing, and the rm -f of the possibly-empty $destfile failing.  I<br>
changed the latter to only run if $destfile actually exists, to combat<br>
broken implementations of rm -f, of which I hope there are none, but ...<br>
<span class=""><br>
    Now I notice that, if fmtutil.sh is passed "--no-error-if-no-format",<br>
<br>
</span>I don't think that option matters to your scenarios.  It is passed by<br>
tlmgr when a TeX engine is updated, because it's possible that no<br>
formats are enabled for a given engine.  (Either the packages<br>
have not been installed, or the user has disabled them, or whatever.)<br>
As far as I can recall/determine, that's the only situation in which<br>
it's used.<br>
<br>
<br>
Let me also mention some of your changes I omitted:<br>
<br>
As I understand it, the "strange IFS shuffling" you mention in a couple<br>
places is not strange, and is not about avoiding shell prompts (which<br>
should never happen anyway in non-interactive scripts, afaik).  It's the<br>
standard usage of IFS: specifying where strings are broken into words by<br>
the shell.  So I didn't include those comments.<br>
<br>
Negating test conditions so as to put the shorter error-handling first<br>
doesn't work; negating the command itself in conditions (if ! mv ...) is<br>
not portable.  Besides, although I understand the impetus to put the<br>
shorter branch first, I still find it more readable and maintainable to<br>
keep test conditions positive when possible.<br>
<br>
I also omitted the comments relating to your thinking process as you<br>
worked through all this.  Comments should not usually be temporal, as in<br>
"used to be this" or "now is changed to that", but rather document how<br>
and why the program works as it is currently constituted.  History can<br>
be found through history.<br>
<br>
Finally, just FYI, many shell constructs that may seem puzzling<br>
are described in<br>
<a href="https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Portable-Shell.html" target="_blank">https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Portable-Shell.html</a><br>
<br>
thanks again,<br>
karl<br>
</blockquote></div><br></div>