Found bugs in PAKCS show

From: Andy Jost <Andrew.Jost_at_synopsys.com>
Date: Sun, 25 Jan 2015 19:12:15 +0000

The PAKCS show function seems to have some problems related to the nonprint=
able characters \v and \f, and a different problem related to the single qu=
ote. I'm mentioning these just to be helpful. I am not expecting any urge=
nt action. I am using this version:

Version 1.11.4 (4)
Version of 2014-10-16

[1] Characters \v \f

These characters appear as \v -> \011 and \f -> \012. In fact, 11 and 12 a=
re the correct *decimal* representations of those numbers, but with the lea=
ding '0' they are presented as octal.

>From `man ascii`:

Oct Dec Hex Char
013 11 0B VT '\v' (vertical tab)
014 12 0C FF '\f' (form feed)

I didn't try all special characters, but probably others are affected. Per=
haps this is a formatting error (superfluous leading '0'), or some bug that=
 causes octal encodings to be incorrect.

[2] Single quotes are escaped inside of double-quoted strings. Doing this =
the once is OK, since the single quote is interpreted the same way whether =
it is escaped or not. But if show is applied multiple times, the extra bac=
kslash is further escaped, causing an incorrect result.

Here's a demonstration of the problem:

% pakcs -q
show 'a'
"\'a\'"
length $ show 'a'
3
show $ show 'a'
"\"\\\'a\\\'\""
length $ show $ show 'a'
7

% ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Prelude> show 'a'
"'a'"
Prelude> length $ show 'a'
3
Prelude> show $ show 'a'
"\"'a'\""
Prelude> length $ show $ show 'a'
5





_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mo Jan 26 2015 - 23:49:00 CET

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:11 CET