ulsdevteam / islandora_datastreams_io

Islandora Datastreams Import / Export Utility
GNU General Public License v2.0
5 stars 4 forks source link

Misreads hidden Mac files as datastreams - can't be deleted #2

Closed bondjimbond closed 6 years ago

bondjimbond commented 6 years ago

If using a Mac and zipping files, the archive automatically contains some hidden files. This module reads the hidden files as datastreams relating to nonexistent objects.

e.g. I zipped up a MODS XML file for import, and got the following:

ZIP archive contains 2 Datastream/s PID = :_MACOSX DSID = MACOSX PID = tweepy:1 DSID = MODS

If you continue, you "successfully" push both datastreams:

Datastreams Pushed: 2 PID = :_MACOSX DSID = MACOSX PID = tweepy:1 DSID = MODS

I don't know what happens to the _MACOSX object (which doesn't exist of course), but including the hidden file in the temp directory causes problems. When running the import tool, you get a warning about the previous import:

Warning: rmdir(/tmp/datastream_io_datastreams_extract_205749_080149): Directory not empty in islandora_datastreams_io_dump_temp_dir() (line 43 of /var/www/drupal/sites/all/modules/islandora_datastreams_io/includes/utilities.inc).

If you navigate to the temp directory in the command line, you'll find a directory called MACOSX. This directory cannot be deleted: `rmdir: failed to remove ‘MACOSX’: Permission denied`

And it cannot have its permissions changed: chmod: changing permissions of ‘__MACOSX’: Operation not permitted

Solution would be to screen for such files during upload and exclude them.

wgilling commented 6 years ago

I will release a bugfix for this soon.

wgilling commented 6 years ago

The code has been changed to address this (as well as the namespace restrictions) in the latest commit -- 73f4fa5b589ae1f204b5a7fb0d3fdeb5d47ea63b. Please let me know if there is anything else.

bondjimbond commented 6 years ago

Error continues:

Warning: rmdir(/tmp/datastream_io_datastreams_extract_144831_020131): Directory not empty in islandora_datastreams_io_dump_temp_dir() (line 45 of /var/www/drupal/sites/all/modules/islandora_datastreams_io/includes/utilities.inc).

bondjimbond commented 6 years ago

Yep, this is still an issue after the latest commit. Continuing to keep these extract folders in my /tmp file that can't be deleted, with __MACOSX in them.