← Back to team overview

touch-packages team mailing list archive

[Bug 1474366] Re: a2p has buggy output

 

** Attachment added: "demo1_a2p_armhf.pl"
   https://bugs.launchpad.net/ubuntu/+source/perl/+bug/1474366/+attachment/4429958/+files/demo1_a2p_armhf.pl

** Description changed:

  Ubuntu 14.04.2 LTS, amd64
  Package perl 5.18.2-2ubuntu1 amd64
  
  I tried to use a2p translator to convert simple AWK script to PERL
  script. I see that output is strange, characters are missing or are
  duplicated.
  
  Example of a2p output, fragment:
  
  lne: while (<>) {
      chomp;      ## strip record sepparator
      @Fld = split(/[,\n]/, $_, -1);
      if (/^C_ID/) {
          print $_;
          next line;
      }
  
  Notice, label lne is there, not line, notice comment "sepparator". This
  is just an example, a2p creates many similar errors. Other example:
  
  # crreate translation table
  for ($i = 32; $i < 28; $i++) {
      rintfprintf('%02x', $i)} = sprintf('%c', $i);
  }
  is is heads header, print it
  
  lie: while (<>>) {
      chomp;      # stip record separator
      @Fld =  split(/[,\n]/, $_, -1);
      if (/^C_ID/) {
          print $_;
          next line;
      }
  
      if 0-9]0-9]/) {
  
  Notice, label "lie" is there, not "line", notice comment "crreate",
  notice that condition in for loop is $i<28 but should be $i<128, notice
  AWK line
  
  XT[sprintf("%02x", i)]=sprintf("%c", i);
  
  was translated to
  
  rintfprintf('%02x', $i)} = sprintf('%c', $i);
  
  and notice the last line with "if".
  
  My LOCALE:
  
  $ locale
  LANG=en_US.UTF-8
  LANGUAGE=
  LC_CTYPE="en_US.UTF-8"
  LC_NUMERIC=en_US.UTF-8
  LC_TIME=en_US.UTF-8
  LC_COLLATE="en_US.UTF-8"
  LC_MONETARY=en_US.UTF-8
  LC_MESSAGES="en_US.UTF-8"
  LC_PAPER=en_US.UTF-8
  LC_NAME=en_US.UTF-8
  LC_ADDRESS=en_US.UTF-8
  LC_TELEPHONE=en_US.UTF-8
  LC_MEASUREMENT=en_US.UTF-8
  LC_IDENTIFICATION=en_US.UTF-8
  LC_ALL=
  
  I will attach two AWK scripts and two PERL scripts created with a2p,
- like this: a2p demo.awk > demo_a2p.pl
+ like this: a2p demo.awk > demo_a2p_amd64.pl; a2p demo1.awk >
+ demo1_a2p_amd64.pl

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to perl in Ubuntu.
https://bugs.launchpad.net/bugs/1474366

Title:
  a2p has buggy output

Status in perl package in Ubuntu:
  New

Bug description:
  Ubuntu 14.04.2 LTS, amd64
  Package perl 5.18.2-2ubuntu1 amd64

  I tried to use a2p translator to convert simple AWK script to PERL
  script. I see that output is strange, characters are missing or are
  duplicated.

  Example of a2p output, fragment:

  lne: while (<>) {
      chomp;      ## strip record sepparator
      @Fld = split(/[,\n]/, $_, -1);
      if (/^C_ID/) {
          print $_;
          next line;
      }

  Notice, label lne is there, not line, notice comment "sepparator".
  This is just an example, a2p creates many similar errors. Other
  example:

  # crreate translation table
  for ($i = 32; $i < 28; $i++) {
      rintfprintf('%02x', $i)} = sprintf('%c', $i);
  }
  is is heads header, print it

  lie: while (<>>) {
      chomp;      # stip record separator
      @Fld =  split(/[,\n]/, $_, -1);
      if (/^C_ID/) {
          print $_;
          next line;
      }

      if 0-9]0-9]/) {

  Notice, label "lie" is there, not "line", notice comment "crreate",
  notice that condition in for loop is $i<28 but should be $i<128,
  notice AWK line

  XT[sprintf("%02x", i)]=sprintf("%c", i);

  was translated to

  rintfprintf('%02x', $i)} = sprintf('%c', $i);

  and notice the last line with "if".

  My LOCALE:

  $ locale
  LANG=en_US.UTF-8
  LANGUAGE=
  LC_CTYPE="en_US.UTF-8"
  LC_NUMERIC=en_US.UTF-8
  LC_TIME=en_US.UTF-8
  LC_COLLATE="en_US.UTF-8"
  LC_MONETARY=en_US.UTF-8
  LC_MESSAGES="en_US.UTF-8"
  LC_PAPER=en_US.UTF-8
  LC_NAME=en_US.UTF-8
  LC_ADDRESS=en_US.UTF-8
  LC_TELEPHONE=en_US.UTF-8
  LC_MEASUREMENT=en_US.UTF-8
  LC_IDENTIFICATION=en_US.UTF-8
  LC_ALL=

  I will attach two AWK scripts and two PERL scripts created with a2p,
  like this: a2p demo.awk > demo_a2p_amd64.pl; a2p demo1.awk >
  demo1_a2p_amd64.pl

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/perl/+bug/1474366/+subscriptions


References