Opened 12 years ago
Closed 12 years ago
#10347 closed Bug Report - General (Fixed)
Updating to v0.25pre-4551-g769dfae prevents mythbackend shutdown
Reported by: | Owned by: | beirdo | |
---|---|---|---|
Priority: | minor | Milestone: | 0.25 |
Component: | MythTV - MythSystem | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
On changeset 4550, shutdown happens as expected. After updating to 4551 when my local shutdown script runs, mythbackend reports a 1 is returned, however, when running the script manually, a 0 is returned.
preSDWUCheckCommand /usr/local/sbin/LocalPreShutdownTests.sh SystemManager system-unix.cpp:326 (run) Managed child has exited! \ command=/usr/local/sbin/LocalPreShutdownTests.sh, status=256, result=1 $ LocalPreShutdownTests.sh ; echo "LocalPreShutdownTests.sh Returns: $?" LocalPreShutdownTests.sh Returns: 0
Attachments (3)
Change History (10)
Changed 12 years ago by
Attachment: | mythbackend.20120216193628.4911.log added |
---|
Changed 12 years ago by
Attachment: | version.txt added |
---|
Changed 12 years ago by
Attachment: | LocalPreShutdownTests.sh added |
---|
comment:1 follow-up: 2 Changed 12 years ago by
I see no reason that the changes would affect that script. Please find out which term on that final if is false so we can trace it back to the actual issue.
comment:2 Changed 12 years ago by
Replying to beirdo:
Please find out which term on that final if is false...
It is NC=2 (not 1), or result of netstat|grep 2>&1
I changed the script to simply "grep foo /etc/hosts". Then ran it with and without "2>&1" appended.
For these tests, there is no foo in /etc/hosts and result=value is from system-unix.cpp:326 in the log.
4450-774ceca
grep foo /etc/hosts 2>&1 result=1 grep foo /etc/hosts result=1
4451-769dfae
grep foo /etc/hosts 2>&1 result=2 <------ grep foo /etc/hosts result=1
comment:3 Changed 12 years ago by
On the original line you had 2>&1 > /dev/null. Thus, no matter what I do with stderr or stdout in our code, you aren't supposed to be writing to either. I don't see an issue here.
However, let me try something to see if it helps with what I can only describe as a very oddly broken set of circumstances.
You may also want to try changing the line to:
(grep foo /etc/hosts) 2>&1 > /dev/null
or:
((grep foo /etc/hosts) 2>&1) > /dev/null
Meanwhile, I'll go see if I can unbork this.
comment:4 Changed 12 years ago by
More elegantly redirect stdout/stderr rather than just closing
Refs #10347
This should fix this bug, although it could be bypassed by fiddling the script itself. This should be more foolproof.
Branch: master Changeset: 8f9a9b11be2ba004c9a1df8dfc7546179ce0e699
comment:5 follow-up: 6 Changed 12 years ago by
OK, please let me know if this change fixes the problem.
comment:6 Changed 12 years ago by
Replying to beirdo:
OK, please let me know if this change fixes the problem.
Short answer, yes its fixed. Thank you.
I'm now running on 4574-a25b8de.
Now both the grep with and without redirection return 1. I didn't try your comment:3 tests on 4551, but did test them on 4574 and they too return 1.
Finally, the original script was restored and the machine just shutdown.
So, a better title would have been: "Updating to 769dfae can cause errors in scripts with redirection"
comment:7 Changed 12 years ago by
Milestone: | unknown → 0.25 |
---|---|
Resolution: | → Fixed |
Status: | new → closed |
Reported as fixed.
Yes, I was following along on http://irc.mythtv.org/ircLog/channel/1/2012-02-17 ;)