Bug 105204 - [TASK] Check shell scripts with shellcheck
Summary: [TASK] Check shell scripts with shellcheck
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://github.com/koalaman/shellcheck
Whiteboard: target:5.4.0 target:5.5.0
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-09 10:32 UTC by JoNi
Modified: 2019-03-13 03:46 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JoNi 2017-01-09 10:32:08 UTC
shellcheck is a static analyser for shell scripts which is available in most linux distros.

I propose an easyhack to address the messages. This will fix many issues with spaces in folders names, other corner cases and make the scripts more robust overall.

who wants to work on this would have to install shellcheck
> sudo apt-get install shellcheck

run it on our shell scripts
> git grep -l -P '#!/.*((bash)|(sh))' | xargs shellcheck
or individually for each file e.g.
> shellcheck bin/distro-install-desktop-integration

output will look like this
> In bin/distro-install-desktop-integration line 131:
> cd $DESTDIR/$INSTALLDIR/share/xdg
> ^-- SC2164: Use cd ... || exit in case cd fails.
>    ^-- SC2086: Double quote to prevent globbing and word splitting.
>             ^-- SC2086: Double quote to prevent globbing and word splitting.
> 
> In bin/distro-install-desktop-integration line 135:
>     -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \
>                              ^-- SC2031: PRODUCTVERSION was modified in a subshell. That change might be lost.
> 
> In bin/distro-install-desktop-integration line 136:
>     -e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \
>                            ^-- SC2031: PRODUCTVERSION was modified in a subshell. That change might be lost.
> 
> In bin/distro-install-desktop-integration line 137:
>     *.desktop
>     ^-- SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.

there are extensive explanations for each issue number
e.g. https://github.com/koalaman/shellcheck/wiki/SC2164

fix the warnings and commit a patches for each file on gerrit
Comment 1 Xisco Faulí 2017-01-10 18:10:05 UTC
@Jan, a plausible easyhack?
Comment 2 jani 2017-01-10 18:27:37 UTC
Thanks for the veru precise documentation
Comment 3 Commit Notification 2017-01-13 20:55:25 UTC
Jochen Nitschke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1ad45ecbf172bca9d3eeff8750a0eb13731c322e

tdf#105204 shellcheck

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2017-01-17 06:40:45 UTC
qarkai committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d33d2a65a4ee54780ac005334bee176ddeec68fc

tdf#105204 fix shellcheck warnings in logerrit

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2017-02-04 08:47:30 UTC
qarkai committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e6a9dc22a4e58b565894f8cdb6a19755af7b14de

tdf#105204 fix shellcheck warnings in desktop/scripts

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2017-04-26 18:23:23 UTC
Ilmari Lauhakangas committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=55c5b27bd683a7c36f07c1be781d8baad30b4571

tdf#105204: ShellCheck nitpicks for g

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2017-04-27 10:24:08 UTC
Ilmari Lauhakangas committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e5b1c5374464f6f86b3d331fb89c0e126008136a

tdf#105204: more ShellCheck nitpicks for g

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2017-05-11 09:49:26 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e6f2952fc359eaf25d4b4dae52a0a380e7a95463

tdf#105204 fix shellcheck warnings in sysui/desktop/solaris

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2017-05-11 14:29:07 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e6b7caa702917bd7cf13248cc9b394518106446d

tdf#105204: ShellCheck nitpicks for watch-generated-code.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2017-05-20 09:27:09 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c80b3730ebe5a95aa685e5f02c285edeb21d4a5

tdf#105204 fix shellcheck warnings in ure/source/uno

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2017-05-20 09:32:03 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e20f6464cc4047876ce5e6d47510e8038c513234

tdf#105204: ShellCheck nitpicks for find-unused-data.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2017-05-20 09:32:38 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=020e1bff16a7bb5f401a2547d211807acd7db0fb

tdf#105204: ShellCheck nitpicks for gengal.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2017-05-20 09:37:29 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=027d661ef7e2490f1182d3e5003ae4da4135e0ca

tdf#105204 fix shellcheck warnings in solenv/bin/create-ids

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2017-05-20 09:46:27 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=46a30d5eb89a7198f30a895ac92ab5d70d111511

tdf#105204 fix shellcheck warning in setup_native/scripts/unpack_update.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2017-05-20 09:47:01 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c5ba692627791ba8a7f412ee965f89487be06d5

tdf#105204: ShellCheck nitpicks for install-gdb-printers

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2017-05-20 09:51:55 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=aa8fdfd2c2f6ba421e988a3ca85b1a1cbaeb69b8

tdf#105204 fix shellcheck warning in solenv/bin/make-raspbian-root-tarball

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2017-05-20 09:52:30 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7bec7abd4c3d78e6a37f523f4fb599134ef51ca7

tdf#105204: ShellCheck nitpicks for apparmor.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2017-05-21 11:01:22 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=68d7364dfbed50a802e61bf94493510405367b31

tdf#105204 fix shellcheck warning in solenv/bin/bin_library_info.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2017-05-21 11:10:20 UTC
Yeliz Taneroğlu committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2b916da6cdcf3f7abe7e10f83321576ae2695954

tdf#105204 fix shellcheck warning in shell/source/unix/misc/senddoc.sh

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2017-05-30 10:37:16 UTC
Jochen Nitschke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b7988de7c0dcb6aad00864dd07d8be61021ac8d2

tdf#105204 fix iteration over profile

It will be available in 5.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Stephan Bergmann 2017-05-30 15:11:45 UTC
Removing the easyHack keyword.  I think we've come across too many cases now where variables were meant to be used unquoted (for better or worse), and commits for this issue had broken that.  (Last one I came across now is <https://gerrit.libreoffice.org/#/c/37832> "tdf#105204 fix shellcheck warnings in solenv/bin/create-ids".)
Comment 22 Xisco Faulí 2017-11-05 21:50:16 UTC
A polite ping to Jochen Nitschke: is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Thanks
Comment 23 QA Administrators 2019-03-13 03:46:30 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug