NetBSD-Bugs archive

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

bin/55526: sh: "command foo" removes function "foo"



>Number:         55526
>Category:       bin
>Synopsis:       sh: "command foo" removes function "foo"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 31 03:20:00 +0000 2020
>Originator:     Valery Ushakov
>Release:        NetBSD 8-STABLE
>Organization:
>Environment:
NetBSD pony 8.1_STABLE NetBSD 8.1_STABLE (GENERIC) #0: Sat Jun 15 07:30:17 MSK 2019  uwe@sampo:/home/uwe/work/netbsd/build8/obj/macppc/sys/arch/macppc/compile/GENERIC macppc  
>Description:
If there's a shell function "foo" with the same name as a command
in your path, running "command foo" seems to clobber the function
of the same name.
>How-To-Repeat:
$ command -V ls
ls is /bin/ls
$ ls
file.sh
$ ls() { command ls -aCF "$@"; }
$ ls
./        ../       file.sh*
$ ls
file.sh
$ command -V ls
ls is a tracked alias for /bin/ls
$ ls() { command ls -aCF "$@"; }
$ command -V ls
ls is a shell function
$ command -V ls
ls is a shell function
$ command ls
file.sh
$ ls
file.sh
$ 

>Fix:



Home | Main Index | Thread Index | Old Index