Re: [PATCH] added -- in autocd

2015-04-28 Thread Ángel González
On Tue, 2015-04-28 at 21:27 +0200, isabella parakiss wrote:
> I'm sorry, I added a link to a pastebin in my previous message but 
> it's not available anymore.
> Anyway, this was the content (posted by Score_Under in #bash):
> 
> I think -- should enter said directory.
> I hope it's ok...


It may be easier to visualize in a different order:
score@kirisame ~/downloads $ shopt -s autocd
score@kirisame ~/downloads $ --
bash: --: command not found
score@kirisame ~/downloads $ mkdir -- --
score@kirisame ~/downloads $ --
cd --
score@kirisame ~ $ pwd
/home/kirisame

Expected outcome: 
 To be in /home/kirisame/downloads/--


And yes, I agree it's a bug and should have entered there.



Re: [PATCH] added -- in autocd

2015-04-28 Thread Chet Ramey
On 4/28/15 2:44 PM, isabella parakiss wrote:
> ---
>  execute_cmd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/execute_cmd.c b/execute_cmd.c
> index e3aa37f..51c29c6 100644
> --- a/execute_cmd.c
> +++ b/execute_cmd.c
> @@ -4283,6 +4283,7 @@ run_builtin:
> 
>if (autocd && interactive && words->word && is_dirname (words->word->word))
>  {
> +  words = make_word_list (make_word ("--"), words);
>words = make_word_list (make_word ("cd"), words);
>xtrace_print_word_list (words, 0);
>goto run_builtin;

Thanks, this is a good idea and the right fix.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: [PATCH] added -- in autocd

2015-04-28 Thread isabella parakiss
On 4/28/15, Eric Blake  wrote:
> On 04/28/2015 12:44 PM, isabella parakiss wrote:
>> ---
>
> Might have been nice to leave a comment why you propose this change.  It
> looks like it is needed for the case when autocd mode is on and you type
> the name of a directory that starts with '-', where the cd command needs
> to interpret the argument as a directory name rather than an option.
>
>>  execute_cmd.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/execute_cmd.c b/execute_cmd.c
>> index e3aa37f..51c29c6 100644
>> --- a/execute_cmd.c
>> +++ b/execute_cmd.c
>> @@ -4283,6 +4283,7 @@ run_builtin:
>>
>>if (autocd && interactive && words->word && is_dirname
>> (words->word->word))
>>  {
>> +  words = make_word_list (make_word ("--"), words);
>>words = make_word_list (make_word ("cd"), words);
>>xtrace_print_word_list (words, 0);
>>goto run_builtin;
>>
>
> --
> Eric Blake   eblake redhat com+1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

I'm sorry, I added a link to a pastebin in my previous message but it's
not available anymore.
Anyway, this was the content (posted by Score_Under in #bash):

score@kirisame ~/downloads $ mkdir -- --
score@kirisame ~/downloads $ shopt -s autocd
score@kirisame ~/downloads $ --
cd --
score@kirisame ~ $ cd downloads/
score@kirisame ~/downloads $ rmdir -- --
score@kirisame ~/downloads $ --
bash: --: command not found
score@kirisame ~/downloads $


I think -- should enter said directory.
I hope it's ok...


---
xoxo iza



Re: [PATCH] added -- in autocd

2015-04-28 Thread Eric Blake
On 04/28/2015 12:44 PM, isabella parakiss wrote:
> ---

Might have been nice to leave a comment why you propose this change.  It
looks like it is needed for the case when autocd mode is on and you type
the name of a directory that starts with '-', where the cd command needs
to interpret the argument as a directory name rather than an option.

>  execute_cmd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/execute_cmd.c b/execute_cmd.c
> index e3aa37f..51c29c6 100644
> --- a/execute_cmd.c
> +++ b/execute_cmd.c
> @@ -4283,6 +4283,7 @@ run_builtin:
> 
>if (autocd && interactive && words->word && is_dirname (words->word->word))
>  {
> +  words = make_word_list (make_word ("--"), words);
>words = make_word_list (make_word ("cd"), words);
>xtrace_print_word_list (words, 0);
>goto run_builtin;
> 

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[PATCH] added -- in autocd

2015-04-28 Thread isabella parakiss
---
 execute_cmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/execute_cmd.c b/execute_cmd.c
index e3aa37f..51c29c6 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -4283,6 +4283,7 @@ run_builtin:

   if (autocd && interactive && words->word && is_dirname (words->word->word))
 {
+  words = make_word_list (make_word ("--"), words);
   words = make_word_list (make_word ("cd"), words);
   xtrace_print_word_list (words, 0);
   goto run_builtin;
-- 
2.3.6


This was reported in #bash: http://p.pomf.se/7215


---
xoxo iza