This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: cgi-bin/gnatsweb.pl
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: PATCH: cgi-bin/gnatsweb.pl
- From: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Date: Thu, 15 Mar 2001 23:53:24 +0100 (CET)
- cc: Tom Tromey <tromey at redhat dot com>
I moved over the following patch from the gnats/gnatsweb cvs tree:
2001-03-11 Tommi Virtanen <tv@debian.org>
* gnatsweb.pl (decode_attachment): Editing bugs with attached files
used to bomb out trying to chomp a constant string.
as "Import the change for revision 2.25 from gnatsweb CVS".
Tom, I believe you'll want that one, too.
Gerald
Index: gnatsweb.pl
===================================================================
RCS file: /cvs/gcc/wwwdocs/cgi-bin/gnatsweb.pl,v
retrieving revision 1.27
diff -u -3 -p -r1.27 gnatsweb.pl
--- gnatsweb.pl 2001/03/15 22:47:07 1.27
+++ gnatsweb.pl 2001/03/15 22:50:11
@@ -489,14 +489,15 @@ sub decode_attachment
my ($envelope, $body) = split(/\n\n/, $att);
return $hash_ref unless ($envelope && $body);
- # Got the idea from this from the perldoc for split.
- # The extra map step is the only way I could think of to strip
- # the trailing newlines from the hash values.
+ # Split mbox-like headers into (header, value) pairs, with a leading
+ # "From_" line swallowed into USELESS_LEADING_ENTRY. Junk the leading
+ # entry. Chomp all values.
warn "decode_attachment: envelope=>$envelope<=\n" if $debug;
- #%$hash_ref = (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope);
- %$hash_ref = (map {chomp; $_;}
- (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope));
- delete($$hash_ref{USELESS_LEADING_ENTRY});
+ %$hash_ref = (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope);
+ delete($hash_ref->{USELESS_LEADING_ENTRY});
+ for (keys %$hash_ref) {
+ chomp $hash_ref->{$_};
+ }
# Keep the original_attachment intact.
$$hash_ref{'original_attachment'} = $att;