Skip to content

Conversation

@Bidski
Copy link

@Bidski Bidski commented Oct 19, 2023

If these files are installed in a system wide location then the user running the build may be unable to chmod the scripts in order to execute them.

On top of this, these scripts aren't actually needed as you can just invoke /bin/bash directly with the appropriate arguments to achieve the same result.

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the user running the build may be unable to chmod the scripts in order to execute them

There is no need to do that because the scripts already have executable permissions.

these scripts aren't actually needed as you can just invoke /bin/bash directly with the appropriate arguments to achieve the same result.

The scripts aren't there for the purpose of being ran manually. The scripts are automatically executed by the Arduino development tools:

## Save disassembler listing
# Dummy initial `echo.` command prevents unwanted stripping of quotes by `cmd /C` which would cause the command to fail for paths with spaces
recipe.hooks.objcopy.postobjcopy.1.pattern.windows=cmd /C echo. && "{compiler.path}{compiler.objdump.cmd}" {compiler.objdump.flags} "{build.path}/{build.project_name}.elf" > "{build.path}/{build.project_name}_{build.mcu}_{build.f_cpu}.lst"
recipe.hooks.objcopy.postobjcopy.1.pattern.linux=chmod +x "{runtime.platform.path}/scripts/create_disassembler_listing.sh"
recipe.hooks.objcopy.postobjcopy.1.pattern.macosx=chmod +x "{runtime.platform.path}/scripts/create_disassembler_listing.sh"
recipe.hooks.objcopy.postobjcopy.2.pattern.linux="{runtime.platform.path}/scripts/create_disassembler_listing.sh" "{compiler.path}{compiler.objdump.cmd}" "{compiler.objdump.flags}" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}_{build.mcu}_{build.f_cpu}.lst"
recipe.hooks.objcopy.postobjcopy.2.pattern.macosx="{runtime.platform.path}/scripts/create_disassembler_listing.sh" "{compiler.path}{compiler.objdump.cmd}" "{compiler.objdump.flags}" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}_{build.mcu}_{build.f_cpu}.lst"
## Save compiled hex
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}_{build.mcu}_{build.f_cpu}.hex
## Save hex
recipe.hooks.savehex.presavehex.1.pattern.windows="{runtime.platform.path}/scripts/delete_merged_output.bat" {build.export_merged_output} "{build.path}\{build.project_name}.with_bootloader.hex"
recipe.hooks.savehex.presavehex.2.pattern.windows=cmd /C copy "{build.path}\{build.project_name}_{build.mcu}_{build.f_cpu}.lst" "{sketch_path}"
recipe.hooks.savehex.presavehex.1.pattern.linux=chmod +x "{runtime.platform.path}/scripts/delete_merged_output.sh"
recipe.hooks.savehex.presavehex.2.pattern.linux="{runtime.platform.path}/scripts/delete_merged_output.sh" {build.export_merged_output} "{build.path}/{build.project_name}.with_bootloader.hex"
recipe.hooks.savehex.presavehex.3.pattern.linux=cp "{build.path}/{build.project_name}_{build.mcu}_{build.f_cpu}.lst" "{sketch_path}"
recipe.hooks.savehex.presavehex.1.pattern.macosx=chmod +x "{runtime.platform.path}/scripts/delete_merged_output.sh"
recipe.hooks.savehex.presavehex.2.pattern.macosx="{runtime.platform.path}/scripts/delete_merged_output.sh" {build.export_merged_output} "{build.path}/{build.project_name}.with_bootloader.hex"
recipe.hooks.savehex.presavehex.3.pattern.macosx=cp "{build.path}/{build.project_name}_{build.mcu}_{build.f_cpu}.lst" "{sketch_path}"

@Bidski
Copy link
Author

Bidski commented Oct 19, 2023

the user running the build may be unable to chmod the scripts in order to execute them

There is no need to do that because the scripts already have executable permissions.

The platform.txt file that you linked blindly tries to chmod the script. The user who is running the build process is also the user who is executing that chmod command (via the platform.txt commands). Even if the script already has executable permissions, running chmod as a user with insufficient permissions will fail.

these scripts aren't actually needed as you can just invoke /bin/bash directly with the appropriate arguments to achieve the same result.

The scripts aren't there for the purpose of being ran manually. The scripts are automatically executed by the Arduino development tools:

I understand this, and I am not trying to run the scripts manually. My point here is that the scripts are unnecessary even for the Arduino development tools

@Bidski Bidski requested a review from per1234 February 13, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants