openpreserve / odf-validator

Open source Open Document Format (ODF) validation
http://odf.openpreservation.org/
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

The test package tool ignores empty directory trees. #24

Closed carlwilson closed 1 year ago

carlwilson commented 1 year ago

When creating a test package using the testing tool empty source directories are ignored. These should be transferred to the test file as well. Here's an example, first up is the source:

❯ ls -alh ../empty/
total 76K
drwxr-xr-x  9 cfw cfw 4.0K Jun 23 01:56  .
drwxr-xr-x 12 cfw cfw 4.0K Jun 22 13:01  ..
drwxr-xr-x 11 cfw cfw 4.0K Jun 21 18:40  Configurations2
-rw-r--r--  1 cfw cfw 7.7K Jun 21 18:40  content.xml
-rw-r--r--  1 cfw cfw  260 Jun 21 18:40  manifest.rdf
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40  META-INF
-rw-r--r--  1 cfw cfw  925 Jun 21 18:40  meta.xml
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40 'Object 1'
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40 'Object 2'
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40  ObjectReplacements
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40  Pictures
-rw-r--r--  1 cfw cfw  12K Jun 21 18:40  settings.xml
-rw-r--r--  1 cfw cfw 9.4K Jun 21 18:40  styles.xml
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40  Thumbnails

Here's the unpacked test package:

❯ ls -alh empty/
total 76K
drwxr-xr-x 8 cfw cfw 4.0K Jun 23 13:14  .
drwxr-xr-x 3 cfw cfw 4.0K Jun 23 02:01  ..
-rw-r--r-- 1 cfw cfw 7.7K Jun 21 18:40  content.xml
-rw-r--r-- 1 cfw cfw  260 Jun 21 18:40  manifest.rdf
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14  META-INF
-rw-r--r-- 1 cfw cfw  925 Jun 21 18:40  meta.xml
-rw-r--r-- 1 cfw cfw   46 Jun 23 02:01  mimetype
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14 'Object 1'
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14 'Object 2'
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14  ObjectReplacements
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14  Pictures
-rw-r--r-- 1 cfw cfw  12K Jun 21 18:40  settings.xml
-rw-r--r-- 1 cfw cfw 9.4K Jun 21 18:40  styles.xml
drwxr-xr-x 2 cfw cfw 4.0K Jun 23 13:14  Thumbnails

Note the missing Configurations2 directory, which is an empty tree in the source:

❯ ls -alh ../empty/Configurations2/*
../empty/Configurations2/accelerator:
total 8.0K
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40 .
drwxr-xr-x 11 cfw cfw 4.0K Jun 21 18:40 ..

../empty/Configurations2/floater:
total 8.0K
drwxr-xr-x  2 cfw cfw 4.0K Jun 21 18:40 .
drwxr-xr-x 11 cfw cfw 4.0K Jun 21 18:40 ..

The tool might benefit from a flag that allows empty dirs to be ignored, but it should create them as a default.