salt: file.readlink not working with link junction type for Windows

Description of Issue

Windows only : https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

Salt module file.readlink not working with directory junction link with mklink /j.

Steps to Reproduce Issue

  1. Create a junction link
cmd /c dir /a:l 'C:\VSCode-Anywhere\apps\scoop\apps\7zip'
 Le volume dans le lecteur C n’a pas de nom.
 Le numéro de série du volume est C8E9-B3F9

 Répertoire de C:\VSCode-Anywhere\apps\scoop\apps\7zip

14/09/2019  16:46    <JUNCTION>     current [C:\VSCode-Anywhere\apps\scoop\apps\7zip\19.00]
               0 fichier(s)                0 octets
               1 Rép(s)  28 263 485 440 octets libres
salt-call.bat --config-dir=C:\VSCode-Anywhere\Apps\saltstack\conf --pillar-root=C:\VSCode-Anywhere\Apps\saltstack\srv\pillar file.readlink C:\VSCode-Anywhere\apps\scoop\apps\7zip\current
Error running 'file.readlink': not a symbolic link

Versions Report

salt-call.bat --config-dir=C:\VSCode-Anywhere\Apps\saltstack\conf --pillar-root=C:\VSCode-Anywhere\Apps\saltstack\srv\pillar salt --versions-report
Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.11.5
       cherrypy: 17.4.1
       dateutil: 2.7.5
      docker-py: Not Installed
          gitdb: 2.0.5
      gitpython: 2.1.10
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        libnacl: 1.6.1
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
   python-gnupg: 0.4.3
         PyYAML: 3.13
          PyZMQ: 17.1.2
           RAET: Not Installed
          smmap: 2.0.5
        timelib: 0.2.4
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist:
         locale: cp1252
        machine: AMD64
        release: 10
         system: Windows
        version: 10 10.0.18362 SP0 Multiprocessor Free

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

This is mostly a feature as it will extend support. Still in favor of this 👍

Actually while thinking about this, maybe I can incorporate it into my PR. I submitted PR #55000 which adds hard links to posixy environments. Since you can’t hard link a directory in posix, I simply return a failure.

However, ntfs junctions are pretty similar to hard links (yet for directories). Do you guys think it’ll make sense to add windows support and merge this functionality into that PR?

The reason I would like to see it separate is because of our CI/CD system. Having separate PR’s with platform specific code would make potential debugging easier and gives us more granularity in the future.