Checklist
What happened?
On Windows, when running as admin with a .nonadmin marker file present within the install directory, the new-style menu JSON files (those with $schema) create shortcuts in the system location (ProgramData) instead of the user location (AppData).
Expected behavior: The .nonadmin marker file should signal a user-mode install regardless of whether the process is elevated.
Current behavior:
- Legacy code path (no
$schema): Checks .nonadmin before deciding mode (which seems to work as expected)
- New code path (with
$schema): @elevate_as_needed decorator checks user_is_admin() first, passes _mode="system" without checking .nonadmin (which does not work as expected)
Reproduction (conda install spyder shows the bug):
- Create a conda environment with
.nonadmin marker file within PREFIX
- Run conda install as an elevated process (e.g., "Run as Administrator")
- Install a package with new-style menu JSON (
$schema present)
- Observe: shortcut created in
%ProgramData% instead of %AppData%
Suspected location: menuinst/utils.py lines 509-517, the @elevate_as_needed decorator:
if user_is_admin():
return func(*args, _mode="system", **kwargs)
This should check for .nonadmin before defaulting to system mode.
Conda Info
Conda Config
Conda list
Additional Context
The legacy menuinst code (_legacy/__init__.py lines 62-87) correctly checks .nonadmin before deciding the mode. The new code path should have consistent behavior.
This inconsistency causes issues when conda is invoked from an elevated process but the install is intended to be per-user (as signaled by .nonadmin).
Checklist
What happened?
On Windows, when running as admin with a
.nonadminmarker file present within the install directory, the new-style menu JSON files (those with$schema) create shortcuts in the system location (ProgramData) instead of the user location (AppData).Expected behavior: The
.nonadminmarker file should signal a user-mode install regardless of whether the process is elevated.Current behavior:
$schema): Checks.nonadminbefore deciding mode (which seems to work as expected)$schema):@elevate_as_neededdecorator checksuser_is_admin()first, passes _mode="system" without checking.nonadmin(which does not work as expected)Reproduction (
conda install spydershows the bug):.nonadminmarker file withinPREFIX$schemapresent)%ProgramData%instead of%AppData%Suspected location:
menuinst/utils.pylines 509-517, the@elevate_as_neededdecorator:This should check for
.nonadminbefore defaulting to system mode.Conda Info
Conda Config
Conda list
Additional Context
The legacy menuinst code (
_legacy/__init__.pylines 62-87) correctly checks.nonadminbefore deciding the mode. The new code path should have consistent behavior.This inconsistency causes issues when
condais invoked from an elevated process but the install is intended to be per-user (as signaled by.nonadmin).