Skip to content

The sketch new command ignores the sketch folder name specification #2043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
kittaakos opened this issue Jan 23, 2023 · 2 comments · Fixed by #2051
Closed
3 tasks done

The sketch new command ignores the sketch folder name specification #2043

kittaakos opened this issue Jan 23, 2023 · 2 comments · Fixed by #2051
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

kittaakos commented Jan 23, 2023

Describe the problem

I can use the CLI sketch new to create invalid sketches which will not compile. The little sister task of this one is arduino/arduino-ide#1599.

To reproduce

./arduino-cli version                                                          
arduino-cli  Version: git-snapshot Commit: a58d5adb Date: 2023-01-23T09:37:23Z
./arduino-cli sketch new "/Users/a.kitta/Documents/Arduino/\`~%^&()=+[{]};',.cpp"
Sketch created in: /Users/a.kitta/Documents/Arduino/`~%^&()=+[{]};',.cpp
cat ~/Documents/Arduino/\`\~%\^\&\(\)=+\[\{\]\}\;\',.cpp/\`\~%\^\&\(\)=+\[\{\]\}\;\',.cpp.ino

void setup() {
}

void loop() {
}
./arduino-cli compile -b arduino:avr:uno  "/Users/a.kitta/Documents/Arduino/\`~%^&()=+[{]};',.cpp"
avr-g++: error: /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino/sketch-94408ACC1CA44D8729BBBE1057EBD2E8/sketch/`~%^&()=+[;',.cpp.ino.cpp: No such file or directory
avr-g++: warning: '-x c++' after last input file has no effect
avr-g++: fatal error: no input files
compilation terminated.

Used platform Version Path                                                                
arduino:avr   1.8.6   /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.6
Error during build: exit status 1

Expected behavior

new sketch fails when the sketch's name is invalid. https://arduino.github.io/arduino-cli/dev/sketch-specification/#sketch-root-folder

Arduino CLI version

a58d5ad

Operating system

macOS

Operating system version

12.5.1

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@kittaakos kittaakos added the type: imperfection Perceived defect in any part of project label Jan 23, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 23, 2023
@umbynos
Copy link
Contributor

umbynos commented Jan 23, 2023

This should be a matter of implementing a regex to check if the sketch name is a valid one

@umbynos
Copy link
Contributor

umbynos commented Jan 24, 2023

AC: if a name that does not respect the regex is used an appropriate error is returned. Otherwise the sketch name is accepted. See https://arduino.github.io/arduino-cli/dev/sketch-specification/#sketch-folders-and-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
4 participants