Bug 50497 - Regression: Creating directory reports and univention-directory-reports-cleanup script does not work since UCS 4.4e346
Regression: Creating directory reports and univention-directory-reports-clean...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 4.4
All Linux
: P5 normal (vote)
: UCS 4.4-2-errata
Assigned To: Florian Best
Felix Botner
:
: 50534 (view as bug list)
Depends on: 49160
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-14 12:37 CET by Erik Damrose
Modified: 2019-11-27 14:20 CET (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.206
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2019-11-14 12:37:26 CET
https://help.univention.com/t/13590

In our forum we got a report that univention-directory-reports-cleanup does not work with UCS 4.4e346 and later. There is a cronjob which runs the cleanup script, which also generates errormails.

# /usr/sbin/univention-directory-reports-cleanup
Traceback (most recent call last):
  File "/usr/sbin/univention-directory-reports-cleanup", line 46, in <module>
    for f in os.listdir(dirname):
OSError: [Errno 2] No such file or directory: '/usr/share/univention-management-console-module-udm'

With version univention-management-console-module-udm the directory /usr/share/univention-management-console-module-udm is not created anymore/removed upon package installation.


+++ This bug was initially created as a clone of Bug #49160 +++
Comment 1 Florian Best univentionstaff 2019-11-14 13:09:21 CET
It gets regulary created:

   dh_installdirs                                                                                                                                                                                     
        install -d debian/univention-management-console-module-udm/usr/share/univention-management-console-module-udm

And then:

override_dh_python2:
        ls debian/univention-management-console-module-udm/usr/share/
        dh_python2
        ls debian/univention-management-console-module-udm/usr/share/

After dh_python2 is executed, the folder is removed...
Comment 2 Erik Damrose univentionstaff 2019-11-14 13:14:26 CET
Trying to generate a report in UMC also fails, traceback:

Interner Server-Fehler in "udm/reports/create (users/user)".
Request: udm/reports/create (users/user)

  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 78, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 97, in _decorated
  File "/usr/lib/python2.7/dist-packages/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 668, in _thread
  File "/usr/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/usr/lib/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 21] Ist ein Verzeichnis: '/usr/share/univention-management-console-module-udm/'
Comment 3 Florian Best univentionstaff 2019-11-14 13:30:46 CET
Fixed by re-installing the directory after the dh_python debhelpers ran.

univention-management-console-module-udm.yaml
6f7d74536d9f | YAML Bug #50497

univention-management-console-module-udm (9.0.15-4)
88fdd65129c3 | Bug #50497: fix installation of directory usr/share/univention-management-console-module-udm/
Comment 4 Philipp Hahn univentionstaff 2019-11-14 14:27:53 CET
<man:dh_python2>
> private dirs
>        /usr/share/foo, … private  directories  are  scanned  for  Python files by default (where foo is binary package name). …>        --skip-private
>               don't check private directories

dh_python[23] walks debian/$binpkg/usr/share/$binpkg/ and removed every empty directory through /usr/share/dh-python/dhpython/fs.py # Scan.__init__
>            if not dirs:
>                try:
>                    os.removedirs(root)
>                except OSError:
>                    pass


$ cat >>debian/rules <<__EOF__
override_dh_python2:
        dh_python2 --skip-private
override_dh_python3:
        dh_python3 --skip-private
___EOF__
$ dpkg -c ../univention-management-console-module-udm_9.0.15-3_all.deb | grep /usr/share/univention-management-console-module-udm
drwxr-xr-x root/root         0 2019-10-23 15:28 ./usr/share/univention-management-console-module-udm/
Comment 5 Florian Best univentionstaff 2019-11-14 14:28:53 CET
I don't really understand why this happens and why it doesn't happen in other packages.
Comment 6 Florian Best univentionstaff 2019-11-14 14:41:20 CET
Thanks Philipp, using --skip-private now.

univention-management-console-module-udm (9.0.15-5)
149108c96a42 | Bug #50497: use --skip-private
Comment 7 Philipp Hahn univentionstaff 2019-11-14 17:13:19 CET
(In reply to Florian Best from comment #5)
> I don't really understand why this happens and why it doesn't happen in
> other packages.

Because the other packages probably have files and/or sub-directories with non-Python-files under that path and so don't become empty after the dh_python[23] run.
Comment 8 Felix Botner univentionstaff 2019-11-21 18:08:47 CET
OK - reports
OK - cron job
OK - yaml

added test case 01_base/71_directory_reports
Comment 9 Florian Best univentionstaff 2019-11-22 10:23:38 CET
*** Bug 50534 has been marked as a duplicate of this bug. ***
Comment 10 Arvid Requate univentionstaff 2019-11-27 14:20:09 CET
<http://errata.software-univention.de/ucs/4.4/378.html>