BTS

Issue1934

Title Zsh: dirstack=() does not work as advertised
Priority bug Status chatting
Superseder Nosy List Xk2c, ft
Assigned To ft Topics has patch, zsh

Created on 2015-10-10.10:59:01 by Xk2c, last changed 2015-10-29.23:21:15 by mika.

Files
File name Uploaded Type Edit Remove
0001-make-dirstack-work-as-advertised.patch Xk2c, 2015-10-10.11:09:15 text/x-diff
0001-make-dirstack-work-as-advertised.patch Xk2c, 2015-10-17.22:10:45 text/x-diff
_dirstack_helper Xk2c, 2015-10-10.11:00:44 application/octet-stream
xs Xk2c, 2015-10-10.11:01:02 application/octet-stream
Messages
msg5588 (view) Author: Xk2c Date: 2015-10-17.22:10:45
Hello

when the newest entry in $DIRSTACKFILE is a dir a user no more the right to read
it, a ugly error message is issued at shell start up.

Patch updated to catch this. Attached.


kind regards,

     Thilo

>> ----------
>> files: 0001-make-dirstack-work-as-advertised.patch
>> messages: 5578
>> nosy: Xk2c
>> priority: bug
>> status: unread
>> title: Zsh: dirstack=() does not work as advertised
>> topic: has patch, zsh
>>
>> _____________________________________
>> GRML issue tracker <bts@bts.grml.org>
>> <http://bts.grml.org/grml/issue1934>
>> _____________________________________
>>
>
msg5585 (view) Author: Xk2c Date: 2015-10-14.18:13:40
Hello

Thilo Six schrieb/wrote:

> Additionally:
> I have created a little function _dirstack_helper() attached
> and a "gui" for it xs(), which is the left hand of cd.

This is off topic, but since i mentioned it earlier here i want to add that the
previous verion of my _dirstack_helper() had some grave bugs.
I have updated locally.
Since I don't think it is suitable for grml i wont add more trash here.
I someone is interested let me know.


> But since i am not sure whether those two are wanted in grml i
> attached them as is, prior to spending time on hammering them
> into a patch.
> If you say you would include them i would do that.
> 
> ----------
> files: 0001-make-dirstack-work-as-advertised.patch
> messages: 5578
> nosy: Xk2c
> priority: bug
> status: unread
> title: Zsh: dirstack=() does not work as advertised
> topic: has patch, zsh
> 
> _____________________________________
> GRML issue tracker <bts@bts.grml.org>
> <http://bts.grml.org/grml/issue1934>
> _____________________________________
>
msg5580 (view) Author: Xk2c Date: 2015-10-10.11:09:15
I just noticed the patch contained a little bug, as $d has not been unset.
patch updated.

kind regards,

     Thilo Six
msg5579 (view) Author: Xk2c Date: 2015-10-10.11:00:44
here are xs() and _dirstack_helper()


kind regards,

     Thilo Six
msg5578 (view) Author: Xk2c Date: 2015-10-10.10:59:01
Hello Frank,
Hello Mika,

grmls zshrc contain this lines:
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<
    # Enabling NULL_GLOB via (N) weeds out any non-existing
    # directories from the saved dir-stack file.
    dirstack=( ${(f)"$(< $DIRSTACKFILE)"}(N) )
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<

I testet in a clean environment with only grml zshrc and actually
this does not work for me. If $DIRSTACKFILE contain lines with
non-existing dirs these are not weed out but are happily applied
to dirstack=().

This snippet does what i expect:
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<
    # DOES not work :/
    # # Enabling NULL_GLOB via (N) weeds out any non-existing
    # # directories from the saved dir-stack file.
    # dirstack=( ${(f)"$(< ${DIRSTACKFILE})"}(N) )

    dirstack=()
    dirstacktmp=( ${(f)"$(< ${DIRSTACKFILE})"}(N) )
    for d in "${dirstacktmp[@]}"; do
        [[ -d ${d} ]] && dirstack+=( ${d} )
    done
    builtin typeset -U dirstack
    builtin unset dirstacktmp
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<


Additionally:
I have created a little function _dirstack_helper() attached
and a "gui" for it xs(), which is the left hand of cd.

But since i am not sure whether those two are wanted in grml i
attached them as is, prior to spending time on hammering them
into a patch.
If you say you would include them i would do that.
History
Date User Action Args
2015-10-29 23:21:15mikasetassignedto: ft
nosy: + ft
2015-10-17 22:10:45Xk2csetfiles: + 0001-make-dirstack-work-as-advertised.patch
messages: + msg5588
2015-10-14 18:13:41Xk2csetmessages: + msg5585
2015-10-10 11:09:15Xk2csetfiles: + 0001-make-dirstack-work-as-advertised.patch
messages: + msg5580
2015-10-10 11:07:51Xk2csetfiles: - 0001-make-dirstack-work-as-advertised.patch
2015-10-10 11:01:02Xk2csetfiles: + xs
2015-10-10 11:00:44Xk2csetfiles: + _dirstack_helper
status: unread -> chatting
messages: + msg5579
2015-10-10 10:59:01Xk2ccreate