microsoft / microsoft/vscode-java-debug

Setting shortenCommandLine "argfile" should not nest a user-passed argfile inside an argfile

Aperta
#1,403 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

ai-triaged bug enhancement
Lingua principale
TypeScript
Stelle
591
Fork
429
Merge medio
1g 9h
PR unite (30g)
19

Descrizione

When setting shortenCommandLine to argfile (or setting to auto and then triggering the argfile behavior with a long command), VS Code will always put any vmArgs inside an argfile, even if the only VM arg is another argfile. This breaks run configurations that pass a user-generated argfile that still trigger the automatic CLI shortening behavior such as a very long classpath, since argfiles cannot be nested.

Environment
  • Operating System: Linux
  • JDK version: 17
  • Visual Studio Code version: 1.84.0-insider (60182c7e1a666961ded4d0319c154f52d85daf30)
  • Java extension version: v0.25.15
  • Java Debugger extension version: v0.54.0
Steps To Reproduce
  1. Create a trivial Java project ex. a Hello World main method
  2. Create an argfile myargs
  3. Create launch.json with a corresponding run configuration for the main method. Set shortenCommandLine to argfile to force the argfile behavior (should be equivalent to setting auto and then loading a very long classpath).
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Hello",
            "request": "launch",
            "mainClass": "Hello",
            "vmArgs": "@myargs",
            "shortenCommandLine": "argfile"
        }
    ]
}
  1. Attempt to run the main method - this should fail.

Sample project: test-argfile.tar.gz

Current Result
$  /usr/bin/env /path/to/jdk @/tmp/cp_7ifzraqswz8cni6w2z8m6nw3w.argfile Hello 
Error: Could not find or load main class @myargs
Caused by: java.lang.ClassNotFoundException: @myargs

/tmp/cp_7ifzraqswz8cni6w2z8m6nw3w.argfile contents:

@myargs -XX:+ShowCodeDetailsInExceptionMessages -cp "/home/justinw/.vscode-server-insiders/data/User/workspaceStorage/-2d922411/redhat.java/jdt_ws/test-argfile_31bc6c61/bin"
Expected Result

Program should execute and argfiles should not be nested

Additional Informations

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la configurazione di avvio Java usando vmArgs, shortenCommandLine e il file myargs creato dall’utente, quindi riproduci il problema con i passaggi Hello World forniti. Traccia il modo in cui il debugger costruisce l’argfile temporaneo; l’attività è completata quando il programma viene eseguito senza annidare l’argfile passato dall’utente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, typescript, vscode
Ambito
devtools, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.