Hello,

Could someone be kind enough to explain to me the cause of the
following?

$ cat /home/meunier/bin/foo
#!/bin/ksh
echo "it works!"
$ /usr/bin/which foo
/home/meunier/bin/foo
$ foo
it works!
$ doas /usr/bin/which foo
Password:
/home/meunier/bin/foo
$ doas foo
Password:
doas: foo: command not found
$

It makes no sense to me.

The same thing happens if I first move foo to / and add / at the
beginning of $PATH, so it's not a permission problem with
/home/meunier/bin, and foo itself has permissions 777.
If I first move foo to /bin then doas(1) finds foo without problem.

For reference:

$ uname -a
OpenBSD something.somewhere 5.8 GENERIC#1066 i386
$ cat /etc/doas.conf
permit :wheel
$ egrep wheel /etc/group
wheel:*:0:root,meunier
$ doas /home/meunier/bin/foo
Password:
it works!
$

By the way, while playing with which(1) and doas(1) and $PATH, I
managed to get which(1) to core dump, twice, although I have not been
able to reproduce it reliably.  Here's gdb's output from the core
dump, for all it's worth:

$ gdb /usr/bin/which which.core
GNU gdb 6.3
[...]
This GDB was configured as "i386-unknown-openbsd5.8"...(no debugging symbols 
found)

Core was generated by `which'.
Program terminated with signal 11, Segmentation fault.
(no debugging symbols found)
Loaded symbols for /usr/bin/which
Reading symbols from /usr/lib/libc.so.80.1...done.
Loaded symbols for /usr/lib/libc.so.80.1
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x1ab63feb in ?? () from /usr/bin/which
(gdb) bt
#0  0x1ab63feb in ?? () from /usr/bin/which
#1  0x87486000 in ?? ()
#2  0x3ab6303d in ?? () from /usr/bin/which
#3  0x000002e6 in ?? ()
#4  0x00000000 in ?? ()
(gdb)

Thanks,

Philippe

Reply via email to