Your message dated Sat, 25 Jul 2009 20:04:50 +0200 (CEST)
with message-id <[email protected]>
has caused the report #536797,
regarding indent: [unix hatable] doesn't do proper backups of files in
dangerous situations
to be marked as having been forwarded to the upstream software
author(s) [email protected]
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
536797: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536797
Debian Bug Tracking System
Contact [email protected] with problems

Hello.
I received this from the Debian bug system:
---------- Forwarded message ----------
From: "Eddy [UTF-8] Petrior" <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Date: Mon, 13 Jul 2009 19:10:44 +0300
Subject: Bug#536797: indent: [unix hatable] doesn't do proper backups of files
in dangerous situations
Package: indent
Version: 2.2.10-1
Severity: important
Hello,
In the second chapter of the "Unix haters" book (named "Welcome, New
User!"), in the subchapter "Error Messages and Error Checking, NOT!"
there is a quote of a message from Pavel Curtis sent in 1992 to the
Unix haters mailing list. I am quoting a part from that message:
========================================
I attempt to type:
% ident foo
to see what versions of what source files are included in the execut-
able. [Never mind that RCS is obviously the wrong thing or that the
way ÿÿidentÿÿ works is unbelievably barbaric; I have bigger fish to
fry...]
Of course, though, on this occasion I mistyped as my fingers go on
autopilot and prefer the word ÿÿindentÿÿ to the non-word ÿÿident:ÿÿ
% indent foo
Now, it turns out that ÿÿindentÿÿ is the name of UNIXÿÿs brain-damaged
idea of a prettyprinter for C. Did the bastard who wrote this abortion
consider checking to make sure that its input was a C file (like, oh
my god, checking for whether or not the name ended in ÿÿ.cÿÿ)? I think
you know the answer. Further, Said Bastard decided that if you give
only one argument to indent then you must mean for the source code
to be prettyprinted in place, overwriting the old contents of the file.
But not to worry, SB knew you might be worried about the damage
this might do, so SB made sure to save a copy of your old contents in
foo.BAK. Did SB simply rename foo to foo.BAK? Of course not, far
better to copy all of the bits out of foo into foo.BAK, then truncate
the file foo, than to write out the new, prettyprinted file. Bastard.
========================================
Unfortunately, it seems that, 17 years later, the current indent
command still is broken and fails to make proper backups, as this set
of commands proves:
0 [email protected] /tmp/unixhaters $ cp /bin/bash .
0 [email protected] /tmp/unixhaters $ md5sum /bin/bash bash
c8770eb0a3f2b6088914b4bc29301113 /bin/bash
c8770eb0a3f2b6088914b4bc29301113 bash
0 [email protected] /tmp/unixhaters $ indent bash
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
indent: bash:1: Warning:Warning: File bash contains NULL-characters
0 [email protected] /tmp/unixhaters $ md5sum /bin/bash bash bash~
c8770eb0a3f2b6088914b4bc29301113 /bin/bash
fdd37c28b05dfbe6317facfc72f3059e bash
f0e8f38aa2e7c1e64ce367b934453e76 bash~
It would probably be a good idea to make sure that:
- the original file is renamed instead of copied (badly)
- the original file is a text file, more exactly a C file
- the command stops if it seems the file is binary (or at least asks
for a confirmation, if it detects such a situation)
--
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein