Perl - Carton Installer Bug
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read PerlAppResourceBuilderExtensions.Dockerfile.cs, PerlAppResourceBuilderExtensions.PackageManager.cs, and PerlAppResourceBuilderExtensions.cs, then trace how WithLocalLib reaches Carton installation and environment setup in publish and run modes. Check the existing tests for Carton and cpanm behavior. Done means Carton installs into the configured root in both modes, environment variables and entrypoint paths use that root, and existing cpanm behavior is preserved.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
[Perl] WithCarton() + WithLocalLib() points PERL5LIB at a directory Carton never installs into
Carton always installs into <cpanfile dir>/local unless told otherwise via carton install --path=PATH or the
PERL_CARTON_PATH environment variable. The integration never passes either, but it still uses the
WithLocalLib(...) path for PERL5LIB / PERL_LOCAL_LIB_ROOT.
Publish (generated Dockerfile)
BuildCartonDockerfile
(called from #L292
with the resource's local::lib path):
- #L371-L372:
runscarton install --deployment/carton installwith no--path, so modules land in/app/local. - #L384:
copies/appfrom the build stage, so/app/localexists at runtime. - #L388-L389:
setsPERL5LIB=/app/<localLibPath>/lib/perl5andPERL_LOCAL_LIB_ROOT=/app/<localLibPath>, built from the
WithLocalLibpath.
With WithCarton().WithLocalLib("vendor/perl5"), the image has PERL5LIB=/app/vendor/perl5/lib/perl5, and that
directory doesn't exist. The app works only because of a separate hardcoded path:
BuildContainerEntrypointArguments#L41
adds-Ilocal/lib/perl5, and the Carton builder always passesuseLocalLibPath: true
(#L368).
That fallback doesn't cover these cases:
- Executable entrypoints:
BuildContainerEntrypointArgumentsreturns[entrypoint]for
EntrypointType.Executable, with no-I. Unless/app/localis on@INCsome other way, the executable can't
find Carton-installed modules. - Child Perl processes (
system("perl ..."),prove, helper scripts) inherit the wrongPERL5LIBand don't
get-I. - Tools that read
PERL_LOCAL_LIB_ROOTsee a root that doesn't exist.
The cpanm builder has the reverse, harmless problem. It installs into the WithLocalLib path and sets env vars
correctly, but the entrypoint still adds -Ilocal/lib/perl5 even when nothing is installed there.
Run mode (likely the same mismatch, not verified at runtime)
BuildProjectInstallArgs#L787-L789
returnsinstall/install --deploymentfor Carton and ignoreslocalLibPath. Existing tests document this
behavior: "Carton manages its own local directory; --local-lib is not used".- The installer and app still receive
ApplyLocalLibEnvironment
values (PERL5LIB,PERL_LOCAL_LIB_ROOT,PERL_MM_OPT=INSTALL_BASE=...,PERL_MB_OPT=--install_base ...)
that point at theWithLocalLibpath, while Carton installs into<appDir>/local. - Nothing runs the app through
carton exec, and no run-mode-Ipoints atlocal/lib/perl5. With a non-default
WithLocalLibpath, the app likely can't find its Carton modules in run mode. It also isn't clear whether the
INSTALL_BASE/--install_basevariables interfere with Carton's internalcpanm -L localcall.
Regression
No response
Steps to reproduce
1. Create an app with `cpanfile` (for example `requires 'JSON::PP';`) and `cpanfile.snapshot`, and add an
`Executable` entrypoint or a script that runs `system($^X, '-MJSON::PP', '-e', '1')`.
2. AppHost:
builder.AddPerlScript("app", "../app", "app.pl")
.WithCarton()
.WithProjectDependencies()
.WithLocalLib("vendor/perl5");
3. Publish, build the generated Dockerfile, and run the image. Then
`docker run --rm <image> sh -c 'echo $PERL5LIB; ls /app/vendor/perl5; ls /app/local/lib/perl5'`.
4. Observe that `PERL5LIB` points at `/app/vendor/perl5/lib/perl5`, which doesn't exist, while modules are under
`/app/local/lib/perl5`. The child Perl process or executable entrypoint fails with
`Can't locate JSON/PP.pm` (or another non-core module).
5. Run mode: `aspire run` the same AppHost and check where `carton install` wrote modules versus the app's
`PERL5LIB`.
Expected behavior
Carton honors WithLocalLib(...) regardless of fluent call order, and uses local when no path is configured.
The installer and application use the final configured root:
- Run mode: resolve relative paths against the application's working directory. Set
PERL_CARTON_PATH
andPERL_LOCAL_LIB_ROOTto that root, andPERL5LIBto<root>/lib/perl5, on both the installer and app. - Publish mode: set
PERL_CARTON_PATHin the generated build stage beforecarton install. Use
/app/localby default, or/app/<configured relative path>for a custom path. The runtime image sets
PERL_LOCAL_LIB_ROOTto that root andPERL5LIBto<root>/lib/perl5. Published environment variables
use the same container paths, not host filesystem paths. - Entrypoints: generated Perl
-Iarguments use<root>/lib/perl5for both Carton and cpanm.
Executable entrypoints and child Perl processes can resolve installed modules through inheritedPERL5LIB. - Installer options: do not inject
PERL_MM_OPTorPERL_MB_OPTfor Carton; Carton manages its own
installer options. Preserve existing cpanm behavior.
Generated paths remain correctly quoted and escaped. This does not remove upstream Perl build-tool
limitations: Carton dependency installation can still fail for local::lib paths containing spaces.
Screenshots
No response
IDE and version
VS Code
IDE version
No response
Nuget packages
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
- Lingua principale
- C#
- Stelle
- 632
- Fork
- 204
- Merge medio
- 2g 13h
- PR unite (30g)
- 92
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CommunityToolkit/Aspire
-
[14.0] Remove Java ResourceAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
CommunityToolkit/Aspire#1622 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[14.0] Remove Rust resourceAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
CommunityToolkit/Aspire#1620 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Update Toolkit to Aspire 17.1 nightly 17.1.0-preview.1.26556.8Forse già presa @aaronpowell l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 1/100
CommunityToolkit/Aspire#2421 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
CommunityToolkit/Aspire#2420 ·
I maintainer di solito rispondono entro 1 giorno
-
Chroma: a Distributed setting in the client integrationForse già presa @Laurianti l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
CommunityToolkit/Aspire#2418 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di CommunityToolkit/Aspire
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
RicoSuter/Namotion.Interceptor#918 ·
I maintainer di solito rispondono entro 1 giorno
-
area-integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Sample solution restore fails with NU1109 (Microsoft.Extensions.Logging.Abstractions downgrade)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ardalis/CleanArchitecture#1150 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
reacher-z/Awesome-REA#3585 ·
I maintainer di solito rispondono entro 1 giorno