ansible.posix icon indicating copy to clipboard operation
ansible.posix copied to clipboard

Cannot install on Windows (MSYS2 or Cygwin)

Open samhocevar opened this issue 3 years ago • 2 comments

SUMMARY

The installation tarball contains symbolic links that appear before the file they link to in the archive. This makes ansible.posix uninstallable on Windows because tar fails to create dangling symlinks and there is no control on the order in which files appear in the tarball.

There does not seem to be an easy fix. I can think of several suggestions:

  • replace symlinks with actual files (use --dereference when creating the tarball)
  • ensure symlinks appear in the tarball after the file they point to (very convoluted)
  • allow ansible-galaxy to ignore the error (--ignore-errors does not actually ignore the error)
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • Installer archive (tests directory)
ANSIBLE VERSION
% ansible --version
ansible 2.9.21
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/sam/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.9 (main, Nov 21 2021, 19:18:40) [GCC 10.2.0]
COLLECTION VERSION
% ansible-galaxy collection list ansible.posix
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

I guess it’s version 1.3.0.

CONFIGURATION
% ansible-config dump --only-changed
ANSIBLE_SSH_ARGS(env: ANSIBLE_SSH_ARGS) = -o ControlMaster=no
OS / ENVIRONMENT

Up-to-date Windows 11, with up-to-date MSYS2 (mingw64), configured with strict native symlinks (winsymlinks:nativestrict).

STEPS TO REPRODUCE

Just attempt to install using ansible-galaxy collection install ansible.posix.

Or simply try to unpack the tarball: wget -qO- https://galaxy.ansible.com/download/ansible-posix-1.3.0.tar.gz | tar xz

EXPECTED RESULTS

The tarball should unpack without errors.

ACTUAL RESULTS

Using ansible-galaxy:

% ansible-galaxy collection install ansible.posix
Process install dependency map
Starting collection install process
Installing 'ansible.posix:1.3.0' to '/home/sam/.ansible/collections/ansible_collections/ansible/posix'
ERROR! Unexpected Exception, this is probably a bug: [Errno 2] No such file or directory: b'cloud.sh' -> b'/home/sam/.ansible/collections/ansible_collections/ansible/posix/tests/utils/shippable/azure.sh'
to see the full traceback, use -vvv

Using tar:

% wget -qO- https://galaxy.ansible.com/download/ansible-posix-1.3.0.tar.gz | tar xz
tar: tests/utils/shippable/azure.sh: Cannot create symlink to ‘cloud.sh’: No such file or directory
tar: tests/utils/shippable/cs.sh: Cannot create symlink to ‘cloud.sh’: No such file or directory
tar: tests/utils/shippable/rhel.sh: Cannot create symlink to ‘remote.sh’: No such file or directory
tar: tests/utils/shippable/aix.sh: Cannot create symlink to ‘remote.sh’: No such file or directory
tar: tests/utils/shippable/macos.sh: Cannot create symlink to ‘remote.sh’: No such file or directory
tar: tests/utils/shippable/tower.sh: Cannot create symlink to ‘cloud.sh’: No such file or directory
tar: tests/utils/shippable/freebsd.sh: Cannot create symlink to ‘remote.sh’: No such file or directory
tar: tests/utils/shippable/osx.sh: Cannot create symlink to ‘remote.sh’: No such file or directory
tar: Exiting with failure status due to previous errors

samhocevar avatar Jan 27 '22 13:01 samhocevar

It works on my cygwin 3.3.4-2 on Windows 11:

$ ansible-galaxy collection install ansible.posix
Process install dependency map
Starting collection install process
Installing 'ansible.posix:1.3.0' to '/home/thelv/.ansible/collections/ansible_collections/ansible/posix'

thelv@hiyoko-hadesnuc ~
$ ls ~/.ansible/collections/ansible_collections/ansible/posix/
CHANGELOG.rst  MANIFEST.json  docs     plugins           test-requirements.txt
COPYING        README.md      hacking  requirements.txt  tests
FILES.json     changelogs     meta     shippable.yml

Also, your test command wget -qO- https://galaxy.ansible.com/download/ansible-posix-1.3.0.tar.gz | tar xz is working on my environment without issue too.

thelv@hiyoko-hadesnuc ~
$ wget -qO- https://galaxy.ansible.com/download/ansible-posix-1.3.0.tar.gz | tar xz

thelv@hiyoko-hadesnuc ~
$ ls
CHANGELOG.rst  MANIFEST.json  docs     plugins           shippable.yml
COPYING        README.md      hacking  requirements.txt  test-requirements.txt
FILES.json     changelogs     meta     rustup-init.exe   tests

Could you check you are using latest version of Cygwin? It seems there is no issue on collection side.

hiyokotaisa avatar Feb 28 '22 08:02 hiyokotaisa

Hi @samhocevar If it is possible, can you re-confirm that according to the advice from @hiyokotaisa ?

@hiyokotaisa thank you for your valuable advice! :)

saito-hideki avatar Feb 28 '22 08:02 saito-hideki