Skip to content

bugfix init.d/netmount: typo in nfsclient dependency check #956

@kaliumhydroxid

Description

@kaliumhydroxid

for opts in $(fstabinfo -o -t nfs,nfs4); do
case $opts in
noauto) ;;
*) mywant="$mywant nfsclient"; break ;;
esac
done

If I understand correctly, this portion of code is supposed to check, amongst the nfs mounts, whether at least one doesn't have the noauto option, and if so, to add nfsclient as a dependency.

Each looped-over variable $opts is the output of fstabinfo -o -t nfs,nfs4 which is one line (per NFS mount) with all the options, comma separated. It seems to me there is an issue in the case check: noauto) will only match if one of the $opts (a comma-separated line) is equal to noauto, but that option may be used amongst others, in which occurrence the case noauto) will not match.

The fix is to change the case to *noauto*), which will match if the option noauto is present in the line at all.


Example of fstabinfo output.

$ /usr/libexec/rc/bin/fstabinfo -o -t nfs
noauto,soft,uid=1000,gid=1000

Example of the behavior.

$ case $(/usr/libexec/rc/bin/fstabinfo -o -t nfs) in noauto) echo 'noauto';; *noauto*) echo '*noauto*';; *) echo '*';; esac
*noauto*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions