Perl - Carton Installer Bug
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #2417 de @Omnideth — fusionado
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C#
- Estrellas
- 632
- Forks
- 204
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 99
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CommunityToolkit/Aspire
-
[14.0] Remove Java ResourceAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
CommunityToolkit/Aspire#1622 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
[14.0] Remove Rust resourceAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
CommunityToolkit/Aspire#1620 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
Terraform integrationAbiertointegration request :mailbox_with_mail:
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
CommunityToolkit/Aspire#2424 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
CommunityToolkit/Aspire#2420 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
RavenDB Cloud hosting integration for aspire deployPosiblemente ocupada @poissoncorp la tomó hace 3 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
CommunityToolkit/Aspire#2412 ·
Los mantenedores suelen responder en 1 día
Todos los issues de CommunityToolkit/Aspire
Issues similares
-
Assert.That on a null non-generic IEnumerable throws ArgumentNullException, so IsNull() cannot passAbiertobug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
area/automation area/sdk kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
unoplatform/uno.templates#2406 ·
Los mantenedores suelen responder en 1 día
-
bug frontend ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
documentation trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día