[MCOL-4094] Syntax error in columnstore-post-install in 1.5.2: -bash: [: too many arguments Created: 2020-06-23  Updated: 2022-06-02  Resolved: 2022-03-03

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.5.2
Fix Version/s: 6.3.1

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Geoff Montee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MCOL-5060 Clean up legacy OAM remnants Closed
Relates
relates to MCOL-3854 CLONE - Run columnstore-post-install ... Closed
Sprint: 2021-17

 Description   

columnstore-post-install has a syntax error in 1.5.2. The problem is with the following line:

https://github.com/mariadb-corporation/mariadb-columnstore-engine/blob/columnstore-1.5.2-1/oam/install_scripts/columnstore-post-install.in#L18

It results in errors like this:

/usr/bin/columnstore-post-install: line 18: [: too many arguments
strings: /proc/1502/environ: Permission denied
strings: '/proc/0/environ': No such file
error: process ID out of range

The problem appears to happen because $pid is not surrounded in quotes.

It is easy enough to reproduce with the following bash snippet:

$ while [ -z "$ENV_VAR" -a $pid != 1 ]; do
> ENV_VAR=test
> pid=2
> done
-bash: [: too many arguments

It is fixed by quoting $pid. For example:

$ while [ -z "$ENV_VAR" -a "$pid" != 1 ]; do
> ENV_VAR=test
> pid=2
> done

This is with the following bash version and OS:

$ bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic



 Comments   
Comment by Roman [ 2022-02-03 ]

Plz review.

Comment by Roman [ 2022-03-03 ]

GeoffMontee plz re-open if you test it and find it wasn't fixed.

Generated at Thu Feb 08 02:47:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.