-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Unexpectedly creates a file named ./profanity
#1518
Comments
Can confirm that, with up-to-date master version. |
See #1518 It has a good explanation of what happened: ``` Apparently, the _rotate_log_file function tried to extract user-provided name from currently used mainlogfile and restart logging to the same place after rotation, but currently this is interpreted as a full path instead. As I understand, the log rotation is no longer done with user-provided paths at all so this should be simply skipped altogether now as passing any non-NULL value is interpreted as user-provided. Replacing start with NULL appears to fix it for me. ``` In log_msg() we only rotate the log if not user_provided_log. #1455 changed the behaviour from user defined filename in the log dir to using full path.
Yes, it fixes it and I can no longer reproduce it on master. But I think it introduces another subtle bug that the file will be rotated at most once because |
You mean in |
Yes, and as Lines 152 to 163 in 482f895
Unless I'm missing something, when _rotate_log_file is reached, the actual path returned by files_get_log_file(NULL) should be the same as current mainlogfile . The only difference is that non-NULL log_file also sets user_provided_log to TRUE disabling further rotations.
|
Ah yes, so it should actually pass NULL. Do you want to make a PR? |
No, please handle it in whatever way you like. |
Current Behavior
After running for a while (apparently when the log file reaches the maxsize limit), profanity changes the log file location to
profanity
in the current working directory.Expected Behavior
It shouldn't do that.
Steps to Reproduce
./profanity
doesn't exist and.
is writable.profanity -l DEBUG
(but without-f
) to make it write a lot of log./log maxsize 64
../profanity
being created.Possible Solution
Pass NULL as a second argument of
log_init
in_rotate_log_file
:profanity/src/log.c
Lines 249 to 260 in 1ec6065
Apparently, the
_rotate_log_file
function tried to extract user-provided name from currently usedmainlogfile
and restart logging to the same place after rotation, but currently this is interpreted as a full path instead. As I understand, the log rotation is no longer done with user-provided paths at all so this should be simply skipped altogether now as passing any non-NULL value is interpreted as user-provided. Replacingstart
with NULL appears to fix it for me.The text was updated successfully, but these errors were encountered: