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

[ci] [R-package] use --no-xattrs when re-tarring CRAN-style package #6540

Merged
merged 1 commit into from
Jul 14, 2024

Conversation

jameslamb
Copy link
Collaborator

On my M2 Mac, with R 4.3.3 installed from CRAN, I found that the following:

sh build-cran-package.sh
R CMD INSTALL --with-keep.source ./lightgbm_4.4.0.99.tar.gz

Fails like this:

Error in rawToChar(info) : 
  embedded nul in string: '30 mtime=1720906116.345798869\n57 LIBARCHIVE.xattr.com.apple.provenance=AQAAf4WY23sneC8\n49 SCHILY.xattr.com.apple.provenance=\001\0\0\177\x85\x98\xdb{'x/\n'

Based on https://stackoverflow.com/a/74373784/3986677 and similar, it seems that the root cause is that BSD tar (the one available on my mac) copies "extra file attributes" into archives it creates. This is the opposite of what GNU tar does. From https://www.gnu.org/software/tar/manual/tar.html#Extended-File-Attributes

‘--no-xattrs’
Disable extended attributes support. This is the default.

This proposes specifying --no-xattrs so we get the same behavior building the R package and macOS and Linux.

output of 'tar --version' (click me)
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8
output of 'R --version' (click me)
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

Makes sense to me!
Strange that our macOS CI builds haven't catch this before.

@jameslamb
Copy link
Collaborator Author

Strange that our macOS CI builds haven't catch this before.

I agree! Maybe it's a difference in XCode versions or something? I can confirm that I didn't install any custom tar on my laptop... it's just the same /usr/bin/tar that was there by default.

Either way, this change seems safe. I tested as far back as Ubuntu 14.04 and found that GNU tar recognizes the --no-xattrs flag.

@jameslamb jameslamb merged commit 3d386be into master Jul 14, 2024
41 checks passed
@jameslamb jameslamb deleted the ci/r-script branch July 14, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants