Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support storing UnixFS 1.5 Mode and ModTime #7754

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

kstuart
Copy link

@kstuart kstuart commented Nov 5, 2020

Feature Progress

  • Can ipfs add with preserved mode and/or last modification time
    • on files
    • on directories
  • Can ipfs add with custom mode and/or last modification time
    • on files
    • on directories
  • Can ipfs get restoring mode and/or last modification time
    • on files
    • on directories
    • in archives
  • Can ipfs files chmod to change mode
    • on files
    • on directories
  • Can ipfs files touch to change last modification time
    • on files
    • on directories
  • Automatically update the last modification time when file data is changed or truncated (e.g. ipfs files write)
  • Can add files and directories with mode and/or modification time using multipart-form data
  • ipfs files stat reports mode and last modification time

Related PRs

Implementation Notes

  • When adding files and directories without opting to store a mode or modification time the same CIDs are generated that would
    have been created before this feature was implemented (opt-in).
  • The Go runtime currently has no native support for restoring file mode and modification time on symbolic-links, support for r
    estoring the last modification time has been added for Linux distributions and the following BSDs: freebsd, netbsd, openbsd, dr
    agonflybsd.
  • Automatically updating a modification time will only occur if a modification time was previously stored.
  • When creating an archive, for compatibility, time resolution is to the second; Nanoseconds are not supported.

IPFS Add (CLI)

The ipfs add options --preserve-mode and --preserve-mtime are used to store the original mode and last modified time of the file being added, the options --mode, --mtime and --mtime-nsecs are used to store custom values, a custom value of 0 is a no-op as is providing --mtime-nsecs without --mtime.

The preserve flags and custom options are mutually exclusive, if both are provided the custom options take precedence.


Closes #6920

This commit introduces initial Mode and ModTime support
for single filesystem files and webfiles.

The ipfs add options --preserve-mode and --preserve-mtime are
used to store the original mode and last modified time of the
file being added, the options --mode, --mtime and --mtime-nsecs
are used to store custom values.

A custom value of 0 is a no-op.

The preserve flags and custom options are mutually exclusive,
if both are provided the custom options take precedence.
@welcome
Copy link

welcome bot commented Nov 5, 2020

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@kstuart kstuart changed the title preliminary support for unixfs Mode and ModTime Support storing UnixFS 1.5 Mode and ModTime Jun 26, 2022
@kstuart kstuart marked this pull request as ready for review October 31, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BOUNTY] Implement UnixFSv1.5 in go-ipfs
1 participant