* Accidental function definition - bug or feature?
@ 2015-10-22 12:30 Holger Hoffstätte
2015-10-22 13:47 ` Eric Cook
0 siblings, 1 reply; 4+ messages in thread
From: Holger Hoffstätte @ 2015-10-22 12:30 UTC (permalink / raw)
To: zsh-users
Hi,
today I accidentally b0rked my shell with git and an unquoted filename via
copypasta. To reproduce:
$git add foo().bar
$git --version
git:7: command not found: .bar
Turns out this unhelpfully defined a local function, which now shadows
the command:
$functions git
git () {
.bar
}
Obviously everything works correctly with quoted filenames.
Also bash complains as I would have expected:
bash$ git add foo().bar
bash: syntax error near unexpected token `('
So..bug or feature?
thanks,
Holger
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accidental function definition - bug or feature?
2015-10-22 12:30 Accidental function definition - bug or feature? Holger Hoffstätte
@ 2015-10-22 13:47 ` Eric Cook
2015-10-22 16:11 ` ZyX
0 siblings, 1 reply; 4+ messages in thread
From: Eric Cook @ 2015-10-22 13:47 UTC (permalink / raw)
To: zsh-users
On 10/22/2015 08:30 AM, Holger Hoffstätte wrote:
> So..bug or feature?
>
> thanks,
> Holger
>
defining multiple functions at once is a feature
mv cp() {
$0 -v "$@"
}
or defining multiple TRAP functions to do the same thing are usual uses for it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accidental function definition - bug or feature?
2015-10-22 13:47 ` Eric Cook
@ 2015-10-22 16:11 ` ZyX
2015-10-27 16:40 ` Clint Hepner
0 siblings, 1 reply; 4+ messages in thread
From: ZyX @ 2015-10-22 16:11 UTC (permalink / raw)
To: Eric Cook, zsh-users
22.10.2015, 16:48, "Eric Cook" <llua@gmx.com>:
> On 10/22/2015 08:30 AM, Holger Hoffstätte wrote:
>
>> So..bug or feature?
>>
>> thanks,
>> Holger
>
> defining multiple functions at once is a feature
>
> mv cp() {
> $0 -v "$@"
> }
>
> or defining multiple TRAP functions to do the same thing are usual uses for it.
Can be disabled with
unsetopt multifuncdef
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accidental function definition - bug or feature?
2015-10-22 16:11 ` ZyX
@ 2015-10-27 16:40 ` Clint Hepner
0 siblings, 0 replies; 4+ messages in thread
From: Clint Hepner @ 2015-10-27 16:40 UTC (permalink / raw)
To: zsh-users
> On Oct 22, 2015, at 12:11 PM, ZyX <kp-pav@yandex.ru> wrote:
>
> 22.10.2015, 16:48, "Eric Cook" <llua@gmx.com>:
>>> On 10/22/2015 08:30 AM, Holger Hoffstätte wrote:
>>>
>>> So..bug or feature?
>>>
>>> thanks,
>>> Holger
>>
>> defining multiple functions at once is a feature
>>
>> mv cp() {
>> $0 -v "$@"
>> }
>>
>> or defining multiple TRAP functions to do the same thing are usual uses for it.
>
> Can be disabled with
>
> unsetopt multifuncdef
You can also undefine functions as an immediate fix:
unfunction git add foo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-27 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 12:30 Accidental function definition - bug or feature? Holger Hoffstätte
2015-10-22 13:47 ` Eric Cook
2015-10-22 16:11 ` ZyX
2015-10-27 16:40 ` Clint Hepner
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).