Skip to content

Upload Uses Wrong Directory #2053

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

Open
3 tasks done
weswitt opened this issue Jan 26, 2023 · 13 comments
Open
3 tasks done

Upload Uses Wrong Directory #2053

weswitt opened this issue Jan 26, 2023 · 13 comments
Assignees
Labels
status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@weswitt
Copy link

weswitt commented Jan 26, 2023

Describe the problem

After compiling attempting an upload fails with "Error during Upload: Compiled sketch not found in C:\Users\wesw\AppData\Local\Temp\arduino-sketch-A1E8FD2B951BC0178B8D63295C7E129C".

This fails because there is no directory named arduino-sketch-A1E8FD2B951BC0178B8D63295C7E129C. The compiled sketch is in arduino-sketch-BD62D8498EB4D4F7E3207A44BF823043.

Where does arduino-cli get the directory name from?

To reproduce

arduino-cli.exe upload --verbose --fqbn esp8266:esp8266:d1_mini -p COM4

Expected behavior

The sketch is uploaded.

Arduino CLI version

0.29.0 Commit: 76251df Date: 2022-11-17T09:21:37Z

Operating system

Windows

Operating system version

11

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
@weswitt weswitt added the type: imperfection Perceived defect in any part of project label Jan 26, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 26, 2023
@weswitt
Copy link
Author

weswitt commented Jan 27, 2023

ok, found the solution. if i add "." at the end of the command it works.

so it seems that the tool does in fact work correctly, but the documentation and the help text for the tool should be updated to reflect this.

@per1234 per1234 self-assigned this Jan 28, 2023
@per1234
Copy link
Contributor

per1234 commented Jan 28, 2023

Hi @weswitt. Thanks for your report.

Where does arduino-cli get the directory name from?

It is the MD5 hash of the sketch path:

https://github.com/arduino/arduino-cli/blob/0.29.0/arduino/sketch/sketch.go#L313-L323

if i add "." at the end of the command it works.

so it seems that the tool does in fact work correctly, but the documentation and the help text for the tool should be updated to reflect this.

The sketch path argument is optional. If you do not provide it, the current working directory is used. So it should not be necessary to add . as that argument. If Arduino CLI is calculating a different build folder name when compiling than it does when uploading, this is a bug.

I was not able to reproduce this fault so I'll need some more information from you in order to proceed with the investigation:

First of all, please download the latest nightly build and then comment here to say whether the fault still occurs. Make sure you run an arduino-cli compile command in your sketch before doing an arduino-cli upload command. This is required because the temporary build paths have been moved to a new location (#2031) since 0.29.0 and the nightly version of Arduino CLI will not be able to find the build you produced when you ran arduino-cli compile using Arduino CLI 0.29.0.

There has been a significant amount of development work on Arduino CLI since the time of the 0.29.0 version you are using, including some changes to relevant code. The nightly build download links are listed here:

https://arduino.github.io/arduino-cli/dev/installation/#nightly-builds

@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label Jan 28, 2023
@weswitt
Copy link
Author

weswitt commented Jan 28, 2023

yes i already tried with the nightly build

@per1234
Copy link
Contributor

per1234 commented Jan 28, 2023

Does the fault still occur after you use the nightly build to run an arduino-cli compile followed by an arduino-cli upload command without a sketch name argument @weswitt?

@cmaglie
Copy link
Member

cmaglie commented Jan 30, 2023

Maybe we could hint in the error message to run a compile before the upload.

@weswitt
Copy link
Author

weswitt commented Jan 31, 2023

tried this and it also does not work

@per1234
Copy link
Contributor

per1234 commented Jan 31, 2023

@weswitt please post the output you get from running the pwd command from the terminal in the folder you are running the arduino-cli commands from.

Is there anything special about this path (e.g., network share, junction, symlink, ect.)?

@weswitt
Copy link
Author

weswitt commented Jan 31, 2023

this is on windows so there is no pwd command. and no there is nothing special about this dir.

@per1234
Copy link
Contributor

per1234 commented Jan 31, 2023

this is on windows so there is no pwd command

Please, work with me here. Getting information from you is going really slowly.

Which shell are you using?

Windows PowerShell does have a pwd command:

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-location?view=powershell-7.3#notes

If you are using cmd, then post the output of the cd command.

there is nothing special about this dir.

Does the problem also happen if you create a new sketch in a different location and try the same sequence of arduino-cli compile, arduino-cli upload commands?

@weswitt
Copy link
Author

weswitt commented Jan 31, 2023

i'm using cmd inside of a terminal host.

cd: d:\dev\src\homeauto\weather\waterflow\test32

i can try to make a new sketch later today, but regardless there seems to be a bug

@weswitt
Copy link
Author

weswitt commented Jan 31, 2023

i just tried your test of making a simple sketch in a new dir. same failure

@weswitt
Copy link
Author

weswitt commented Jan 31, 2023

i moved the dir with the sketch to the root of the drive and it works. so clearly arduino-cli has an issue with the dir name or something else about the location

@cmaglie
Copy link
Member

cmaglie commented Jun 9, 2023

@weswitt we cannot figure out the problem nor we are able to reproduce it, we need more info.

Could you please run the compile and upload with the -v flag and paste here the full output?

arduino-cli.exe compile -v --fqbn esp8266:esp8266:d1_mini
arduino-cli.exe upload --verbose --fqbn esp8266:esp8266:d1_mini -p COM4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants