Menu

#871 filenames with () parens cause Tcl stacktrace

v0.43
closed
5
2017-03-07
2012-03-11
No

Using Pd-extended 0.43.1-20120310 on Mac OS X 10.6.8/Intel, opening a file with parens () in the filename causes this stacktrace:

(Tcl) UNHANDLED ERROR: 2012-03-11 16:07:42.666 defaults[4035:903] Could not parse: /Users/hans/Desktop/paren-bug-(in filename).pd. Try single-quoting it.
while executing
\"exec defaults write $adomain $akey -array-add \"$escaped\"\"
(procedure \"write_config_aqua\" line 9)
invoked from within
\"write_config_aqua $data $adomain $akey $arr \"
(procedure \"write_config\" line 3)
invoked from within
\"write_config $::recentfiles_list $::recentfiles_domain $::recentfiles_key true\"
(procedure \"::pd_guiprefs::write_recentfiles\" line 2)
invoked from within
\"::pd_guiprefs::write_recentfiles \"
(procedure \"::pd_menus::update_openrecent_menu_aqua\" line 13)
invoked from within
\"::pd_menus::update_openrecent_menu_aqua .openrecent $write\"
(procedure \"::pd_menus::update_recentfiles_menu\" line 4)
invoked from within
\"::pd_menus::update_recentfiles_menu\"
(procedure \"::pd_guiprefs::update_recentfiles\" line 8)
invoked from within
\"::pd_guiprefs::update_recentfiles $filename\"
(procedure \"pdtk_canvas_saveas\" line 23)
invoked from within
\"pdtk_canvas_saveas .x4f54000 {Untitled-1} {/Users/hans}\"
(\"uplevel\" body line 1)
invoked from within
\"uplevel #0 $cmds_from_pd\"

Discussion

  • Hans-Christoph Steiner

     
  • Hans-Christoph Steiner

    Fixed with this:

    diff --git a/tcl/pd_guiprefs.tcl b/tcl/pd_guiprefs.tcl
    index 77e06e2..1349be5 100644
    --- a/tcl/pd_guiprefs.tcl
    +++ b/tcl/pd_guiprefs.tcl
    @@ -167,11 +167,11 @@ proc ::pd_guiprefs::write_config_aqua {data {adomain} {akey} {arr false}} {
    if {$arr} {
    foreach filepath $data {
    set escaped [escape_for_plist $filepath]
    - exec defaults write $adomain $akey -array-add "$escaped"
    + exec defaults write $adomain $akey -array-add $escaped
    }
    } else {
    set escaped [escape_for_plist $data]
    - exec defaults write $adomain $akey '$escaped'
    + exec defaults write $adomain $akey $escaped
    }
    }

    @@ -244,5 +244,5 @@ proc ::pd_guiprefs::plist_array_to_tcl_list {arr} {
    # the Mac OS X 'defaults' command uses single quotes to quote things,
    # so they need to be escaped
    proc ::pd_guiprefs::escape_for_plist {str} {
    - return [regsub -all -- {'} $str {\\'}]
    + return '[regsub -all -- {'} $str {\\'}]'
    }

     
  • Hans-Christoph Steiner

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2017-03-07

    This is labled as closed, but still seems to be a problem in pd-vanilla 0.47.1. Is it possible to apply this patch to pd-vanilla as well?

     
    • IOhannes m zmölnig

      https://github.com/pure-data/pure-data/pull/48

      (though the patch seems to be somewhat half-applied)

       

Anonymous
Anonymous

Add attachments
Cancel