-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Description
If you create a file with user permissions but then run logger under root the file rotate will not preserve these permissions causing access issues.
% ls -al log.log
-rw-r--r-- 1 reginaldsmith staff 0 23 Sep 11:17 log.log
% rvmsudo irb
2.7.2 :001 > require "logger"
=> true
2.7.2 :004 > puts File.stat("log.log").uid
502
=> nil
2.7.2 :005 > log = File.open("log.log", "a")
=> #<File:log.log>
2.7.2 :006 > logger = Logger.new(log, "everytime")
=> #<Logger:0x00007fd7cfbc5ee0 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fd7cfbc5eb8 @datetime_format=nil>, @formatte...
2.7.2 :007 > logger.info "hello"
=> true
2.7.2 :008 > puts File.stat("log.log").uid
0
2.7.2 :010 > exit
% ls -al log.log
-rw-r--r-- 1 root staff 123 23 Sep 11:20 log.log
% irb
2.7.2 :001 > require "logger"
=> true
2.7.2 :002 > log = File.open("log.log", "a")
Errno::EACCES (Permission denied @ rb_sysopen - log.log)
>
Metadata
Metadata
Assignees
Labels
No labels