AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
194 stars 30 forks source link

gensquashfs --keep-time argument has no effect in Windows #98

Closed martin-koch closed 2 years ago

martin-koch commented 2 years ago

File and directory timestamps are always set to 1970-01-01 01:00 even if the --keep-time argument is specified in the gensquashfs call. In Linux it works as expected.

AgentD commented 2 years ago

Hi @martin-koch,

I finally got around to testing this using the master branch under Wine, and a Windows 7 VM, using both 32 and 64 bit builds and sofar could not replicate this on my end.

I ran gensquashfs.exe -D . -k ../out.sqfs in each case and the resulting images did contains the correct time stamps when mounting them on Fedora 35 and ran ls -l inside the mount point. I also added a debug prints to the directory scanning code to verify that the timestamps are read and converted correctly.

martin-koch commented 2 years ago

I'm sorry. Just saw that my arguments in linux were slightly different since i did not use a packfile there. If I also use a packfile in linux, the timestamps remain empty as well. gensquashfs.exe --force --pack-dir test --pack-file packfile.txt --keep-time --all-root --no-tail-packing --compressor gzip out.sqfs Where the content of the packfile.txt is just file file1.txt 0644 0 0. Is the keep-time option supposed to work in combination with a packfile? I saw that the glob command may contain a -keeptime but it seems that there is no option to set the timestamp in the file command. Thats why I expected the --keep-time argument to work even if a packfile is used.

martin-koch commented 2 years ago

I'm sorry. Just saw that my arguments in linux were slightly different since i did not use a packfile there. If I also use a packfile in linux, the timestamps remain empty as well. gensquashfs.exe --force --pack-dir test --pack-file packfile.txt --keep-time --all-root --no-tail-packing --compressor gzip out.sqfs Where the content of the packfile.txt is just file file1.txt 0644 0 0. Is the keep-time option supposed to work in combination with a packfile? I saw that the glob command may contain a -keeptime but it seems that there is no option to set the timestamp in the file command. Thats why I expected the --keep-time argument to work even if a packfile is used.

@AgentD Is this an issue in your opinion?

AgentD commented 2 years ago

Hi,

first of all, again, sorry for the long delay. The idea behind the pack file is to create a hierarchy out of nothing. None of the contents specified need to actually exist on disk and no attributes are taken if they do. Only when adding a file, a real, on-disk path can be specified to a file to get the content from. If it is omitted, the virtual path inside the SquashFS image is tried instead.

The line gets a bit blurry with the the glob keyword. This allows scanning an actual directory tree and adding it to a specified target in the virtual hierarchy. It has find-like options and allows shell globbing patterns for filtering and has a -keeptime option on it's own, if keeping the timestamps from the scanned files is intended. By default it also tries to ignore any existing attributes, such as time stamps.

So the pack-file mode works as intended, but it might be interesting for other reasons to add a way of explcitly setting timestamps.