From: "Yannic Schröder" <schroeder@ibr.cs.tu-bs.de>
To: zsh-workers@zsh.org
Cc: Vincent Breitmoser <look@my.amazin.horse>, weichbrodt@ibr.cs.tu-bs.de
Subject: cwd unintentionally changed
Date: Thu, 25 Apr 2019 14:03:56 +0200 [thread overview]
Message-ID: <f6d8b44f-84be-0102-5ab8-b56824e23f87@ibr.cs.tu-bs.de> (raw)
Hi *,
I got myself into a situation where zsh changed my working directory to
"/" without further notice. Unfortunately, the next command I issued was
"sudo rm -rf *", which did not end well with cwd being "/" :-(
My colleagues and me started to track down the bug. Our efforts are
documented here:
https://github.com/grml/grml-etc-core/issues/76
(We initially though it was a bug with grml zsh config.)
A minimal example that triggers the bug looks like this:
$ mkdir /tmp/tmp.0HnyRZ1iXv/
$ cd /tmp/tmp.0HnyRZ1iXv/
$ mkdir a
$ sudo zsh -f -c 'mount -t tmpfs tmpfs a; cd a; touch x; ls; umount
--lazy ../a; ls; foo=.; echo ${foo:a}; ls; realpath .; echo $PWD;'
It will output the following:
x # content of directory a (expected)
x # content of directory a (expected)
/ # NOT expected
bin dev ... # content of / (NOT expected)
/ # NOT expected
/tmp/tmp.0HnyRZ1iXv/a # expected
cwd silently changed to "/" while pwd does not know about this.
This looks like a very specific use case, but a change [0] about how
vcs_info gets the base directory for the repository also triggers this
bug. In my case when using Gnome which automatically mounts and unmounts
external drives (with the --lazy option).
After ending up in the source code for zgetcwd() and zgetdir() we
decided to hand the issue over to you :-)
Regards,
Yannic
[0]
https://github.com/zsh-users/zsh/commit/faa07d064bb2bd9cd9892a255a4b63811242b9fb
--
Yannic Schröder, M.Sc.
Technische Universität Braunschweig
Institut für Betriebssysteme und Rechnerverbund
Mühlenpfordtstr. 23
38106 Braunschweig
Fon: +49 (531) 391 - 3249
Fax: +49 (531) 391 - 5936
E-Mail: schroeder@ibr.cs.tu-bs.de
next reply other threads:[~2019-04-25 12:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190425120502epcas5p21b83b94136e0b2fae1002220c7d52656@epcas5p2.samsung.com>
2019-04-25 12:03 ` Yannic Schröder [this message]
2019-04-25 13:31 ` Peter Stephenson
2019-04-26 6:12 ` Yannic Schröder
2019-04-26 8:30 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6d8b44f-84be-0102-5ab8-b56824e23f87@ibr.cs.tu-bs.de \
--to=schroeder@ibr.cs.tu-bs.de \
--cc=look@my.amazin.horse \
--cc=weichbrodt@ibr.cs.tu-bs.de \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).