shell init issue when click tab, what's wrong with getcwd?

前端 未结 4 1072
死守一世寂寞
死守一世寂寞 2021-01-30 09:53

once i click Tab on bash, the error message will appear, what\'s wrong?

symlink-hook: error retrieving current directory: getcwd: cannot access parent directorie         


        
相关标签:
4条回答
  • 2021-01-30 10:22

    This usually occurs when your current directory does not exist anymore. Most likely, from another terminal you remove that directory (from within a script or whatever). To get rid of this, in case your current directory was recreated in the meantime, just cd to another (existing) directory and then cd back; the simplest would be: cd; cd -.

    0 讨论(0)
  • 2021-01-30 10:23

    Just change the directory to another one and come back. Probably that one has been deleted or moved.

    0 讨论(0)
  • 2021-01-30 10:37

    Yes, cd; and cd - would work. The reason It can see is that, directory is being deleted from any other terminal or any other program and recreate it. So i-node entry is modified so program can not access old i-node entry.

    0 讨论(0)
  • 2021-01-30 10:40

    By chance, is this occurring on a directory using OverlayFS (or some other special file system type)?

    I just had this issue where my cross-compiled version of bash would use an internal implementation of getcwd which has issues with OverlayFS. I found information about this here:

    It seems that this can be traced to an internal implementation of getcwd() in bash. When cross-compiled, it can't check for getcwd() use of malloc, so it is cautious and sets GETCWD_BROKEN and uses an internal implementation of getcwd(). This internal implementation doesn't seem to work well with OverlayFS.

    http://permalink.gmane.org/gmane.linux.embedded.yocto.general/25204

    You can configure and rebuild bash with bash_cv_getcwd_malloc=yes (if you're actually building bash and your C library does malloc a getcwd call).

    0 讨论(0)
提交回复
热议问题