Opened 10 years ago

Closed 10 years ago

#44110 closed defect (wontfix)

coreutils @8.22_0 - ln fails to create symbolic links if source and target differ in character case only (and creates hidden hardlinks instead)

Reported by: scubi@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.0
Keywords: Cc:
Port: coreutils

Description

/opt/local/libexec/gnubin/ln fails to create a symbolic link if the name of the target and the directory differ only in character case. In that case a symbolic link is created below the source directory and you end up with a hidden hardlink if the newly created symlink is deleted!

The behavior can be reproduced by following these steps:

  • create a directory Foo and try to create a symbolic link to that directory called foo
  • delete the wrongly placed symlink Foo/foo
  • list the directory Foo was created in
  • list the content of Foo as well as foo !!!!!!!!
  • list the inodes of Foo and the hidden foo
indigo:gnu-ln-test scubi$ ls -al
insgesamt 0
drwxr-xr-x   2 scubi staff   68 22. Jun 15:07 .
drwxr-xr-x+ 36 scubi staff 1224 22. Jun 14:51 ..

indigo:gnu-ln-test scubi$ mkdir Foo

indigo:gnu-ln-test scubi$ ls -al
insgesamt 0
drwxr-xr-x   3 scubi staff  102 22. Jun 15:12 .
drwxr-xr-x+ 36 scubi staff 1224 22. Jun 14:51 ..
drwxr-xr-x   2 scubi staff   68 22. Jun 15:12 Foo

indigo:gnu-ln-test scubi$ ln -s Foo/ foo

indigo:gnu-ln-test scubi$ ls -al
insgesamt 0
drwxr-xr-x   3 scubi staff  102 22. Jun 15:12 .
drwxr-xr-x+ 36 scubi staff 1224 22. Jun 14:51 ..
drwxr-xr-x   3 scubi staff  102 22. Jun 15:13 Foo

indigo:gnu-ln-test scubi$ ls -al Foo/
insgesamt 4
drwxr-xr-x 3 scubi staff 102 22. Jun 15:13 .
drwxr-xr-x 3 scubi staff 102 22. Jun 15:12 ..
lrwxr-xr-x 1 scubi staff   4 22. Jun 15:13 Foo -> Foo/

indigo:gnu-ln-test scubi$ rm Foo/Foo

indigo:gnu-ln-test scubi$ ls -al Foo/
insgesamt 0
drwxr-xr-x 2 scubi staff  68 22. Jun 15:13 .
drwxr-xr-x 3 scubi staff 102 22. Jun 15:12 ..

indigo:gnu-ln-test scubi$ ls -al
insgesamt 0
drwxr-xr-x   3 scubi staff  102 22. Jun 15:12 .
drwxr-xr-x+ 36 scubi staff 1224 22. Jun 14:51 ..
drwxr-xr-x   2 scubi staff   68 22. Jun 15:13 Foo

indigo:gnu-ln-test scubi$ ls -al Foo foo
Foo:
insgesamt 0
drwxr-xr-x 2 scubi staff  68 22. Jun 15:13 .
drwxr-xr-x 3 scubi staff 102 22. Jun 15:12 ..

foo:
insgesamt 0
drwxr-xr-x 2 scubi staff  68 22. Jun 15:13 .
drwxr-xr-x 3 scubi staff 102 22. Jun 15:12 ..

indigo:gnu-ln-test scubi$ ls -ldi Foo/ foo
2028539 drwxr-xr-x 2 scubi staff 68 22. Jun 15:13 Foo/
2028539 drwxr-xr-x 2 scubi staff 68 22. Jun 15:13 foo

indigo:gnu-ln-test scubi$ 

Due to the fact that this sounds unbelievable - I also attached a screenshot :)

BTW: creating the symlink with a different name works as expected:

indigo:gnu-ln-test scubi$ ln -s Foo/ boo

indigo:gnu-ln-test scubi$ ls -al
insgesamt 4
drwxr-xr-x   4 scubi staff  136 22. Jun 15:25 .
drwxr-xr-x+ 36 scubi staff 1224 22. Jun 14:51 ..
drwxr-xr-x   2 scubi staff   68 22. Jun 15:13 Foo
lrwxr-xr-x   1 scubi staff    4 22. Jun 15:25 boo -> Foo/

indigo:gnu-ln-test scubi$

Attachments (1)

create-symlink.png (292.6 KB) - added by scubi@… 10 years ago.
Screenshot

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by scubi@…

Attachment: create-symlink.png added

Screenshot

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Keywords: ln symlink removed

comment:2 Changed 10 years ago by neverpanic (Clemens Lang)

That's just the way the OS X filesystem behaves in its case-insensitive mode. Try ls -ldi /Users /users. This isn't caused by the symlink at all.

comment:3 Changed 10 years ago by scubi@…

Thank you for the prompt answer. And sorry for that - it's my first Mac and I was just not aware of that semi-case-sensitive file handling.

Please close the ticket.

Last edited 10 years ago by scubi@… (previous) (diff)

comment:4 Changed 10 years ago by neverpanic (Clemens Lang)

Resolution: wontfix
Status: newclosed

I'd resolve this as invalid, but then again I agree this is very weird, so it's going to be wontfix, because this isn't our bug to fix. I hope Apple will someday switch to a better file system and avoid this weirdness.

Note: See TracTickets for help on using tickets.