ln -s exe magic (coreutils 6.7-2)

Brian Dessent brian@dessent.net
Mon Apr 9 19:19:00 GMT 2007

Eric Blake wrote:

> when creating symlinks, I plan to still auto-append the .exe to the link
> target if necessary (otherwise, exec*() succeeds but open() fails when
> dereferencing the symlink), but not to the link name.

That sounds correct.  If open() fails on a link target that's missing an
.exe, then it should not be able to create such a symlink with ln.  Or
perhaps, it is possible, but doing so requires special effort, e.g. "ln
-s foo bar."

> Therefore, in the original case, the first ln -s generates
> sendmail->/usr/bin/exim, then the second ln -s overwrites it with
> sendmail->/usr/sbin/ssmtp.exe rather than adding a new file.

Don't you mean the first ln -s generates "sendmail -> /usr/bin/exim.exe"
and the second overwrites it with "sendmail -> /usr/bin/ssmtp.exe"?

> Now, should I also make ln -s smart enough for the reverse?  In other
> words, if sendmail.exe->/usr/sbin/ssmtp.exe exists, and the user does 'ln
> - -fs /usr/bin/exim sendmail', should I delete the existing sendmail.exe.lnk
> as part of creating the new symlink?  I'm guessing that since the -f
> implies unlinking first, that this would be okay to do.

Yes, it should remove the existing sendmail.exe link.  That is the
expected behavior of the command (since both "sendmail" and
"sendmail.exe" describe the same executable, from the point of view of
exec) and not doing so would seem to only lead to bugs.

> The other thing I am thinking about is making the coreutils postinstall
> script go through /usr/bin and finding all instances of *.exe.lnk, and
> rewriting those symlinks to be just *.lnk, taking care of Corinna's list
> of symlinks with .exe in their name.  This won't catch everything, but it
> will be a good chunk of the current issues, while transitioning towards
> the point of preferring only *.lnk rather than *.exe.lnk for a symlink
> name.  I wonder, though, if this will trip up cygcheck at all.

That sounds good at first, but whatever package created those symlinks
will just recreate them again when reinstalled/updated, so I think the
better plan would be to identify whatever is doing it and work with
maintainers of those packages to update them.


Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list