firefly icon indicating copy to clipboard operation
firefly copied to clipboard

Invalid escape sequences

Open KronicDeth opened this issue 5 years ago • 5 comments

There are invalid escapes sequences according to EIR in the following files in OTP, which Erlang/BEAM deems valid, so EIR's rules need to updated to match:

  • ib/dialyzer/src/typer.erl
  • lib/common_test/src/unix_telnet.erl
  • lib/compiler/src/cerl.erl
  • lib/compiler/src/core_scan.erl
  • lib/edoc/src/edoc_extract.erl
  • lib/edoc/src/edoc_layout.erl
  • lib/edoc/src/edoc_lib.erl
  • lib/edoc/src/edoc_macros.erl
  • lib/edoc/src/edoc_scanner.erl
  • lib/edoc/src/edoc_specs.erl
  • lib/edoc/src/edoc_tags.erl
  • lib/inets/src/http_server/httpd_request.erl
  • lib/inets/src/http_server/mod_esi.erl
  • lib/inets/src/http_server/mod_range.erl
  • lib/kernel/src/group.erl
  • lib/kernel/src/os.erl
  • lib/kernel/src/user_drv.erl
  • lib/megaco/src/engine/megaco_sdp.erl
  • lib/observer/src/cdv_bin_cb.erl
  • lib/observer/src/cdv_term_cb.erl
  • lib/observer/src/crashdump_viewer.erl
  • lib/os_mon/src/disksup.erl
  • lib/reltool/src/reltool.hrl
  • lib/sasl/src/systools_make.erl
  • lib/stdlib/src/edlin.erl
  • lib/stdlib/src/erl_scan.erl
  • lib/stdlib/src/escript.erl
  • lib/stdlib/src/io_lib.erl
  • lib/stdlib/src/io_lib.erl
  • lib/stdlib/src/io_lib_format.erl
  • lib/stdlib/src/io_lib_pretty.erl
  • lib/tools/src/tags.erl
  • lib/xmerl/src/xmerl_regexp.erl

KronicDeth avatar Sep 21 '20 23:09 KronicDeth

This should be fixed by https://github.com/eirproject/eir/commit/ef2c1c968aef80f3ccdf375972bc056f66730306

hansihe avatar Oct 05 '20 08:10 hansihe

There are 12 invalid string escape outstanding in OTP:

  • erts/preloaded/src/erl_prim_loader.erl
  • lib/dialyzer/src/typer.erl
  • lib/inets/src/http_server/httpd_request.erl
  • lib/inets/src/http_server/httpd_util.erl
  • lib/inets/src/http_server/mod_esi.erl
  • lib/inets/src/http_server/mod_range.erl
  • lib/megaco/src/engine/megaco_sdp.erl
  • lib/observer/src/cdv_bin_cb.erl
  • lib/observer/src/cdv_term_cb.erl
  • lib/observer/src/crashdump_viewer.erl
  • lib/reltool/src/reltool_utils.erl
  • lib/sasl/src/systools_make.erl

This means that 21 of the original 33 were fixed by eirproject/eir@ef2c1c9

KronicDeth avatar Oct 05 '20 17:10 KronicDeth

Should be fixed by https://github.com/eirproject/eir/commit/ec689a893c2ac48955b7a25f793ca71421fc90a9

hansihe avatar Oct 06 '20 05:10 hansihe

Somehow, even though you're allowing any unknown character this is still considered as invalid string escape:

2020-10-06T18:20:22.0422940Z ---- lumen::otp::lib::stdlib::edlin stdout ----
2020-10-06T18:20:22.0424150Z thread 'lumen::otp::lib::stdlib::edlin' panicked at 'Compilation failed
2020-10-06T18:20:22.0424550Z Commands:
2020-10-06T18:20:22.0424900Z cd /Users/runner/work/lumen/lumen/native_implemented/otp
2020-10-06T18:20:22.0426870Z "../../bin/lumen" "compile" "--output-dir" "tests/external/lumen/otp/lib/stdlib/edlin/_build" "--output" "tests/external/lumen/otp/lib/stdlib/edlin/bin/edlin" "-O0" "--emit=all" "/Users/runner/work/lumen/otp/lib/stdlib/src/edlin.erl" "--include" "/Users/runner/work/lumen/otp/lib" "--include" "/Users/runner/work/lumen/otp/lib/kernel/include" "--include" "/Users/runner/work/lumen/otp/lib/stdlib/include" "--include" "/Users/runner/work/lumen/otp/lib/stdlib/src"
2020-10-06T18:20:22.0428430Z 
2020-10-06T18:20:22.0428620Z stdout: 
2020-10-06T18:20:22.0429000Z stderr:    Compiling /Users/runner/work/lumen/otp/lib/stdlib/src/edlin.erl
2020-10-06T18:20:22.0429430Z error: invalid string escape
2020-10-06T18:20:22.0430240Z     ┌─ /Users/runner/work/lumen/otp/lib/stdlib/src/edlin.erl:200:10
2020-10-06T18:20:22.0431080Z     │
2020-10-06T18:20:22.0431690Z 200 │ key_map($\^], none) -> auto_blink;
2020-10-06T18:20:22.0432420Z     │          ^^ expected control character symbol (a-z), found ']'
2020-10-06T18:20:22.0432700Z 
2020-10-06T18:20:22.0432930Z error: parsing failed
2020-10-06T18:20:22.0433130Z 
2020-10-06T18:20:22.0433670Z       Failed /Users/runner/work/lumen/otp/lib/stdlib/src/edlin.erl
2020-10-06T18:20:22.0434000Z 
2020-10-06T18:20:22.0434210Z Status code: 101
2020-10-06T18:20:22.0434950Z Signal: ', native_implemented/otp/tests/test.rs:131:5

You can reproduce this with cargo test --package liblumen_otp lumen::otp::lib::stdlib::edlin -- --exact

KronicDeth avatar Oct 06 '20 18:10 KronicDeth

Per Dec 9 standup, @hansihe will check to see if fixed or not

bcardarella avatar Dec 09 '20 16:12 bcardarella

This is no longer an issue, and I tested by running lib/dialyzer/src/typer.erl through the compiler, if something like this comes up again, let's open a new issue.

bitwalker avatar Aug 27 '22 05:08 bitwalker