Skip to content

arduino_debug (windows) updates preferences.txt even without --save-prefs #6067

Closed
@terrillmoore

Description

@terrillmoore

It's not clear whether this is a documentation bug or an arduino_debug.exe bug.

From the man page manpage.adoc

--pref name=value

Sets the preference name to the given value.

Note that the preferences you set with this option are not validated: Invalid names will be set but never used, invalid values might lead to an error later on.

This is clear; if you use an invalid name (for example) for build.prefs=..., the program will use those preference anyway.

--save-prefs

Save any (changed) preferences to preferences.txt. In particular --board, --port, --pref, --verbose, --verbose-build and --verbose-upload may alter the current preferences.

The --save-prefs option description implies that if --save-prefs is not given, then preferences.txt will not be updated. However, this is not the case, at least on Windows.

$ ls -l ~/AppData/Local/arduino15/preferences.txt
-rw-r--r-- 1 tmm 197609 4102 Mar 12 21:54 /c/Users/tmm/AppData/Local/arduino15/preferences.txt
$  arduino_debug.exe --verify somthing.ino
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
$ ls -l ~/AppData/Local/arduino15/preferences.txt                                  
-rw-r--r-- 1 tmm 197609 4102 Mar 12 22:04 /c/Users/tmm/AppData/Local/arduino15/preferences.txt

If, in fact, you specify --pref build.path=... on the command line, it is written to preferences.txt, even if you did not specify --save-prefs.

Example: preferences.txt without build.path= setting; then run the command line tool.

$ head -5 ~/AppData/Local/arduino15/preferences.txt
board=adafruit_feather_m0
boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
build.verbose=false
build.warn_data_percentage=75
compiler.warning_level=none

$ arduino_debug.exe --verify catena4420_test01.ino --pref build.path=foo
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...

$ head -5 ~/AppData/Local/arduino15/preferences.txt                                
board=adafruit_feather_m0
boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
build.path=foo
build.verbose=false
build.warn_data_percentage=75

$

Note that build.path=foo now appears, despite no --save-prefs switch on the command line.

Either the documentation should be clarified, or the command-line invocation should be corrected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions