Bug #3781

ksh93's builtin ln inconsistent

Added by Garrett D'Amore almost 8 years ago. Updated almost 8 years ago.

cmd - userland programs
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


I found cases where -f is not honored properly with ksh. I can't figure out why.

Processing ksh-overrides: ./src/scripts/mk-dist2101: process_pkgs1128: process_pkg732: process_pkg_line685: pkg_directive_link409: ln: ../../sbin/sh: cannot link to /tmp/DEYOS.out/mnt/usr/bin/sh [File exists]

The source for this routine looks like this:

${X_LN} -sf "$1" "$2" || die "ln -sf $1 $2"

Notably, X_LN evaluates to "ln".

In my script, I was able to workaround this like this:

${X_LN} -sf "$1" "$2" 2> /dev/null || \\
${E}/usr/bin/ln -sf "$1" "$2" || die "ln -sf $1 $2"

This is key, because I don't want to always execute the ln -- this script does a lot of these and it takes too long if I have to shell out all the time.

This similar to 3779.


Updated by Irek Szczesniak almost 8 years ago

Bug passed to upstream. May take a week or two to get feedback because the AST and UWIN projects are currently under lockdown to merge several project branches into the mainline.


Updated by Irek Szczesniak almost 8 years ago

Glenn Fowler asked:
can you make a small test case (like the previous /tmp/x => /tmp/g) that
shows the problem

I'm asking because the first thing I tried worked [comment: Glenn is using ast-ksh.2013-05-03. Its very possible that either Glenn or Roland killed that bug since the last time ksh93 was updated in Illumos]


Updated by Garrett D'Amore almost 8 years ago

I know how to isolate this. Individual small tests seem to pass just fine, this is in the context of a much larger script that issues thousands of these operations before falling over on this one. I'm stumped.


Updated by Garrett D'Amore almost 8 years ago

One possible point, these ln -sf may point to a target that is missing, or may cross a filesystem boundary, if either of those help. Not sure. I'll try some tests later to isolate. But I'm running pretty old ksh right now... illumos last updated in 2009.

Also available in: Atom PDF