Bug 62606 - /etc/init.d/autofs reload is not coreutils compatible?
Bug#: 62606 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: bug-wranglers@gentoo.org Reported By: glen@delfi.ee
Component: Applications
URL: 
Summary: /etc/init.d/autofs reload is not coreutils compatible?
Keywords:  
Status Whiteboard: 
Opened: 2004-09-02 04:50 0000
Description:   Opened: 2004-09-02 04:50 0000
i run /etc/init.d/autofs reload, and it outputs:


# /etc/init.d/autofs reload
Reloading automounter: checking for changes ...
tail: cannot open `+2' for reading: No such file or directory
Stopping automounter: ==> /var/run/autofs.net.pid <==
6053
/net ?
  D      0:00 /usr/sbin/automount --timeout 1800 /net program /etc/autofs/net.sh
 * WARNING:  "autofs" has already been started.


the problematic line seems to be:
 command=`tail +2 $i`

the same code using 'set -x' in bash:

# /etc/init.d/autofs reload
Reloading automounter: checking for changes ...
++ head -n 1 /var/run/autofs.net.pid

  B pid=6053
+ '[' 6053 = '' ']'
++ tail +2 /var/run/autofs.net.pid

  tail: cannot open `+2' for reading: No such file or directory
+ command===> /var/run%2Fautofs.net.pid <==
6053
/net ?        D      0:00 /usr/sbin/automount --timeout 1800 %
  2Fnet program /etc/autofs/net.sh
+ grep -q '^==> /var/run/autofs.net.pid <==
6053
/net ?        D      0:00 /usr/sbin/automount --timeout
  1800 /net program /etc/autofs/net.sh' /var/run/autofs.tmp
+ echo 'Stopping automounter:
  ==> /var/run/autofs.net.pid <==
6053
/net ?        D      0:00 /usr/sbin/au
  tomount --timeout 1800 /net program /etc/autofs/net.sh'
Stopping automounter: ==> /var/run/autofs.net.pid <==
6053
/net ?        D      0:00 /usr/sbin/automount --timeout 18
  00 /net program /etc/autofs/net.sh^M
+ kill -USR2 6053
+ rm -f /var/run/autofs.tmp
%
  2B svc_start
+ local retval=0
+ local startfail=no
+ local x=
+ local y=
%
  0D
and the tail command itself:
# tail +2 /var/run/autofs.net.pid
tail:
   cannot open `+2' for reading: No such file or directory
==> /var/run/autofs.net.pid <%3
  D=^M
6053^M
/net ?        D      0:00 /usr/sbin/automount --timeout 1800 /net program /etc/autofs/net.sh


using -n switch:
# tail -n +2 /var/run/autofs.net.pid
/n
  et ?        D      0:00 /usr/sbin/automount --timeout 1800 /net program /etc/autofs/net.sh
%
  0D
and program versions:
# epm -q coreutils autofs
coreutils-5.2
autofs-3.1.7-r5


PS: i'm sorry, the text above is not like the original one used to be, but i posted the original bug, and mozilla responded me that i forgot to choose component, and when i hit back in browser, all the forms were blank. so the text above is extracted with ngrep(1) and perl patterns to decode back from urlencooded data :/

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

------- Comment #1 From Sven Wegener 2004-09-02 10:57:26 0000 -------
I changed the tail +2 to tail -n +2 to be comptatible with latest coreutils.
Fixed in CVS. Thanks for reporting.