Bugzilla – Bug 1269
"backslash percent" not saved in effect presets
Last modified: 2019-08-09 10:19:57 UTC
If an effect preset is saved using the "Manage" button and the setting include one or more backslashes before a percent character, then the backslashes are missing in the saved settings (which unsurprisingly may lead to additional errors). Example: In the Nyquist prompt, enter the code: (print "\\%") This should (and does) print "\%" Save it as a preset. Retrieve the preset and it is restored as: (print "%") Tested on Debian Stable.
Same on Windows and Mac.
Testing on W10 with audacity-2.3.3-alpha-267-f320612f10e44f212c28175a57172a5811d30608 This appears to work properly a) the reloaded preset is restored with the double backslash b) it works to print "\%" as expected c) opening up the .ny file with Wordpad shows the double backslash to be present
Testing on macOS 10.14.5 with 2.3.3 alpha jc001 as with Windows this appears to work properly: a) the reloaded preset is restored with the double backslash b) it works to print "\%" as expected c) opening up the .ny file with TextEdit shows the double backslash to be present
(In reply to Peter Sampson from comment #2) Not fixed on Linux. The bug is still as described in the Description.
(In reply to Steve Daulton from comment #4) Not fixed in Audacity 2.3.2 on Windows.
(In reply to Steve Daulton from comment #5) >Not fixed in Audacity 2.3.2 on Windows. I just tested on W10 with 2,3,2 - and that works for me - so I'm puzzled
Ah - but on W10 with 2.3.2 or 2.3.3 alpha adding to the steps 6) close Audacity 7) relaunch Audacity 8) Tools Nyquist Prompt 9) command shows as (print "%") BUT ... 10) Load the preset saved at Step 3 11) command shows as (print "\\%") So the bug as described works for me but do Steps 6-9 represent a bug ?
Ah now I see what the problem is As with Equalization we have two ways of managing presets - and they don't play nice together 1) The Save and LOAD buttons do work, restoring (print "\\%") this save the preset in a .ny file 2) The Manage button with user presets wrongly restores(print "%") I don't know where this gets stored So it's the newer Manage regime that shows this bug But we should not be having the two non-interacting ways of handling presets !
(In reply to Peter Sampson from comment #7) The Manual says here https://alphamanual.audacityteam.org/man/Nyquist_Prompt#Buttons >OK: Applies the code to the waveform selection without debug output. >Your entered code will be retained next time you open Nyquist Prompt >in the Audacity session. so this implies that Steps 6-9 in Comment #7 is a bug (part of this bug - or maybe a new bug)
I've just tested with 4cc35b145b53ca0a0dda7f061f090e04342216a8 on Windows 10 (latest commit at time of writing). 1) Delete pluginregistry.cfg and pluginsettings.cfg 2) Launch Audacity 3) Add new track and make a selection 4) Launch "Nyquist Prompt" from Tool menu 5) In the Nyquist Prompt text box, type: (print "\\%") 6) Click the "Manage" button. 7) Select "Save Preset", type "test" (without quotes) as the name and click the OK button. 8) Delete the contents of the Nyquist Prompt text box. 9) "Manage button > User Presets > test" The Nyquist Prompt text box now contains: (print "%") The Nyquist Prompt text box "should" have been restored as: (print "\\%") but the backslashes have "apparently" not been saved in the effect preset. If we now close Audacity and look in pluginsettings.cfg, we see the line: Parameters=Command="(print \\"\\\\%\\")" Version="4" Given that backslashes have to be escaped with a backslash, this looks correct at first glance, but note that the quotes are not escaped with a single backslash but a double backslash. \\" produces " The first backslash is to ensure that the second backslash survives, and the second backslash is required to escape the quote character. Now for the case of a backslash character: The backslash must be escaped with a backslash, so we need two backslashes, but for each of those to survive, they must themselves be escaped. Thus for each backslash character, the saved setting must have 4 backslashes. Thus: \\\\ produces \ \\\\\\\\ produces \\ However, if we then add a % character after the back slashes, it gets treated as and escape sequence, so we actually need to add four more backslashes before the % character: Parameters=Command="(print \\"\\\\\\\\\\\\%\\")" Version="4" (my head is now spinning)
DEVEL - FIX MADE https://github.com/audacity/audacity/commit/de468afd8dc9f04a7e4a37be2a679125f3318c81
(In reply to James Crook from comment #11) Testing on W10 with audacity-2.3.3-alpha-296-13348841c038bdd7614ae9e401ad0a419f7fb44a This now works properly on Windows
Testing on macOS 10.14.5 with mac 2.3.3 alpha jc004 of 25Jul19 Now works properly on Mac too
Working correctly on Linux. Peter wrote in #13 that it was working correctly on Mac, so closing as fixed.