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

bug(forge build): Stack overflow caused by FOUNDRY_LIBS or DAPP_LIBS containing an absolute path #9127

Open
2 tasks done
guidanoli opened this issue Oct 16, 2024 · 2 comments
Labels
C-forge Command: forge Cmd-forge-build Command: forge build T-bug Type: bug

Comments

@guidanoli
Copy link

guidanoli commented Oct 16, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (cc8e430 2024-10-16T00:22:08.572482504Z)

What command(s) is the bug in?

forge build

Operating System

Linux

Describe the bug

Steps to reproduce

  1. Push a temporary directory onto the stack
pushd "$(mktemp -d)" 
  1. Create a forge project
forge init
  1. Build the project with the environment variable FOUNDRY_LIBS set to an array that contains an absolute path to a directory. Also works with DAPP_LIBS. In this case, we use the absolute path to the lib folder just created by the forge init command.
FOUNDRY_LIBS=["$(pwd)/lib"] forge build
  1. This last command will exit with status code 134 and print the following error message.
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
@guidanoli guidanoli added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Oct 16, 2024
@guidanoli guidanoli changed the title Stack overflow caused by FOUNDRY_LIBS or DAPP_LIBS containing absolute paths Stack overflow caused by FOUNDRY_LIBS or DAPP_LIBS containing an absolute path Oct 16, 2024
@zerosnacks zerosnacks added the T-to-investigate Type: to investigate label Oct 16, 2024
@zerosnacks zerosnacks changed the title Stack overflow caused by FOUNDRY_LIBS or DAPP_LIBS containing an absolute path bug(forge build): Stack overflow caused by FOUNDRY_LIBS or DAPP_LIBS containing an absolute path Oct 16, 2024
@zerosnacks zerosnacks added C-forge Command: forge Cmd-forge-build Command: forge build and removed T-needs-triage Type: this issue needs to be labelled labels Oct 16, 2024
@DaniPopes
Copy link
Member

Backtrace:

...
    frame #1574: 0x00005555573c9b39 forge`foundry_config::Config::to_figment::h541c6e067745c370 + 12577
    frame #1575: 0x0000555557384ad6 forge`foundry_config::Config::figment_with_root::h375a3e4abd4042a9 + 37
    frame #1576: 0x00005555573db55b forge`foundry_config::providers::remappings::RemappingsProvider::get_remappings::h4582cffefceeb412 + 3529
    frame #1577: 0x00005555573c9b39 forge`foundry_config::Config::to_figment::h541c6e067745c370 + 12577
    frame #1578: 0x0000555557384ad6 forge`foundry_config::Config::figment_with_root::h375a3e4abd4042a9 + 37
    frame #1579: 0x00005555573db55b forge`foundry_config::providers::remappings::RemappingsProvider::get_remappings::h4582cffefceeb412 + 3529
    frame #1580: 0x00005555573c9b39 forge`foundry_config::Config::to_figment::h541c6e067745c370 + 12577
    frame #1581: 0x0000555557384ad6 forge`foundry_config::Config::figment_with_root::h375a3e4abd4042a9 + 37
    frame #1582: 0x00005555573db55b forge`foundry_config::providers::remappings::RemappingsProvider::get_remappings::h4582cffefceeb412 + 3529
    frame #1583: 0x00005555573c9b39 forge`foundry_config::Config::to_figment::h541c6e067745c370 + 12577
    frame #1584: 0x00005555570937d5 forge`foundry_cli::opts::build::core::_$LT$impl$u20$core..convert..From$LT$$RF$foundry_cli..opts..build..core..CoreBuildArgs$GT$$u20$for$u20$figment..figment..Figment$GT$::from::h321b45ab02f0c9ba + 549
    frame #1585: 0x0000555556106ef7 forge`forge::cmd::build::_$LT$impl$u20$core..convert..From$LT$$RF$forge..cmd..build..BuildArgs$GT$$u20$for$u20$figment..figment..Figment$GT$::from::heca88b3325567215 + 39
    frame #1586: 0x0000555556028a74 forge`forge::cmd::build::BuildArgs::run::hb7a2624b2cda8b4f + 84
    frame #1587: 0x00005555560e63b2 forge`forge::main::h580bf58d4be50b43 + 62754
    frame #1588: 0x0000555555bf0843 forge`std::sys::backtrace::__rust_begin_short_backtrace::h4216eb9ef7f856ad + 3
    frame #1589: 0x0000555556165330 forge`main + 1008
    frame #1590: 0x00007ffff7c8ce08 libc.so.6`___lldb_unnamed_symbol3261 + 120
    frame #1591: 0x00007ffff7c8cecc libc.so.6`__libc_start_main + 140
    frame #1592: 0x000055555590f58e forge`_start + 46

@DaniPopes
Copy link
Member

Happens because of this line which will end up trying to get remappings by recursing on itself

let config = Config::load_with_root(&lib).sanitized();

@zerosnacks zerosnacks removed the T-to-investigate Type: to investigate label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-build Command: forge build T-bug Type: bug
Projects
Status: Todo
Development

No branches or pull requests

3 participants