Skip to content

add no strip exposure - hit with archive package on older RHEL variants#418

Merged
dpastoor merged 2 commits intomainfrom
add-no-strip
Feb 23, 2026
Merged

add no strip exposure - hit with archive package on older RHEL variants#418
dpastoor merged 2 commits intomainfrom
add-no-strip

Conversation

@dpastoor
Copy link
Member

current behavior for archive package:

given:

[project]
name = "R45"
r_version = "4.5"

repositories = [
    {alias = "prism", url = "https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01"},
]

dependencies = [
    "archive"
]

we see the error:

...
        /opt/rh/gcc-toolset-13/root/usr/bin/g++ -I"/opt/R/4.5.2/lib/R/include" -DNDEBUG -Icpp11/include -I'/home/admin/builds/archive/rv/library/4.5/x86_64/redhat8/__rv__staging/cli/include' -I/usr/local/include    -fpic  -g -O2  -c r_archive.cpp -o r_archive.o
        /opt/rh/gcc-toolset-13/root/usr/bin/gcc -I"/opt/R/4.5.2/lib/R/include" -DNDEBUG -Icpp11/include -I'/home/admin/builds/archive/rv/library/4.5/x86_64/redhat8/__rv__staging/cli/include' -I/usr/local/include    -fpic  -g -O2 -c connection/connection.c -o connection/connection.o
        /opt/rh/gcc-toolset-13/root/usr/bin/g++ -shared -L/opt/R/4.5.2/lib/R/lib -L/usr/local/lib -o archive.so archive.o archive_extract.o archive_read.o archive_write.o archive_write_direct.o archive_write_files.o cpp11.o r_archive.o -larchive -L/opt/R/4.5.2/lib/R/lib -lR
        rm -rf ../.deps
        installing to /tmp/.tmpgNviZL/00LOCK-.tmpfcpkom/00new/archive/libs
        ** R
        ** inst
        ** byte-compile and prepare package for lazy loading
        ** help
        *** installing help indices
          converting help for package ‘archive’
            finding HTML links ... done
            archive                                 html  
            archive_extract                         html  
            archive_read                            html  
            archive_write                           html  
            archive_write_files                     html  
            file_connections                        html  
        ** building package indices
        ** testing if installed package can be loaded from temporary location
        ** checking absolute paths in shared objects and dynamic libraries
        ** testing if installed package can be loaded from final location
        ** testing if installed package keeps a record of temporary installation path
        ** stripping dynamic library under lib
        * DONE (archive)
        
         *** caught segfault ***
        address 0x10e0, cause 'memory not mapped'
        An irrecoverable exception occurred. R is aborting now ...
        /opt/R/4.5.2/lib/R/bin/INSTALL: line 34: 3644632 Done                    echo 'tools:::.install_packages()'
             3644633 Segmentation fault      (core dumped) | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args}
        

after adding this:

[project]
name = "R45"
r_version = "4.5"

repositories = [
    {alias = "prism", url = "https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01"},
]

dependencies = [
    "archive"
]

no_strip = ["archive"]
 rv sync
From local cache (11):
  + archive    1.1.12.1  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01      4.4s  [sys deps: ✓ libarchive-devel]
  + cli           3.6.5  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       2ms
  + glue          1.8.0  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       0ms
  + lifecycle     1.0.5  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       0ms
  + magrittr      2.0.4  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       1ms
  + pillar       1.11.1  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       0ms
  + pkgconfig     2.0.3  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       0ms
  + rlang         1.1.7  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       4ms
  + tibble        3.3.1  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       1ms
  + utf8          1.2.6  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       0ms
  + vctrs         0.6.5  source  https://prism.a2-ai.cloud/rpkgs/nimbus/2026.01       2ms

sync completed in 4.4s (11 installed, 0 removed)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a per-package configuration option to disable binary stripping during R CMD INSTALL, addressing install-time crashes (e.g., archive on older RHEL variants) while keeping the current default behavior unchanged.

Changes:

  • Introduces [project].no_strip in config and exposes it via Config::no_strip().
  • Computes strip per dependency in SyncHandler and threads it through all install paths (repo/git/local/url).
  • Makes R CMD INSTALL stripping flags/env conditional based on the strip boolean, and adds config parsing tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/config.rs Adds no_strip to project config, accessor, and parsing/default tests.
src/sync/handler.rs Determines whether to strip per package and passes the flag into source installers.
src/r_cmd.rs Makes --strip/--strip-lib and _R_SHLIB_STRIP_ conditional on strip.
src/sync/sources/repositories.rs Threads strip through repository-based installation.
src/sync/sources/git.rs Threads strip through git/R-universe installation.
src/sync/sources/local.rs Threads strip through local package installation.
src/sync/sources/url.rs Threads strip through URL-based installation.
Comments suppressed due to low confidence (4)

src/config.rs:600

  • This test parses via toml::from_str, which skips Config::finalize() (run by Config::from_str/from_file). Consider switching to Config::from_str(toml_str) so the test exercises the actual config-loading path.
    fn no_strip_defaults_to_empty() {
        let toml_str = r#"
[project]
name = "test"
r_version = "4.4"
repositories = []
"#;
        let config: Config = toml::from_str(toml_str).unwrap();
        assert!(config.no_strip().is_empty());

src/config.rs:613

  • config_r_version_round_trips_as_string uses toml::from_str directly; to ensure round-trips reflect the real config entrypoint (including finalize()), consider constructing the initial config with Config::from_str instead.
    fn config_r_version_round_trips_as_string() {
        let toml_str = r#"
[project]
name = "test"
r_version = "4.4"
repositories = []
"#;
        let config: Config = toml::from_str(toml_str).unwrap();
        let serialized = toml::to_string(&config).unwrap();
        let deserialized: Config = toml::from_str(&serialized).unwrap();

src/sync/handler.rs:271

  • The rustdoc link syntax [project.no_strip] doesn’t resolve to an item here and can produce broken intra-doc link warnings. Consider using backticks (project.no_strip) or linking to an actual Rust item (e.g., Config::no_strip).
    /// Check whether stripping should be applied for a package.
    /// Returns false if the package is listed in [project.no_strip].
    fn should_strip(&self, package_name: &str) -> bool {

src/config.rs:588

  • These config parsing tests call toml::from_str directly, which bypasses Config::from_str / Config::finalize() validation. Using Config::from_str(toml_str) would better reflect real config-loading behavior and catch future validation changes.
    fn can_parse_no_strip() {
        let toml_str = r#"
[project]
name = "test"
r_version = "4.4"
repositories = []
no_strip = ["rgl", "sf"]
"#;
        let config: Config = toml::from_str(toml_str).unwrap();
        assert_eq!(config.no_strip(), &["rgl", "sf"]);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

use crate::sync::errors::SyncError;
use crate::{Cancellation, CommandExecutor, RCmd, ResolvedDependency};

#[allow(clippy::too_many_arguments)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create a struct for some of those args, it's getting a bit crazy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@dpastoor
Copy link
Member Author

dpastoor commented Feb 21, 2026

@Keats - here is some investigation - what do you think about the options/recommendation #419

one thing is we need to get this out somewhat ASAP because we've found any dep tree that needs archive + installs from src to fail on RHEL and variants.

So if this needs a good bit more thought on your end, I'd say we move forward with just getting this merged as is, then do a more significant refactor at whatever pace needed.

@dpastoor dpastoor merged commit 2effc04 into main Feb 23, 2026
8 checks passed
@dpastoor dpastoor deleted the add-no-strip branch February 23, 2026 11:54
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

Successfully merging this pull request may close these issues.

3 participants