[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#835513: rpctrace passes incomplete filename to _hurd_exec_file_name if it finds COMMAND in PATH



Package: hurd
Version: 1:0.8.git20160809-1
Severity: normal
File: /bin/rpctrace

If the COMMAND argument of rpctrace does not contain slash, then
rpctrace searches for it in PATH.  If the file found is a script
file, then the interpreter of the script needs to know the file
name so that it can open the file.  However, when rpctrace calls
_hurd_exec_file_name, it specifies COMMAND unchanged as the file
name.  The interpreter then typically does not find the file.

For example, /bin/which in debianutils 4.8 has "#! /bin/sh".
If you run:

  cd /
  PATH=/bin
  rpctrace which

then it shows that dash outputs "/bin/sh: 0: Can't open which"
after calling dir_lookup("which" 1 0) in some directory.
rpctrace should specify the correct file name "/bin/which"
instead; then dash would be able to open the file.

Another, more complex test case:

  mkdir testy
  echo '#! /bin/bash' > testy/prog
  echo 'printf "%s\n" "$0"' >> testy/prog
  chmod +x testy/prog
  PATH=$(pwd)/testy /bin/rpctrace -E PATH=/usr/bin:/bin -o /dev/null prog

Actual output:

  /bin/bash: prog: No such file or directory

Expected output similar to:

  /home/kalle/testy/prog

Fixing this is simple: get prefixed_name from the existing
file_name_path_lookup call, and if it isn't NULL, then use it
instead of *argv and free it afterwards.

AFAIK, the _hurd_exec_file_name patches are not yet in the
upstream Hurd, so I'm filing this in Debian only.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)

Kernel: GNU-Mach 1.7+git20160809-486-dbg/Hurd-0.8
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages hurd depends on:
ii  hurd-libs0.3  1:0.8.git20160809-1
ii  libblkid1     2.28.1-1
ii  libbz2-1.0    1.0.6-8
ii  libc0.3       2.23-4
ii  libdaemon0    0.14-6
ii  libncursesw5  6.0+20160625-1+b1
ii  libtinfo5     6.0+20160625-1+b1
ii  libx11-6      2:1.6.3-1+b1
ii  netdde        0.0.20150828-3
ii  sysv-rc       2.88dsf-59
ii  xkb-data      2.17-1
ii  zlib1g        1:1.2.8.dfsg-2

Versions of packages hurd recommends:
pn  bf-utf-source  <none>

Versions of packages hurd suggests:
pn  hurd-doc  <none>

-- Configuration Files:
/etc/default/hurd-console changed:
ENABLE='false'
DISPLAY='-d vga'
KBD='-d pc_kbd'
if [ -f /etc/default/keyboard ]
then
  . /etc/default/keyboard
fi
[ -z "$XKBLAYOUT" ] || KBD="$KBD --keymap $XKBLAYOUT"
KBD_REPEAT='--repeat=kbd'
MOUSE='-d pc_mouse --protocol=ps/2'
MOUSE_REPEAT='--repeat=mouse'


-- no debconf information

Attachment: pgpS5S41Q4GiI.pgp
Description: PGP signature


Reply to: