Package: ksh
Version: 93u+20120801-3.4+deb10u1
Severity: normal
Tags: upstream

ksh doesn’t pay attention to tracked aliases during execution – it
always does a PATH search:

    $ strace -e signal=none -P /usr/local/bin/ls -P /usr/bin/ls -P /bin/ls ksh 
+E
    $ ls -a
    stat("/usr/local/bin/ls", 0x7ffde8d749c0) = -1 ENOENT (No such file or 
directory)
    stat("/usr/bin/ls", 0x7ffde8d749c0)     = -1 ENOENT (No such file or 
directory)
    stat("/bin/ls", {st_mode=S_IFREG|0755, st_size=138856, ...}) = 0
    lstat("/bin/ls", {st_mode=S_IFREG|0755, st_size=138856, ...}) = 0
    .  ..
    $ whence -a ls
    ls is a tracked alias for /bin/ls
    $ ls -a
    stat("/usr/local/bin/ls", 0x7ffde8d749c0) = -1 ENOENT (No such file or 
directory)
    stat("/usr/bin/ls", 0x7ffde8d749c0)     = -1 ENOENT (No such file or 
directory)
    stat("/bin/ls", {st_mode=S_IFREG|0755, st_size=138856, ...}) = 0
    lstat("/bin/ls", {st_mode=S_IFREG|0755, st_size=138856, ...}) = 0
    .  ..

This is inefficient. It’s also surprising, given that tracked aliases
were originally intended to avoid PATH lookups in cases like this.

This appears to have been first noticed in 2011 by Siddhesh Poyarekar.
marc.info has mangled the thread a bit, but I think it’s

    
https://marc.info/?i=AANLkTinva-vek-y4CrNPdMic9b_HaFMmKVv=+3tnh...@mail.gmail.comhttps://marc.info/?i=201102161622.p1ggmyvv022...@penguin.research.att.comhttps://marc.info/?i=AANLkTi=ktorzlncfmck16yxackrd6rkljv5ywszfc...@mail.gmail.com
      │ ├ 
https://marc.info/?i=aanlktikiufzexcrxxkx8ckbgm2-tbwg6f1r2+rotw...@mail.gmail.com
      │ └ https://marc.info/?i=rca1529.4d5d6c3...@rightcore.comhttps://marc.info/?i=20110307172636.34716...@zaphod.usersys.redhat.com

-- System Information:
Debian Release: 10.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Versions of packages ksh depends on:
ii  binfmt-support  2.2.0-2
ii  libc6           2.28-10

ksh recommends no packages.

ksh suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: PGP signature

Reply via email to