Opened 11 years ago
Last modified 3 years ago
#40035 new defect
base aborts if current directory does not exist, even when given a port name
Reported by: | larryv (Lawrence Velázquez) | Owned by: | larryv (Lawrence Velázquez) |
---|---|---|---|
Priority: | Low | Milestone: | |
Component: | base | Version: | 2.2.0 |
Keywords: | Cc: | cooljeanius (Eric Gallager), Ionic (Mihai Moldovan), chrstphrchvz (Christopher Chavez) | |
Port: |
Description
Sorry for the awkward summary. This demonstrates what I mean:
% mkdir foo % cd foo % (cd .. && rmdir foo) % cd $(port dir subversion) shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory error getting working directory name: no such file or directory while executing "pwd" invoked from within "set current_portdir [pwd]" (file "/opt/local/bin/port" line 4857) %
This error only makes sense when invoking port(1) without specifying a port, since it looks for a Portfile in the current working directory.
I assume the same behavior would be observed with the -D option.
Attachments (1)
Change History (10)
comment:1 Changed 11 years ago by cooljeanius (Eric Gallager)
Cc: | egall@… added |
---|
comment:2 Changed 11 years ago by cooljeanius (Eric Gallager)
I found that if you split up the (cd .. && rmdir foo)
into two separate commands, this error doesn't happen:
Local-Admins-MacBook-Pro:foo ericgallager$ cd .. Local-Admins-MacBook-Pro:MacPorts-fork ericgallager$ rmdir foo Local-Admins-MacBook-Pro:MacPorts-fork ericgallager$ cd $(port dir subversion)
vs.
Local-Admins-MacBook-Pro:foo ericgallager$ (cd .. && rmdir foo) Local-Admins-MacBook-Pro:foo ericgallager$ cd $(port dir subversion)
I guess that's because in the first case, the directory isn't actually getting deleted out from under you...
comment:3 Changed 10 years ago by Ionic (Mihai Moldovan)
No, you're changing other semantics.
()
spawns a subshell and cd ..
does only apply to this child process. The parent's PWD is not affected (and will stay the deleted directory.)
comment:4 Changed 10 years ago by Ionic (Mihai Moldovan)
This issue should be elevated to CRITICAL because it affects me!
In all seriousness, though, it's annoying. I often cd $(port work foo)
to patch/do random stuff. While cleaning explicitly or running other operations on the port foo
, this directory gets deleted and re-created (as it should be.)
Due to port
's inability to work in an "invalid" $PWD
, I have to cd .
to get into the newly created dir (a zsh
-only feature, I assume) and run the port
operation again.
comment:5 Changed 10 years ago by Ionic (Mihai Moldovan)
Cc: | ionic@… added |
---|
comment:6 Changed 6 years ago by chrstphrchvz (Christopher Chavez)
Cc: | chrstphrchvz added |
---|
comment:7 Changed 6 years ago by chrstphrchvz (Christopher Chavez)
comment:8 Changed 3 years ago by JDLH (Jim DeLaHunt)
This problem just affected me. In my case, MacPorts Base and all ports appeared to be fine. My current working directory was a subdirectory of ~/Desktop/
, and for some reason I can no longer list the contents of ~/Desktop/
with ls
. This apparently was enough to make pwd
unusable by MacPorts Base. The symptoms of this ticket followed. I fixed it by changing my current working directory to ~
.
comment:9 Changed 3 years ago by cooljeanius (Eric Gallager)
You may need to grant MacPorts access to your Home directory (and any relevant subdirectories) in the "Privacy" section of the "Security & Privacy" system prefpane for this to work; I'll attach a screenshot of what it ought to look like.
Changed 3 years ago by cooljeanius (Eric Gallager)
Attachment: | Screen Shot 2022-04-11 at 22.14.11.png added |
---|
screenshot of MacPorts (and related binaries) having been granted Full Disk Access in System Preferences
Cc Me!