无法使用 Curl 写入隐藏路径

Teg*_*ece 8 vim permissions command-line curl

我今天全新安装了 Ubuntu 20.04。 \n我已经设置了 vim 环境,当我遇到减速带时,它使用curl 安装了plug.vim。

\n
Error creating directory /home/simon/.vim/autoload.\ncurl: (23) Failed writing received data to disk/application\n
Run Code Online (Sandbox Code Playgroud)\n

.vimrc 中的相关行是:

\n
" Auto-install plugin manager if it doesnt exist (and PlugInstall)\nif empty(glob('~/.vim/autoload/plug.vim'))\n    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs\n        \\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim\n    autocmd VimEnter * PlugInstall | source $MYVIMRC\nendif\n
Run Code Online (Sandbox Code Playgroud)\n

试图隔离问题,似乎我无法使用其中包含点文件的路径作为curl 的输出。

\n

例如。这失败了:

\n
\xe2\x9e\x9c  ~ curl -fLo ~/.test_dot_folder/test.py --create-dirs example.com\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /home/simon/.test_dot_folder/test.py: No \nWarning: such file or directory\n100  1256  100  1256    0     0   2800      0 --:--:-- --:--:-- --:--:--  2803\ncurl: (23) Failure writing output to destination\n
Run Code Online (Sandbox Code Playgroud)\n

但这有效:

\n
\xe2\x9e\x9c  ~ curl -fLo ~/test_dot_folder/test.py --create-dirs example.com\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100  1256  100  1256    0     0   2659      0 --:--:-- --:--:-- --:--:--  2661\n\xe2\x9e\x9c  ~ \n
Run Code Online (Sandbox Code Playgroud)\n

唯一的区别是.文件夹前面的。\n即使我这样做

\n
mkdir .test_dot_folder\n
Run Code Online (Sandbox Code Playgroud)\n

然后运行第一个curl命令,仍然失败。

\n

如果您想知道目录中的权限:

\n

pathlld这是当我在我的主目录上运行 @waltinator 的脚本时发生的情况。

\n
\xe2\x9e\x9c  ~ sudo code/pathlld.sh -v . \n\ndrwxr-xr-x 22 simon simon 4096 Aug  7 20:15 . \n/dev/nvme0n1p5 on / type ext4 (rw,relatime,errors=remount-ro)\n
Run Code Online (Sandbox Code Playgroud)\n

关于出了什么问题有什么建议吗?

\n

icc*_*c97 12

奇怪且巧合的是,我遇到了与您完全相同的问题。不仅可以使用curl,还可以同时使用Vim 和Plug。小世界。

我的猜测是解决这个问题是curl我正在使用的问题。

我已经从 snap 商店安装了curl:

sudo snap install curl
Run Code Online (Sandbox Code Playgroud)

然后我得到了和你一样的错误信息:

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Error creating directory /home/ian/.vim/autoload.
curl: (23) Failed writing received data to disk/application
Run Code Online (Sandbox Code Playgroud)

我的修复方法是删除 snap curly 并安装基本的 apt curl:

$ sudo snap remove curl
$ sudo apt install curl
Run Code Online (Sandbox Code Playgroud)

瞧...

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 82784  100 82784    0     0   612k      0 --:--:-- --:--:-- --:--:--  612k
Run Code Online (Sandbox Code Playgroud)

  • 作为参考,SDKMan也出现了这个问题,原因是一样的。删除了curl的快照安装并经典的apt安装解决了这个问题。 (2认同)