help-gnats
[Top][All Lists]
Advanced

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

Extra empty line in Unformatted


From: Lars Henriksen
Subject: Extra empty line in Unformatted
Date: Wed, 8 Jan 2003 20:14:59 +0100
User-agent: Mutt/1.4i

Have you ever pondered over this comment in parsepr() in gnatsweb 4?

  # 3/30/99 kenstir: For some reason Unformatted always ends up with an
  # extra newline here.
  $fields{$UNFORMATTED_FIELD} ||= ''; # Default to empty value
  $fields{$UNFORMATTED_FIELD} =~ s/\n$//;

I have, and now I've found the reason for the extra newline. The bug is in
GNATS: a query with format 'full' returns an extra, empty line after each PR.
Try "query-pr --format=full <PR>" and compare with the PR file in the
database. The command "pr-edit --lock <user> <PR>" also returns the full PR,
but without the extra newline.

This is of no consequence when viewing PRs, but it is when editing. Gnatsweb
retrieves a PR for editing with the equivalent of the query-pr command above
and fills in the form. When the user submits the form, gnatsweb retrieves and
locks the PR with the equivalent of the pr-edit command above. Gnatsweb then
overwrites the old PR fields with the values from the form. Without the hack
above the last PR field (which happens to be Unformatted) will get an extra
line appended.

Fix follows.

Lars Henriksen

Index: cmds.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/cmds.c,v
retrieving revision 1.70
diff -u -p -r1.70 cmds.c
--- cmds.c      14 Oct 2002 11:42:25 -0000      1.70
+++ cmds.c      8 Jan 2003 19:01:00 -0000
@@ -281,7 +281,7 @@ server_print_query (int which, PR *pr, Q
        }
       else
        {
-         printf ("\r\n.\r\n");
+         printf (".\r\n");
        }
     }
 }




reply via email to

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