depends: $(package)_*_env settings only apply to the first command #22719

issue dongcarl openend this issue on August 16, 2021
  1. dongcarl commented at 4:53 pm on August 16, 2021: contributor

    For example, $(package)_config_env is prepended to $(package)_config_cmds, which means that if $(package)_config_cmds contains multiple commands chained by &&, only the first command would have its environment modified according to $(package)_config_env.

    https://github.com/bitcoin/bitcoin/blob/b935abb9eb2eeaceb5621e110e1889c2ce1b7734/depends/funcs.mk#L212

    Since $(package)_*_env settings contain crucial env vars such as PATH or PKG_CONFIG_PATH, its omission in subsequent commands is likely a bug:

    https://github.com/bitcoin/bitcoin/blob/b935abb9eb2eeaceb5621e110e1889c2ce1b7734/depends/funcs.mk#L137-L142

    This has lead to problems such as: #16883 (comment)

    A test-able demo of this problem: https://github.com/dongcarl/bitcoin/commit/e233c6d1e96ed35489c6be37f07bd01546083b9e

  2. hebasto commented at 5:04 pm on August 16, 2021: member
    As export (see #19882) looks pretty invasive, maybe bash -c '...'?
  3. dongcarl commented at 5:29 pm on August 16, 2021: contributor

    As export (see #19882) looks pretty invasive, maybe bash -c '...'?

    Wouldn’t bash -c '...' have the same effect as export?

  4. hebasto commented at 10:45 am on August 18, 2021: member

    As export (see #19882) looks pretty invasive…

    The assumption above is wrong.

    As a new sub-shell is invoked for each line of the recipe, there are no side effects of using export (#19882).

    A demo of the solution: https://github.com/hebasto/bitcoin/commit/926ba37cc5c351398253714fd143933d784dbc77.


    Wouldn’t bash -c '...' have the same effect as export?

    Yes, it would.

  5. hebasto added the label Brainstorming on Aug 26, 2021
  6. hebasto added the label Build system on Aug 26, 2021
  7. fanquake closed this on Dec 8, 2022

  8. sidhujag referenced this in commit 5dde8cb2a6 on Dec 8, 2022
  9. bitcoin locked this on Dec 8, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-24 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me