bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-indent] Data loss (bug from indent-2.2.6 not fixed yet).


From: Santiago Vila
Subject: [Bug-indent] Data loss (bug from indent-2.2.6 not fixed yet).
Date: Sat, 29 Dec 2001 17:22:06 +0100 (CET)

Hello.

If hello.c and bye.c are files having mode 644, and hello.c~ and bye.c~
are files having mode 444, the command:

indent hello.c bye.c

truncates hello.c to a zero-length file, which is very bad.

This bug was reported by Jon Nelson <address@hidden> via the
Debian Bug System (Bug#84918 at bugs.debian.org).

Ken Harris <address@hidden> suggested this patch:

diff -u -r indent-2.2.7.orig/src/indent.c indent-2.2.7/src/indent.c
--- indent-2.2.7.orig/src/indent.c      Tue Oct 16 20:23:49 2001
+++ indent-2.2.7/src/indent.c   Sat Dec 29 16:41:22 2001
@@ -2556,6 +2556,7 @@

          in_name = out_name = in_file_names[i];
          current_input = read_file (in_file_names[i], &file_stats);
+         make_backup (current_input, &file_stats);
          output = fopen (out_name, "w");

          if (output == 0)
@@ -2564,7 +2565,6 @@
              exit (indent_fatal);
            }

-         make_backup (current_input, &file_stats);
          reset_parser ();
          status = indent (current_input);

which I applied to the Debian version.

The bug was reported against indent-2.2.6 but it is still present in 2.2.7,
so I report it here again.

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]