Bug 6868 - Logs are saved in the wrong place on the Mac.
: Logs are saved in the wrong place on the Mac.
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 7.0
: Macintosh MacOS X 10.4
: P2 normal (vote)
: ---
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-30 12:52 UTC by Blackketter Dean
Modified: 2008-12-18 11:12 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
fix system wide logging (1.06 KB, patch)
2008-01-31 02:03 UTC, Michael Herger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blackketter Dean 2008-01-30 12:52:16 UTC
The logs should be saved in the user's ~/Library, not /Library

From the forums:

On Jan 30, 2008, at 12:36 PM, El Callado wrote:
I don't yet have a Squeezebox -- I'm planning to buy the Duet when it
comes out -- but I've installed SC7 (revision 16955) on a Mac and
played around with it a little.

The first thing I noticed was a problem with the script
Slim/Utilities/OSDetect.pm. Lines 184-186 are as follows:

Code:
--------------------
    if (-d "/Library/Application Support/SqueezeCenter") {

  	mkpath("/Library/Logs/SqueezeCenter");
--------------------

This causes a permission error if the user who first runs the server is
not a member of the admin group. Even if the directory exists and is
world-writable (which it shouldn't be), trying to write to log files
created by another user won't work. With multiple users able to run SC,
each one should have his own logs. So I commented this out. The same
goes for lines 194-196, which assume there is a root-level log
directory if there is a root-level Application Support directory.

Another change that should be made to this file is to add the MacPorts
directory '/opt/local/bin' to the binary search path on line 128.


-- 
El Callado
------------------------------------------------------------------------
El Callado's Profile: http://forums.slimdevices.com/member.php?userid=15274
View this thread: http://forums.slimdevices.com/showthread.php?t=42891

_______________________________________________
beta mailing list
beta@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/beta
Comment 1 Michael Herger 2008-01-31 02:03:56 UTC
Created attachment 2781 [details]
fix system wide logging

Dean - the idea clearly was to have the log file in the system wide Log folder if SC is installed system wide. This patch checks whether /Library/Log is writable before trying to create the sub folder. Otherwise it will fall back to the user's log folder.

Is this ok with you?
Comment 2 Blackketter Dean 2008-01-31 07:48:44 UTC
If SC was running as root, it would make sense to write to /Library but since the individual user is starting it (though anybody may run it), it should be saved where the user has permissions, namely ~/Library for all its stuff (logs, preferences, cache, etc.)

Check out http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/Domains.html#//apple_ref/doc/uid/20002281
Comment 3 Michael Herger 2008-01-31 08:00:04 UTC
That's exactly what my patch should. Shall I check it in?
Comment 4 Blackketter Dean 2008-01-31 09:14:50 UTC
Hm, my thinking was that we wouldn't do anything in /Library on the mac at all, since we're not running as root.
Comment 5 El Callado 2008-01-31 11:18:06 UTC
(In reply to comment #4)
> Hm, my thinking was that we wouldn't do anything in /Library on the mac at all,
> since we're not running as root.

I'm the poster of the forum message. I agree that SC shouldn't try to write anything
at all outside the user's home directory. /Library/Logs is writable only by root.
/Library/Caches is writable only by the admin group. You could use the installer
to create directories here, but then files created by one user wouldn't be writable
by another. Writing to a single cache and log would be fine if SC always ran
in a dedicated account, like a mail server, and different users could log in to it.
But that's not how it works.
Comment 6 Michael Herger 2008-02-01 01:24:15 UTC
change 17074 - don't touch the system wide log folder at all.
Comment 7 Chris Owens 2008-03-07 09:04:38 UTC
This bug is being closed since it was resolved for a version which is now released!  Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html

If you are still seeing this bug, please re-open it and we will consider it for a future release.