constructor icon indicating copy to clipboard operation
constructor copied to clipboard

macOS download_dir does not exist or is not writable, unless in verbose mode

Open phyordia opened this issue 3 years ago • 4 comments

Hi all,

I have constructor 3.1.0 from conda install -y ctools/label/dev::constructor and when I try to create a new installer from the environment, I get the following error:

❯❯❯ constructor --cache-dir cache --output-dir dist .                                                                                                                           
platform: osx-64
Traceback (most recent call last):
  File "/Users/user/miniconda3/envs/test/bin/constructor", line 11, in <module>
    sys.exit(main())
  File "/Users/user/miniconda3/envs/test/lib/python3.8/site-packages/constructor/main.py", line 243, in main
    main_build(dir_path, output_dir=out_dir, platform=args.platform,
  File "/Users/user/miniconda3/envs/test/lib/python3.8/site-packages/constructor/main.py", line 111, in main_build
    fcp_main(info, verbose=verbose, dry_run=dry_run, conda_exe=conda_exe)
  File "/Users/user/miniconda3/envs/test/lib/python3.8/site-packages/constructor/fcp.py", line 383, in main
    _urls, dists, approx_tarballs_size, approx_pkgs_size, has_conda = _main(
  File "/Users/user/miniconda3/envs/test/lib/python3.8/site-packages/constructor/fcp.py", line 309, in _main
    pc_recs = _fetch(download_dir, precs)
  File "/Users/user/miniconda3/envs/test/lib/python3.8/site-packages/constructor/fcp.py", line 110, in _fetch
    assert pc.is_writable, download_dir + " does not exist or is not writable"
AssertionError: [---redacted---]/cache/osx-64 does not exist or is not writable

However, if I run it with the -v option, it does run successfully 😮

I noticed that the setuid bit is set when using -v, but not otherwise.

❯❯❯ constructor -v --cache-dir cache --output-dir dist .
[...]

❯❯❯ ls -lha | grep cache
drwxrwsr-x   3 user  1244544504    96B Oct 31 21:24 cache

❯❯❯ rm -rf cache                                                                                                                                                             

❯❯❯ constructor --cache-dir cache --output-dir dist .
[...Error above...]

❯❯❯ ls -lha | grep cache
drwxr-x---   3 user  1244544504    96B Oct 31 21:24 cache

Any clues?

How to reproduce: Install miniconda

./Miniconda3-latest-MacOSX-x86_64.sh

Welcome to Miniconda3 py38_4.8.3
...

open a new session:

❯❯❯  conda -V
conda 4.8.3

❯❯❯ conda create -y -n myenv python=3.8.5
❯❯❯ conda activate myenv
❯❯❯ conda install -y ctools/label/dev::constructor
❯❯❯ cat construct.yaml                                                                                                                                                      
name: test_installer
version: 1.0.0

channels:
  - http://repo.anaconda.com/pkgs/main/
  - https://repo.anaconda.com/pkgs/main/osx-64  [osx]
  - https://repo.anaconda.com/pkgs/main/noarch

environment: myenv

Thanks in advance.

phyordia avatar Nov 01 '20 01:11 phyordia

Wow, that's an interesting bug. Thank you for the report! We will certainly need to take a look at this.

mcg1969 avatar Nov 14 '20 22:11 mcg1969

I just ran into this same issue with the latest release of the constructor on Linux. Just chiming in to say that it's not just a macOS issue.

hoechenberger avatar Jan 12 '22 00:01 hoechenberger

It looks like the only non-print-to-stdout call that verbose is directly responsible for in constructor is this function to check for outdated records. Interestinhglhy, this relies on SubdirData.query_all(), which features a create_cache_dir() call :)

That function delegates the creation of the directory to another one, which makes sure the permission bits are correctly set.

jaimergp avatar Aug 15 '22 11:08 jaimergp

unfortunately it doesnt fix the bug. Please see https://github.com/conda/constructor/pull/548#issuecomment-1216658285

phyordia avatar Aug 16 '22 13:08 phyordia