* Lack of sanitisation of I/O in pushd/popd
@ 2018-02-19 16:34 Joao Paulo
2018-02-19 17:13 ` Leah Neukirchen
2018-02-19 17:23 ` Mikael Magnusson
0 siblings, 2 replies; 5+ messages in thread
From: Joao Paulo @ 2018-02-19 16:34 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
Hello,
I am encountering some problems with the implementation of the pushd and
popd. The spaces in directory paths should be sanitise so I can read them
properly. This is if I have a folder named Google Drive in my home
directory, I expect it to be `~/Google\ Drive` not `~/Google Drive`, this
is causing me problems to read the data from the `popd -n` because there is
no difference between that whitespace, and the whitespace used to print
elements in the stack.
Best Regards,
João Paulo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Lack of sanitisation of I/O in pushd/popd
2018-02-19 16:34 Lack of sanitisation of I/O in pushd/popd Joao Paulo
@ 2018-02-19 17:13 ` Leah Neukirchen
2018-02-19 17:23 ` Mikael Magnusson
1 sibling, 0 replies; 5+ messages in thread
From: Leah Neukirchen @ 2018-02-19 17:13 UTC (permalink / raw)
To: zsh-workers
Joao Paulo <joaolrpaulo@gmail.com> writes:
> Hello,
>
> I am encountering some problems with the implementation of the pushd and
> popd. The spaces in directory paths should be sanitise so I can read them
> properly. This is if I have a folder named Google Drive in my home
> directory, I expect it to be `~/Google\ Drive` not `~/Google Drive`, this
> is causing me problems to read the data from the `popd -n` because there is
> no difference between that whitespace, and the whitespace used to print
> elements in the stack.
popd -n is not even documented, and more a sideeffect of the
implementation that it works.
You can list the stack with "dirs -p" linewise, or just access the
array $dirstack directly.
hth,
--
Leah Neukirchen <leah@vuxu.org> http://leah.zone
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Lack of sanitisation of I/O in pushd/popd
2018-02-19 16:34 Lack of sanitisation of I/O in pushd/popd Joao Paulo
2018-02-19 17:13 ` Leah Neukirchen
@ 2018-02-19 17:23 ` Mikael Magnusson
[not found] ` <CAOr4F+Phd=gFZten4-21OMv=khuKObreW4xxHyR85VgKEkdKAw@mail.gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2018-02-19 17:23 UTC (permalink / raw)
To: Joao Paulo; +Cc: zsh workers
On Mon, Feb 19, 2018 at 5:34 PM, Joao Paulo <joaolrpaulo@gmail.com> wrote:
> Hello,
>
> I am encountering some problems with the implementation of the pushd and
> popd. The spaces in directory paths should be sanitise so I can read them
> properly. This is if I have a folder named Google Drive in my home
> directory, I expect it to be `~/Google\ Drive` not `~/Google Drive`, this
> is causing me problems to read the data from the `popd -n` because there is
> no difference between that whitespace, and the whitespace used to print
> elements in the stack.
If you're wrapping popd in a function, you can just access the
directory stack elements via $dirstack. The user can disable popd
printing anything at all with setopt pushd_silent anyway.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Lack of sanitisation of I/O in pushd/popd
[not found] ` <CAOr4F+Phd=gFZten4-21OMv=khuKObreW4xxHyR85VgKEkdKAw@mail.gmail.com>
@ 2018-02-19 18:31 ` Mikael Magnusson
2018-02-19 18:33 ` Joao Paulo
0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2018-02-19 18:31 UTC (permalink / raw)
To: Joao Paulo; +Cc: zsh workers
On Mon, Feb 19, 2018 at 7:22 PM, Joao Paulo <joaolrpaulo@gmail.com> wrote:
> Thanks for the tip, but the information of $dirstack is the same as the
> `popd -n` so, it is not sanitizing the output as well.
>
> I think the problem is with pushd not validating if the current folder as
> some space in the middle.
Read the section about arrays in the manpage.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Lack of sanitisation of I/O in pushd/popd
2018-02-19 18:31 ` Mikael Magnusson
@ 2018-02-19 18:33 ` Joao Paulo
0 siblings, 0 replies; 5+ messages in thread
From: Joao Paulo @ 2018-02-19 18:33 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh workers
[-- Attachment #1: Type: text/plain, Size: 513 bytes --]
Holy... My bad, thanks for the help.
On Mon, Feb 19, 2018, 18:31 Mikael Magnusson <mikachu@gmail.com> wrote:
> On Mon, Feb 19, 2018 at 7:22 PM, Joao Paulo <joaolrpaulo@gmail.com> wrote:
> > Thanks for the tip, but the information of $dirstack is the same as the
> > `popd -n` so, it is not sanitizing the output as well.
> >
> > I think the problem is with pushd not validating if the current folder as
> > some space in the middle.
>
> Read the section about arrays in the manpage.
>
> --
> Mikael Magnusson
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-19 18:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 16:34 Lack of sanitisation of I/O in pushd/popd Joao Paulo
2018-02-19 17:13 ` Leah Neukirchen
2018-02-19 17:23 ` Mikael Magnusson
[not found] ` <CAOr4F+Phd=gFZten4-21OMv=khuKObreW4xxHyR85VgKEkdKAw@mail.gmail.com>
2018-02-19 18:31 ` Mikael Magnusson
2018-02-19 18:33 ` Joao Paulo
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).