Skip to content

Fix Word Splitting and some minor improvments#3

Open
harmathy wants to merge 5 commits into
thomasfricke:mainfrom
harmathy:main
Open

Fix Word Splitting and some minor improvments#3
harmathy wants to merge 5 commits into
thomasfricke:mainfrom
harmathy:main

Conversation

@harmathy
Copy link
Copy Markdown

These changes mainly address issues #2 with word splitting. The solution, using temporary files for storing the find output, is described in the Shellcheck Wiki. It isn't very clean, IMO. But posix shell obviously doesn't offer very much help here.

There is a Github Action, which runs shellcheck for static analysis, which helps preventing such issues.

And also there are some minor improvements.

Add shebang to indicate, that this script is a posix sh shell script.
This eliminates relying on implicit wrapping of commands into some shell
by docker and allows static analysis with shellcheck.
This changes eliminates several issues with paths containing spaces.
First of all variables are now properly quoted. Then iteration over find
output takes an intermediate step with a temporary file to avoid word
splitting in a path.

The call to head -c 1 is replaced by printf, which is probably a shell
built-in and thus might save an external process call.

The outer iteration over the result of extract has moved from the
create_dir function to a main function.
@harmathy
Copy link
Copy Markdown
Author

Another possibility would be, to switch to bash and utilize its arrays, since the script requires ldd, which itself requires bash anyways.

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.

1 participant