Bug 53902 - fix multiple small errors in univention.lib.fstab
fix multiple small errors in univention.lib.fstab
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: univention-lib
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Esteban
Florian Best
:
Depends on:
Blocks: 53343
  Show dependency treegraph
 
Reported: 2021-10-13 10:45 CEST by Florian Best
Modified: 2021-11-03 17:01 CET (History)
0 users

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
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 Florian Best univentionstaff 2021-10-13 10:45:22 CEST
1. Parsing a fstab without options is valid but out implementation raises an InvalidError (/ returns the raw string instead if an entry).

>>> univention.lib.fstab.File()._File__parse('192.168.0.81:/home\t/home\tnfs\t\n')
'192.168.0.81:/home\t/home\tnfs\t'
>>> univention.lib.fstab.File()._File__parse('192.168.0.81:/home\t/home\tnfs\n')
'192.168.0.81:/home\t/home\tnfs'

2. an invalid comment / entry is parsed as valid while `mount` ignores it:

`mount: fstab: parse error at line 1 -- ignored`

>>> univention.lib.fstab.File()._File__parse('192.168.0.81:/home\t/home\tnfs\tro#foo\n')                                                                                                                                                      
univention.lib.fstab.Entry('192.168.0.81:/home', '/home', 'nfs', options='ro', freq=None, passno=None, comment='#foo')
>>> univention.lib.fstab.File()._File__parse('192.168.0.81:/home\t/home\tnfs\tro\t#foo\n')
univention.lib.fstab.Entry('192.168.0.81:/home', '/home', 'nfs', options='ro', freq=None, passno=None, comment='#foo')

3. a wrong str() representation is build if `passno=1` but `dump=None` or `dump=0`:

>>> str(univention.lib.fstab.Entry('192.168.0.81:/home', '/home', 'nfs', ['ro'], dump=None, passno=1, comment=None))
'192.168.0.81:/home\t/home\tnfs\tro\t1'
>>> str(univention.lib.fstab.Entry('192.168.0.81:/home', '/home', 'nfs', ['ro'], dump=0, passno=1, comment=None))
'192.168.0.81:/home\t/home\tnfs\tro\t1'
Comment 1 Esteban univentionstaff 2021-10-21 06:43:50 CEST
· Parsing a fstab line without options now generates a valid Entry with `defaults` options.

· Fixed str representation of fstab Entry. Default values are completed when needed.

· Added some tests for several detected edge cases.


univention-lib.yaml
0cd113dfaa2f | Bug #53902: Fixed dump passno str() output for Entry

univention-lib (9.0.11-8)
f98c525c31f3 | Bug #53902: Modified unitests for lib.fstab
0cd113dfaa2f | Bug #53902: Fixed dump passno str() output for Entry
Comment 2 Florian Best univentionstaff 2021-10-22 14:56:25 CEST
OK: all issues addressed
OK: changes for the unit tests
OK: YAML