Bug#620072: /etc/init.d/nfs-kernel-server uses unsupported "/dev/tcp" bashism
Package: nfs-kernel-server
Version: 1:1.2.2-5
I casually tried to set up an NFS server, just to see if I can get it
working. I installed nfs-kernel-server via aptitude, edited /etc/exports,
and finally tried to start the NFS server daemon.
This is the output of the startup command (slightly edited for privacy):
foobar:/etc# /etc/init.d/nfs-kernel-server start
Exporting directories for NFS kernel daemon...exportfs: /etc/exports [1]:
Neither 'subtree_check' or 'no_subtree_check' specified for export
"foobar".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
.
Starting NFS kernel daemon: nfsd
Not starting: portmap daemon is not running (warning).
OK, I then check about portmap:
foobar:/etc# ps aux | grep [p]ortmap
daemon 19692 0.0 0.1 1796 548 ? Ss 19:39 0:00
/sbin/portmap
Seems to be running. I then have a look at /etc/init.d/nfs-kernel-server:
[...]
# See if portmap or rpcbind are running
(cat </dev/null >/dev/tcp/localhost/111) 2>/dev/null
RET=$?
if [ $RET != 0 ]; then
echo
log_warning_msg "Not starting: portmap daemon is not running"
exit 0
fi
[...]
What is this "/dev/tcp/localhost/111"? After some googling I find that
this is a bashism, but the init-script is marked as a bash script at the
top:
!/bin/bash
I then consult "man bash" and find the following line:
NOTE: Bash, as packaged for Debian, does not support using the /dev/tcp
and /dev/udp files.
If my analysis is correct, please modify /etc/init.d/nfs-kernel-server so
that it checks for portmap presence in a portable (or Debian) way.
Thanks
Patrick
Reply to: