[Pkg-sysvinit-devel] Bug#331397: initscripts: mountall.sh reports
failure if procfs included in fstab
Frans Pop
aragorn at tiscali.nl
Fri Dec 23 19:36:49 UTC 2005
Thomas Hood wrote:
> The script now treats an exit status of either 0, 64 or 96 as
> non-failure.
> This still isn't ideal.
Indeed it is not nice to treat non-zero exit codes as "successes" without
further investigation, even if the messages themselves are now printed.
Maybe the correct way to deal with this is to parse the output of the
mount command (as is already done to some extend) and only accept 32, 64
and 96 if $MOUNT_MESSAGES is empty after grepping out the "harmless"
messages.
I'd suggest something like the code below (based on current unstable).
I'm not sure why only the first line of output is currently printed in
verbose mode, so I've ignored that.
I've also grepped out successful mounts as I fail to see why you'd want to
print those when verbose mode is _not_ set (and as warnings too) nor when
verbose mode _is_ set (even if only a first line). This way only problems
will be reported.
If you do want to report successful mounts in verbose mode, the code
becomes a bit more complicated.
Note also that the current loop to print messages when verbose mode is not
set is broken as it fails to set IFS to only "\n". This is fixed below.
MOUNT_MESSAGES="$(mount -av -t \
nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noocfs2,nogfs 2>&1)"
ES=$?
# Ignore successful mounts and harmless warnings
MOUNT_MESSAGES_RELEVANT=$(echo "$MOUNT_MESSAGES" | \
egrep -v ' on .* type ' | \
egrep -v '(already|nothing was) mounted')
if [ "$VERBOSE" != no ]; then
case $ES in
0|32|64|96)
if [ -z "$MOUNT_MESSAGES_RELEVANT" ] ; then
log_action_end_msg 0
else
log_action_end_msg 1
fi
;;
*)
log_action_end_msg 1
;;
esac
fi
# Print any relevant messages as warnings
OLDIFS=$IFS
IFS="
" # Warning: do not indent this!
for MOUNT_MESSAGE_TO_PRINT in $(echo "$MOUNT_MESSAGES_RELEVANT") ; do
log_warning_msg $MOUNT_MESSAGE_TO_PRINT
done
IFS=$OLDIFS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20051223/095ba52d/attachment.pgp
More information about the Pkg-sysvinit-devel
mailing list