Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs recognized by adding —assert_compiler_success to interface tests #743

Open
BolunThompson opened this issue Jan 11, 2025 · 0 comments

Comments

@BolunThompson
Copy link
Contributor

BolunThompson commented Jan 11, 2025

When I add “—assert_compiler_success”, 32/42 interface tests pass. Tested on future with #742.

The following tests fail with one of the listed exceptions. They all look like real bugs!

  1. test2
  2. test3
  3. test4
  4. test5
  5. test16
  6. test_set
  7. test_set_e_2
  8. test_set-dash
  9. test_star
  10. test_redir_dup

Tested on my Ubuntu 24.04 VM. I don’t believe there’s any valid reason for an interface test to fail to compile (besides not being parallelizable, so, if these bugs are fixed, then I believe we can add —assert_compiler_success to the interface tests.

Exception 1

Daemon:  Traceback (most recent call last):
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 94, in compile_ir
    ret = compile_optimize_output_script(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 125, in compile_optimize_output_script
    optimized_ast_or_ir = compile_optimize_df_region(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 173, in compile_optimize_df_region
    asts_and_irs = compile_candidate_df_region(df_region, config.config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 221, in compile_candidate_df_region
    compiled_asts = compile_asts(candidate_df_region, fileIdGen, config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 89, in compile_asts
    expanded_ast = expand_command(ast_object, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 441, in expand_command
    return ast_match(command, expand_cases, exp_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/shasta/ast_node.py", line 996, in ast_match
    return cases[type(ast_node).NodeName](*args)(ast_node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 412, in <lambda>
    lambda ast_node: expand_simple(ast_node, exp_state)),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 457, in expand_simple
    node.arguments = expand_args(node.arguments, exp_state)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 263, in expand_args
    new = expand_arg(arg, exp_state, quoted = quoted)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 308, in expand_arg
    new = expand_arg_char(arg_char, quoted, exp_state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 349, in expand_arg_char
    return expand_var(fmt=arg_char.fmt,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 364, in expand_var
    _type, value = lookup_variable(var, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 221, in lookup_variable
    expanded_var = lookup_variable_inner(var, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 227, in lookup_variable_inner
    value = lookup_variable_inner_core(varname, exp_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 237, in lookup_variable_inner_core
    value = lookup_variable_inner_unsafe(varname, exp_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 245, in lookup_variable_inner_unsafe
    _type, value = exp_state.variables.get(varname, [None, None])
    ^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

Exception 2

Daemon:  Traceback (most recent call last):
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 94, in compile_ir
    ret = compile_optimize_output_script(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 125, in compile_optimize_output_script
    optimized_ast_or_ir = compile_optimize_df_region(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 173, in compile_optimize_df_region
    asts_and_irs = compile_candidate_df_region(df_region, config.config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 221, in compile_candidate_df_region
    compiled_asts = compile_asts(candidate_df_region, fileIdGen, config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 91, in compile_asts
    compiled_ast = compile_node(expanded_ast, fileIdGen, config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 133, in compile_node
    return ast_match(ast_object, compile_cases, fileIdGen, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/shasta/ast_node.py", line 996, in ast_match
    return cases[type(ast_node).NodeName](*args)(ast_node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 35, in <lambda>
    lambda fileIdGen, config: lambda ast_node: compile_node_command(
                                               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 193, in compile_node_command
    ir = compile_command_to_DFG(
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ir.py", line 292, in compile_command_to_DFG
    dfg_node = DFGNode(
               ^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/definitions/ir/dfg_node.py", line 44, in __init__
    self.com_redirs = [Redirection(redirection) for redirection in com_redirs]
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/definitions/ir/redirection.py", line 14, in __init__
    self.redir_subtype = redirection.redir_type
                         ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HeredocRedirNode' object has no attribute 'redir_type'. Did you mean: 'heredoc_type'?

Exception 3

Daemon:  Traceback (most recent call last):
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 94, in compile_ir
    ret = compile_optimize_output_script(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 125, in compile_optimize_output_script
    optimized_ast_or_ir = compile_optimize_df_region(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 173, in compile_optimize_df_region
    asts_and_irs = compile_candidate_df_region(df_region, config.config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 221, in compile_candidate_df_region
    compiled_asts = compile_asts(candidate_df_region, fileIdGen, config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 89, in compile_asts
    expanded_ast = expand_command(ast_object, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 441, in expand_command
    return ast_match(command, expand_cases, exp_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/shasta/ast_node.py", line 996, in ast_match
    return cases[type(ast_node).NodeName](*args)(ast_node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 410, in <lambda>
    lambda ast_node: expand_pipe(ast_node, exp_state)),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 446, in expand_pipe
    node.items[i] = expand_command(n, copy.deepcopy(exp_state))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 441, in expand_command
    return ast_match(command, expand_cases, exp_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/shasta/ast_node.py", line 996, in ast_match
    return cases[type(ast_node).NodeName](*args)(ast_node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 422, in <lambda>
    lambda ast_node: expand_redir_subshell(ast_node, exp_state)),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 481, in expand_redir_subshell
    node.node = expand_command(node.node, copy.deepcopy(exp_state))
                               ^^^^^^^^^
AttributeError: 'SubshellNode' object has no attribute 'node'

Exception 4

Daemon:  Traceback (most recent call last):
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 94, in compile_ir
    ret = compile_optimize_output_script(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 125, in compile_optimize_output_script
    optimized_ast_or_ir = compile_optimize_df_region(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 173, in compile_optimize_df_region
    asts_and_irs = compile_candidate_df_region(df_region, config.config)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/pash_compiler.py", line 221, in compile_candidate_df_region
    compiled_asts = compile_asts(candidate_df_region, fileIdGen, config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/compiler/ast_to_ir.py", line 89, in compile_asts
    expanded_ast = expand_command(ast_object, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 441, in expand_command
    return ast_match(command, expand_cases, exp_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/shasta/ast_node.py", line 996, in ast_match
    return cases[type(ast_node).NodeName](*args)(ast_node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 412, in <lambda>
    lambda ast_node: expand_simple(ast_node, exp_state)),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 457, in expand_simple
    node.arguments = expand_args(node.arguments, exp_state)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 263, in expand_args
    new = expand_arg(arg, exp_state, quoted = quoted)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 308, in expand_arg
    new = expand_arg_char(arg_char, quoted, exp_state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 346, in expand_arg_char
    return [QArgChar(expand_arg(arg_char.arg, exp_state, quoted = True))]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 308, in expand_arg
    new = expand_arg_char(arg_char, quoted, exp_state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 349, in expand_arg_char
    return expand_var(fmt=arg_char.fmt,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 364, in expand_var
    _type, value = lookup_variable(var, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 221, in lookup_variable
    expanded_var = lookup_variable_inner(var, exp_state)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 227, in lookup_variable_inner
    value = lookup_variable_inner_core(varname, exp_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 237, in lookup_variable_inner_core
    value = lookup_variable_inner_unsafe(varname, exp_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bolun/binpash/pash/python_pkgs/sh_expand/expand.py", line 245, in lookup_variable_inner_unsafe
    _type, value = exp_state.variables.get(varname, [None, None])
    ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
@BolunThompson BolunThompson changed the title Fix bugs caused by adding —assert_compiler_success to interface tests Bugs recognized by adding —assert_compiler_success to interface tests Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant