-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[R-package] Avoid bashisms (non-POSIX code) in R-package/configure #6746
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
I was under the impression that R CMD check
would run checkbashisms
and that that would catch stuff like this (#6743 (comment)).
But it seems not. I just ran it (on my mac, with Homebrew's checkbashisms
v2.23.7),
checkbashisms ./R-package/configure
It caught these +=
issues and some others. Do any of these look relevant?
possible bashism in ./R-package/configure line 344 ([^] should be [!]):
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
possible bashism in ./R-package/configure line 348 ([^] should be [!]):
/^X\(\/\/\)[^/].*/{
possible bashism in ./R-package/configure line 462 ([^] should be [!]):
sed '/^.*\/\([^/][^/]*\)\/*$/{
possible bashism in ./R-package/configure line 526 (unsafe echo with backslash):
case `echo 'xy\c'` in
possible bashism in ./R-package/configure line 1792 (should be VAR="${VAR}foo"):
LGB_CPPFLAGS+=" -DMM_PREFETCH=1"
possible bashism in ./R-package/configure line 1827 (should be VAR="${VAR}foo"):
LGB_CPPFLAGS+=" -DMM_MALLOC=1"
possible bashism in ./R-package/configure line 1853 (should be >word 2>&1):
if command -v brew &> /dev/null; then
possible bashism in ./R-package/configure line 1857 (should be >word 2>&1):
brew --prefix libomp &>/dev/null && ac_brew_openmp=yes
The sed
ones are code-generated by autoconf
and out of our control. But those two output-redirection ones about brew
are in our control.
Also... can you please try testing your branch on whatever system you're on that led to the errors reported in #6743?
git clone --recursive [email protected]:microsoft/LightGBM.git
cd ./LightGBM
sh build-cran-package.sh --no-build-vignettes
R CMD INSTALL ./lightgbm_*.tar.gz
@microsoft-github-policy-service agree company="Chainguard" |
403d321
to
6f3b008
Compare
Fixed the output-redirection (those are definitely not posix). I'll test later, but the changes here are absolutely improvement on their own. |
Then copied the lightgbm_4.5.0.99.tar.gz into a container where I previously had the problem.
Note, I clearly don't know what I'm doing with R dependencies.. I'm sure there is a better way to install the necessary deps, but i muddled my way through there. The output of configure looks sane and its building now, so this LGTM. |
Nah that's great, thank you very much! Just one more thing... it looks like you didn't push the changes you made related to output-redirection (I still just see |
'+=' (VAR+=Value) is bash specific. '&>' redirect operator is as well. On systems that did not have bash as /bin/sh this would end up causing strange compilation errors. Fixes microsoft#6743.
6f3b008
to
a0afebd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the report and fix!
On systems that did not have bash as /bin/sh this would end up causing strange compilation errors.
Fixes #6743.