ADFlib icon indicating copy to clipboard operation
ADFlib copied to clipboard

unadf directory timestamp issues on extract

Open t-w opened this issue 8 months ago • 0 comments

unadf has 2 problems with setting timestamps on directories:

  1. On Windows, the code cannot set the timestamp, seemingly due to permissions:
tmp/unadf_win32/mangle_win32_filenames\not-forbidden: Permission denied
tmp/unadf_win32/mangle_win32_filenames\forbidden-suffixes: Permission denied
tmp/unadf_win32/mangle_win32_filenames\forbidden-chars: Permission denied

but, in fact, this is due to the use of utime() which works only on files (but not on directories!). This can be mitigated by writing special code using SetFileTime, which should work for directories (basically, a custom utime() has to be written).

  1. Setting the directories time makes no sense as it is done before writing extracted files inside them (creating anything inside updates the directory's timestamp). The timestamp on directory must be set after writing extracted things inside the directory.

Frankly, I do not consider this some critical thing (timestamp on directories could be not set at all, it is more important on files), but at least it has to be consistent - either it does set timestamps on directories and does it, if possible, on all systems, or do not set it at all (leave what the OS set). For sure, the "permissions" error on Windows (1.) has to be corrected.

t-w avatar Apr 09 '25 15:04 t-w