Commit 5501c233 authored by Michael Hanke's avatar Michael Hanke

Make mexhelper more robust against whitespace-only username

i.e. no username but whitespace between the quotes. It used to fail
till now, if the username read from debconf was only whitespace.
Not sure how that could happen in the first place, though.
parent 489b5e72
......@@ -4,7 +4,7 @@ set -e
set -u
# init
scriptname=$(basename $0)
......@@ -269,7 +269,11 @@ cd $src_dir
echo "Building Matlab extensions (logfile at $logfile)"
# if we need to use a dedicated user
if [ -n "$MATLAB_MEXBUILD_USER" ]; then
# (strip whitespace from the user name -- necessary to avoid failure
# if the user name is basically empty but not length zero -- seems to happen
# when retrieving the value from debconf under some weired non-reproducible
# conditions)
if [ -n "$(echo ${MATLAB_MEXBUILD_USER} | tr -d ' ')" ]; then
chown -R $MATLAB_MEXBUILD_USER $src_dir
echo "sudo -H -u $MATLAB_MEXBUILD_USER sh -c \"$build_cmd\"" >> $logfile
sudo -H -u $MATLAB_MEXBUILD_USER sh -c "$build_cmd" 2>&1 >> $logfile
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment