Ethereal-dev: Re: [Ethereal-dev] Bug in asn2eth - not properly handling .FN_BODY with "%s" in

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Tue, 18 Oct 2005 03:28:36 +0200
On 10/18/05, LEGO <luis.ontanon@xxxxxxxxx> wrote:
> In EthCnf.add_fn_line() at asn2eth.py:1275
> we should add the python equivalent for perl's
> line =~ s#%#%%#g;

It wasn't that simple...

Now we have to test this,
Luis


Index: asn2eth.py
===================================================================
--- asn2eth.py  (revision 16217)
+++ asn2eth.py  (working copy)
@@ -1109,7 +1109,10 @@
       elif self.eth_type[t]['user_def'] & 0x01:
         fx.write(self.eth_type_fn_h(t))
       else:
-        fx.write(self.eth_type[t]['val'].eth_type_fn(self.eth_type[t]['proto'],
t, self))
+        text =
self.eth_type[t]['val'].eth_type_fn(self.eth_type[t]['proto'], t,
self)
+        percent = re.compile("####")
+        text = percent.sub("%",text)
+        fx.write(text)
       if (not self.new and not self.dep_cycle_eth_type.has_key(t)):
         for f in self.eth_hf_ord:
           if (self.eth_hf[f]['ethtype'] == t):
@@ -1532,6 +1535,8 @@
         else:
           self.add_item(ctx, par[0], pars=par[1], fn=fn, lineno=lineno)
       elif ctx in ('FN_HDR', 'FN_FTR', 'FN_BODY'):
+        percent = re.compile("%")
+        line = percent.sub("####",line)
         self.add_fn_line(name, ctx, line, fn=fn, lineno=lineno)

   def unused_report(self):