From ee43728b1860fc808fb71fb1d84a6801c0ba554f Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 24 Aug 2017 11:17:40 -0400 Subject: [PATCH] Fix bug when adding symbol library with $ as first character of path name. Test the result of wxFileName::MakeRelativeTo() before testing to see if the resulting relative path starts with '.'. When a library with relative path that contains a path name with $ as the first character, MakeRelativeTo() calls Normalize() which attempts to do an environment variable substitution that concatenates consecutive paths i.e. the path /foo/$bar ends up being foo$bar which is obviously incorrect. This fix is only a fix for absolute paths and files that contain path names that begin with $. This still does not resolve the issue when adding a library file relative to one of the search paths that contains a path name that begins with a $. Fixing this would potentially break paths that are expecting environment variable substitution. Fixes lp:1712361 https://bugs.launchpad.net/kicad/+bug/1712361 --- eeschema/dialogs/dialog_eeschema_config.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index ffb99faea3..fe8fef8803 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -348,9 +348,8 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) for( unsigned ll = 0; ll < paths.GetCount(); ll++ ) { wxFileName relfn = fn; - relfn.MakeRelativeTo( paths[ll] ); - if( relfn.GetPath()[0] != '.' ) + if( relfn.MakeRelativeTo( paths[ll] ) && relfn.GetPath()[0] != '.' ) { fn = relfn; break;