Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8165728

(fs) BasicFileAttributeView should support setting birth time (creationTime) on OS X/HFS

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u101
    • core-libs
    • OS X, HFS.

      HFS on OS X supports the setting of the file creation time. Unfortunately, this is not implemented—only reading is, thanks to JDK-8011536. On OS X with HFS a call to set the creation time currently fails silently.

      Even though the official manpage for OS X does not offer this piece of information (because it's from 1993!!!), it's implemented as described in the more up to date FreeBSD manpages. See for example https://www.freebsd.org/cgi/man.cgi?query=utimes&sektion=2 The important part being:

      "For file systems that support file birth (creation) times (such as UFS2), the birth time will be set to the value of the second element if the second element is older than the currently set birth time."

      The description implies, that the creation time can only be made older. Nevertheless, that's what one usually wants and is therefore useful.

      Note, that the manpage also mentions other file system like UFS2, which also support birth dates. Perhaps a working implementation is worth having around for those file systems as well...

            bpb Brian Burkhalter
            hschreiber Hendrik Schreiber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: