simplesamlphp icon indicating copy to clipboard operation
simplesamlphp copied to clipboard

2.0.0-rc1 when logging.handler is set to syslog or errorlog, it tries to create /dev/null

Open yaleman opened this issue 3 years ago • 3 comments

Describe the bug

When logging.handler is set to syslog or errorlog, it tries to create /dev/null

To Reproduce

  1. Install SSP
  2. Set logging.handler in config.php to syslog or errorlog
  3. Try to use SSP

Expected behavior It not to throw an error about trying to create /dev/null

Screenshots or logs

SimpleSAML\Error\Error: UNHANDLEDEXCEPTION  
Backtrace:
1 www/_include.php:28 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: RuntimeException: Unable to create the "logs" directory (/dev/null).
Backtrace:
5 vendor/symfony/http-kernel/Kernel.php:626 (Symfony\Component\HttpKernel\Kernel::buildContainer)
4 vendor/symfony/http-kernel/Kernel.php:537 (Symfony\Component\HttpKernel\Kernel::initializeContainer)
3 vendor/symfony/http-kernel/Kernel.php:767 (Symfony\Component\HttpKernel\Kernel::preBoot)
2 vendor/symfony/http-kernel/Kernel.php:190 (Symfony\Component\HttpKernel\Kernel::handle)
1 src/SimpleSAML/Module.php:234 (SimpleSAML\Module::process)
0 www/module.php:14 (N/A)

Additional context

yaleman avatar Aug 14 '22 04:08 yaleman

This is a side-effect of https://github.com/simplesamlphp/simplesamlphp/commit/d7c6d21186ee5ea511cc5ed9a55faaabd15f3fb8

tvdijen avatar Aug 14 '22 07:08 tvdijen

OK, so Symfony requires a writable log-directory to be configured, even if you want to use syslog/errlog/stderr.. My earlier change tried to trick Symfony, but apparently I didn't think it through very well.

The way I have fixed it now is:

  • If you set logdir to null it will try and use the system's tmp-directory that should be readable in most cases
  • You can still set it to any other directory as long as it's writable.

So if your handler is other than file it's probably best/easiest to set logdir to null and it should work out of the box in most setups.

tvdijen avatar Aug 14 '22 08:08 tvdijen

Would you mind testing 441399022cc134c40c828a3a227ac5d2a33c2d4e ? It should fix both your issues

tvdijen avatar Aug 14 '22 08:08 tvdijen

I'll try that soon, thanks.

yaleman avatar Aug 16 '22 04:08 yaleman

Screen Shot 2022-08-16 at 23 43 42

Looks like a new bug on this one?

yaleman avatar Aug 16 '22 13:08 yaleman

Yeah, we've merged Symfony6-support, but apparently that breaks stuff.. Sorry for all this.. Will get back to you ASAP

tvdijen avatar Aug 16 '22 15:08 tvdijen

OK; one more time! 9529414d76ca49b0c9eae049f9f6f541ad76d4b0

tvdijen avatar Aug 16 '22 22:08 tvdijen

This looks to have fixed it, thanks!

yaleman avatar Aug 17 '22 07:08 yaleman

\n This issue has been automatically locked since there has \n not been any recent activity after it was closed.\n Please open a new issue for related bugs.

github-actions[bot] avatar Mar 17 '23 00:03 github-actions[bot]