Skip to content

Conversation

jameslamb
Copy link
Collaborator

LightGBM provides a script, build-cran-package.sh, which can be used to produce a CRAN-style source distribution of the R package.

This is effectively user-facing code, since we encourage users to run it while developing or building from master to get unreleased features (e.g. #4259 (comment), #4464 (comment)).

I realized yesterday, working on #3946 , that that script can break if called from a path that has spaces in it.

Consider the following:

mkdir -p './some files'
cd 'some files'
git clone --recursive https://github.com/microsoft/LightGBM.git
cd LightGBM
sh build-cran-package.sh

This errors out like so:

build-cran-package.sh: line 15: test: /Users/James.Lamb/repos/open-source/some: binary operator expected
cp: /Users/James.Lamb/repos/open-source/some is a directory (not copied).

This PR proposes quoting all shell variables in that script which include paths, which prevents this problem.

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.

Thanks! I searched for $ in that file and can confirm there are no unquoted path variables anymore.

@StrikerRUS StrikerRUS merged commit 75e486a into master Aug 2, 2021
@StrikerRUS StrikerRUS deleted the fix/shell-script-quotes branch August 2, 2021 17:43
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants