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

Invalid nlink file attribute for symbolic link to hard link

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • Mac Mountain lion

    • x86
    • os_x

      - f2 is a hard link to f1
      - f3 is a symbolic link to f2

      When retrieving the unix attributes (thanks to Files.readAttributes(p, "unix:*"), the nlink is 2, it should be 1.

      Testcase:
      final Path p = FileSystems.getDefault().getPath("path to f3");
                  Map unixFileAttributes = Files.readAttributes(p, "unix:*");
                  for(Object obj : unixFileAttributes.entrySet()){
                      Entry e = (Entry)obj;
                      System.out.println(e.getKey()+"="+e.getValue());
                  }

      lastAccessTime=2013-04-10T15:06:50Z
      isSymbolicLink=false
      rdev=0
      ino=11075442
      mode=33188
      isOther=false
      ctime=2013-04-10T15:06:33Z
      fileKey=(dev=1000002,ino=11075442)
      creationTime=2013-04-08T09:16:07Z
      size=20
      gid=...
      dev=16777218
      nlink=2
      uid=...
      owner=...
      permissions=[OTHERS_READ, OWNER_WRITE, OWNER_READ, GROUP_READ]
      group=...
      lastModifiedTime=2013-04-08T09:16:07Z
      isDirectory=false
      isRegularFile=true

            alanb Alan Bateman
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: