Bug 1153457

Summary: When starting jabberd service, dirname prints out error messages
Product: Red Hat Satellite 5 Reporter: Ken Sugawara <ksugawar>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED DUPLICATE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 560CC: cperry, ddevra, fabiano.martins
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-06 10:26:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
log from jabberd service starting with "set -x" inserted none

Description Ken Sugawara 2014-10-16 04:13:55 UTC
Created attachment 947404 [details]
log from jabberd service starting with "set -x" inserted

Description of problem:
When starting jabberd service, you get the following error messages:
Initializing jabberd processes ...
Starting router: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting sm: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting c2s: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting s2s: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]



Version-Release number of selected component (if applicable):
jabberd-2.2.8-22.el6sat.x86_64


How reproducible:
Always.

Steps to Reproduce:
1. Stop and restart jabberd service: rhn-setellite restart (*)
2. 
3.

* I guess I could just stop and start, or restart jabberd service alone, but I'm not sure if restarting it alone might disrupt other services. Better safer than sorry.

Actual results:
Initializing jabberd processes ...
Starting router: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting sm: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting c2s: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]
Starting s2s: /usr/bin/dirname: extra operand `2>&1'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]


Expected results:
Initializing jabberd processes ...
Starting router:                                           [  OK  ]
Starting sm:                                               [  OK  ]
Starting c2s:                                              [  OK  ]
Starting s2s:                                              [  OK  ]


Additional info:
I took a look at /etc/rc.d/init.d/jabberd and /etc/rc.d/init.d/function. I conclude that the above errors are generated within __pids_var_run() function (defined in function).

Because jabberd script calls the daemon() with a shell command line "${progsPath}/${prog} ${args} >/dev/null 2>&1 &" instead of a path to the program file, daemon() incorrectly extracts the string "null 2>&1 &" as the basename of the program path.

Then daemon() passes the string to __pids_var_run() where it tries to get the directory part of the supposedly path string with the following command:

dirname null 2>&1 &.pid
        ~~~~~~~~~~~~~~~

Because the underlined part is passed as a single string(?), it does not seem to be evaluated by the shell and passed through to dirname which in turn throws the error.

I attached a log that I created by inserting "set -x" at the beginning of /etc/init.d/jabberd so you can see the above sequence of execution.

I'm not entirely sure which to blame; the daemon() in function or jabberd init script's invocation of daemon(), but since daemon()'s usage says "Usage: daemon [+/-nicelevel] {program}", I'm inclined to blame this behavior on jabberd init script.

Note: these errors do not appear to inhibit jabberd services from properly functioning (jabberd services do not use /var/run/*.pid files), so I say this is very low impact and just cosmetic only (hence "low" severity).

Comment 1 Fabiano Martins 2014-10-31 17:44:18 UTC
The cause of this problem is a bug 1153677, please mark them as duplicates.

Comment 2 Clifford Perry 2014-11-06 10:26:21 UTC

*** This bug has been marked as a duplicate of bug 1153677 ***