Web lists-archives.com

Fish shell fails with PermissionDenied on rename file, if Cygwin home directory is a Junction.




Hi,

This report originates from a ticket created on Fish Github account here: https://github.com/fish-shell/fish-shell/issues/2590
The issue is, that for some reason, running fish shell fails with PermissionDenied error if the home directory is a Windows Junction.

This is what I get when I run fish in my setup:


marcin@BENEK /c/tmp
→ fish
<E> fish: Unable to rename file from '/home/marcin/.config/fish/fishd.tmp.QvV0Fd' to '/home/marcin/.config/fish/fishd.BENEK.x86_64': Permission denied
<E> fish: Unable to rename file from '/home/marcin/.config/fish/fishd.tmp.Os5Tmd' to '/home/marcin/.config/fish/fishd.BENEK.x86_64': Permission denied
<E> fish: Unable to rename file from '/home/marcin/.config/fish/fishd.tmp.3Bop6u' to '/home/marcin/.config/fish/fishd.BENEK.x86_64': Permission denied


I have my cygwin home directory created as a junction to a folder on another disk, which is managed by OneDrive. This is how this looks from cmd.exe side:


c:\tools\cygwin\home>dir
 Volume in drive C is SYSTEM
 Volume Serial Number is 1AD1-BCDF

 Directory of c:\tools\cygwin\home

14.04.2018  00:53    <DIR>          .
14.04.2018  00:53    <DIR>          ..
11.11.2017  23:45    <JUNCTION>     marcin [d:\OneDrive\tools\CYGWIN_HOME]
               0 File(s)              0 bytes
               3 Dir(s)  77 744 492 544 bytes free



The junction was create with `mklink` command as below:


mklink /J marcin d:\OneDrive\tools\CYGWIN_HOME


What you can see below is an excerpt from the `strace fish > log 2>&1` command.
The bigger trace is available here: http://s000.tinyupload.com/index.php?file_id=09852752977194690660 and contains the whole `strace` log up to the point when it just starts logging identical errors.

The interesting part seems to be this:


   64  381028 [main] fish 2084 mount_info::conv_to_win32_path: conv_to_win32_path (/home/marcin/.config/fish)
   64  381092 [main] fish 2084 mount_info::cygdrive_win32_path: src '/home/marcin/.config/fish', dst ''
   73  381165 [main] fish 2084 set_flags: flags: binary (0x2)
  119  381284 [main] fish 2084 mount_info::conv_to_win32_path: src_path /home/marcin/.config/fish, dst C:\tools\cygwin\home\marcin\.config\fish, flags 0x3000A, rc 0
  248  381532 [main] fish 2084 symlink_info::check: 0x0 = NtCreateFile (\??\C:\tools\cygwin\home\marcin\.config\fish)
  135  381667 [main] fish 2084 symlink_info::check: not a symlink
  100  381767 [main] fish 2084 symlink_info::check: 0 = symlink.check(C:\tools\cygwin\home\marcin\.config\fish, 0xFFFF9150) (0x3000A)
   55  381822 [main] fish 2084 path_conv::check: this->path(C:\tools\cygwin\home\marcin\.config\fish\BENEK), has_acls(1)
  111  381933 [main] fish 2084 __set_errno: int rename2(const char*, const char*, unsigned int):2135 setting errno 2
  147  382080 [main] fish 2084 rename2: -1 = rename(/home/marcin/.config/fish/BENEK, /home/marcin/.config/fish/fishd.BENEK.x86_64), errno 2


We have „not a symlink” response, followed by a failing rename call.

All other Cygwin tools work correctly. I can manually rename the files using `mv`. This does not seem to be ACL / access issue, or at least not for any other tools I use, and I use Cygwin in this setup for years. Earlier, the junction was to a Dropbox-managed folder, now it’s OneDrive-managed one. This however seems not to make any difference, and it seems that the Junction is the main issue.

Please also have a look at the Github Ticket, perhaps you’ll find more details in there.

I’ll be happy to provide more information/logs/etc if required.

-- 
Regards,
Marcin Kielar


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple