Bug 52887 - import log symlink creation does not check existence of parent directory
import log symlink creation does not check existence of parent directory
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v9
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-10 09:18 CET by Daniel Tröder
Modified: 2021-03-24 14:13 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-03-10 09:18:05 CET
An initial UCS@school import on a fresh installation terminates (after a successful run) with:

-----------------------------------------------------------------------------
00:19:46  stderr: 231  Creating symlink from '/var/log/univention/ucs-school-import.log' to '/var/log/univention/ucs-school-import/LAST-LOG-DEBUG'.
00:19:46 Traceback (most recent call last):
00:19:46   File "/usr/share/ucs-school-import/scripts/import_user", line 46, in <module>
00:19:46     sys.exit(main())
00:19:46   File "/usr/share/ucs-school-import/scripts/import_user", line 42, in main
00:19:46     return ui.main()
00:19:46   File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 238, in main
00:19:46     self.prepare_import()
00:19:46   File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 197, in prepare_import
00:19:46     self.setup_logging(self.args.verbose, self.args.logfile)
00:19:46   File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 103, in setup_logging
00:19:46     self.create_symlink(filename, LAST_LOG_DEBUG_SYMLINK)
00:19:46   File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 234, in create_symlink
00:19:46     os.symlink(source, link_name)
00:19:46 OSError: [Errno 2] No such file or directory
-----------------------------------------------------------------------------

The reason is, that the function creating the symlink does not check if the directory to contain the link exists.
Comment 2 Daniel Tröder univentionstaff 2021-03-10 09:40:53 CET
The directory is now created if it does not exist, before creating the symlinks.

[4.4] 5b5c0d37b Bug #52887: create directory for symlinks for log files if missing
[4.4] 81074a707 Bug #52887: advisory

ucs-school-import (17.0.52)
Comment 3 Ole Schwiegert univentionstaff 2021-03-11 09:58:04 CET
Changelog&Advisory: OK
Jenkins: OK
Code Review: OK
Manual Test: OK
Comment 4 Tobias Wenzel univentionstaff 2021-03-24 14:13:57 CET
UCS@school 4.4 v9 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.4v9-de.html

If this error occurs again, please clone this bug.