Browse files

Seems like removing this fixed the problem where the daemon was unabl…

…e to write new logfiles.
  • Loading branch information...
1 parent e01ba4a commit 8adfe00ad1fed9766d0be18f2d9e6f6f32e2fbce HiddenKnowledge committed Apr 5, 2012
Showing with 0 additions and 1 deletion.
  1. +0 −1 flashpolicyd.rb
@@ -380,7 +380,6 @@ def run_server
fork do
exit if fork
- Dir.chdir('/tmp')
STDOUT.reopen('/dev/null', 'a')
STDERR.reopen('/dev/null', 'a')

11 comments on commit 8adfe00

hmm, need to chdir somewhere, can you try changing that just to / ?

whats the permissions/ownership of your /tmp?


HiddenKn replied Apr 5, 2012

Dir.chdir('/') doesn't make any difference/ doesn't work.

drwxrwxrwt 12 root root 4096 Mar 28 01:29 tmp

Are you doing anything strange like running it as non root user? Or maybe have selinux enabled?


HiddenKn replied Apr 5, 2012

No, but maybe the fork somehow doesn't run as root? I do have sudo.

Can you change line 144 from:

puts("Got #{e.class} #{e} while attempting to create logfile #{logfile}")

to"/tmp/fpcrash", "a") {|f| f.puts "Got #{e.class} #{e} while attempting to create logfile #{logfile}" }

So that the error instead of being lost will go to that file, do the same for lines 457, 459 and 460 but preserving their messages.

It's logging errors to the logfile but when the error its trying to report is related to logfile handling then that wont work, this way maybe we will get something useful in that file in /tmp


HiddenKn replied Apr 5, 2012

hk@irc:/tmp$ cat fpcrash

Unexpected exception Logger::ShiftingError from main loop: Shifting failed. No such file or directory - logfile.txt or logfile.txt.0
Unexpected exception Logger::ShiftingError from main loop: /usr/lib/ruby/1.8/logger.rb:501:in `write'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/logger.rb:496:in `write'
/usr/lib/ruby/1.8/logger.rb:326:in `add'
/usr/lib/ruby/1.8/logger.rb:374:in `info'
flashpolicyd.rb:394:in `run_server'
flashpolicyd.rb:382:in `fork'
flashpolicyd.rb:382:in `run_server'

do you start it with --logfile=logfile.txt or --logfile=/some/full/path/to/logfile.txt ?


HiddenKn replied Apr 5, 2012

sudo ruby flashpolicyd.rb --xml ~/config/socket/flashpolicy.xml --logfile logfile.txt --verbose

Seems like using /some/full/path/to/logfile.txt works, indeed.. (Though, it doesn't make a logfile.txt.0)

it'll make it after logfile.txt is a meg big, assuming you didnt keep your '0' change in there from earlier, you pretty much always should use full paths when daemons are concerned and not be lazy about it this is universally true


HiddenKn replied Apr 5, 2012

Well, thanks for solving this problem with me, then :D

I pushed a new version that will work even with relative paths to logfile - also fixed some potential issue if you made it drop privs to non root which you dont seem to do, would be great if you could test the logfile change for me if you just ran with --logfile logfile.txt

Please sign in to comment.