Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress debug messages on ZM service start/restart #1847

Merged
merged 1 commit into from Apr 7, 2017
Merged

Suppress debug messages on ZM service start/restart #1847

merged 1 commit into from Apr 7, 2017

Conversation

ekwoodrich
Copy link
Contributor

The tests that determine the format for superuser calls on the target environment leak debug messages to STDOUT. Starting the Zoneminder process will display an intimidating series of error messages that can safely be ignored by the user:

e.g.

root@2bfdd23cc27a:~# service zoneminder start

Starting ZoneMinder: Can't exec "sudo": No such file or directory at /usr/share/perl5/ZoneMinder/General.pm line 1                                                   10.
Use of uninitialized value $output in scalar chomp at /usr/share/perl5/ZoneMinder/General.pm line 119.
Use of uninitialized value $output in concatenation (.) or string at /usr/share/perl5/ZoneMinder/General.pm line 1                                                   20.
success

This patch redirects STDERR from the qx(...) calls to the debug message., And if the output of qx(...) is undefined, replaces it with any error in $! resulting from the qx(...) call.

The tests in the script General.pm that determine the format for superuser calls on the target environment may leak debug messages to STDOUT. This can be replicated on a Docker installation of Zoneminder lacking sudo. Starting the Zoneminder process  will display an intimidating series of error messages that can safely be ignored by the user:

e.g.
'''
root@2bfdd23cc27a:~# service zoneminder start

Starting ZoneMinder: Can't exec "sudo": No such file or directory at /usr/share/perl5/ZoneMinder/General.pm line 1                                                   10.
Use of uninitialized value $output in scalar chomp at /usr/share/perl5/ZoneMinder/General.pm line 119.
Use of uninitialized value $output in concatenation (.) or string at /usr/share/perl5/ZoneMinder/General.pm line 1                                                   20.
success
'''

This patch redirects STDERR from the qx(...) calls to the debug message., And if the output of qx(...) is undefined, replaces it with any error in $! resulting from the qx(...) call.
@connortechnology
Copy link
Member

In theory I like this. I would like to be able to reproduce it first though, so I can be confident that I I understand all the issues.

Can you tell me more about your setup? Obviously it lacks sudo for starters...

@ekwoodrich
Copy link
Contributor Author

I'm using the quantumobject/docker-zoneminder Docker image on a Ubuntu 16.04.02 host, Docker version 17.03.1.

The Docker base images for Ubuntu-minimal don't include sudo, which doesn't usually break much because a Docker container uses root in a sandbox. I've also replicated this on 15.10 and 16.04 docker images (this thread describes how sudo was removed in more recent Docker Ubuntu images).

If you have Docker installed, you can replicate by pulling a Zoneminder docker image:
sudo docker run -d --shm-size=4096m -p 80 quantumobject/docker-zoneminder:latest
Enter the container:
docker exec -it [container_id] /bin/bash,
And inside the container run
service zoneminder restart.

The sudo error messages will be displayed, however the ZM install works perfectly otherwise. The errors reappear each time Zoneminder is restarted from the terminal within the container.

For users who use a Docker packaged Zoneminder image, these messages are confusing and presumably any environment lacking sudo would have the same issue.

@connortechnology connortechnology merged commit a0b0f0a into ZoneMinder:master Apr 7, 2017
@ekwoodrich ekwoodrich deleted the patch-1 branch April 8, 2017 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants