Opened 7 weeks ago

Last modified 12 days ago

#1376 new Bug / Defect

Error - "There already exist a config file ... " OpenVPN GUI when upgrading to 2.5 on Win10 x64

Reported by: Namsnob Owned by: Selva Nair
Priority: major Milestone:
Component: Windows GUI Version: OpenVPN 2.5.0 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords:
Cc: Selva Nair

Description

Hello together,

after updating servers and clients from OVPN 2.4.x to 2.5 via Windows MSI Installer, the GUI on startup always showed the Message Box Error - "There already exists a config file named xxxx.ovpn. You cannot have multiple config files with the...... " (resp. the German equivalent).

This is a bit annoying as this prevents OpenVPN startup without user intervention (and promptly, this had cut off our OVPN server access after an unattended windows update due to OpenVPN GUI "hang" after the reboot).

After some research, I found the following elder ticket which seem to have put me on the right track

https://community.openvpn.net/openvpn/ticket/1175

After comparing the Open VPN GUI setting in the preferences and the corresponding registry "HKLM\Software\OpenVPN\config_dir" entry, I found that there is indeed a slight difference, as the GUI preference has trailing "\", while the registry has not, i.e. Gui setting "C:\Program Files\OpenVPN\config\ <-!!" and the registry "C:\Program Files\OpenVPN\config" (although I have not changed one.

The OpenVPN GUI seems to consider that (obviously errorneously) as different paths and so the duplicate warning for one and the same ovpn file.

Of course, I could workaround that by adding the trailing "\" in the GUI preference setting.

But this seems to be an easy resolvable bug.

Hope that helps,

Best regards,
Joachim

Change History (2)

comment:1 Changed 12 days ago by Gert Döring

Cc: Selva Nair added
Milestone: release 2.5

I wonder how these paths came into existance in the first place...

But anyway. @selva: is there something like a "realpath(3)" for windows, which would take a path name and canonicalize it - de-duplicate double backslashes, canonicalize "path/../" elements, chop off trailing "/", so comparison is more likely to recognize duplicates?

(Note: path examples written with "/" as trac hates backslashes)

Last edited 12 days ago by Gert Döring (previous) (diff)

comment:2 Changed 12 days ago by Selva Nair

See #1359

After comparing the Open VPN GUI setting in the preferences and the corresponding registry "HKLM\Software\OpenVPN\config_dir" entry, I found that there is indeed a slight difference, as the GUI preference has trailing "\", while the registry has not, i.e. Gui setting "C:\Program Files\OpenVPN\config\ <-!!" and the registry "C:\Program Files\OpenVPN\config" (although I have not changed one.

The default value of local config directory in the GUI preferences is something like C:\Users\username\OpenVPN\config, not meant to be the same as the global location. The user must have changed it to C:\Program Files\OpenVPN\config\ which is the same as the global config directory.

We do a very basic check to skip the latter if "identical" to the former, but using the same value for these two locations serves no purpose. The GUI scans both the global location defined in the HKLM\...\config_dir and the user's private location defined in GUI preferences. Just leave the preferences at the default even if the user has no private configs. See also https://community.openvpn.net/openvpn/ticket/1359#comment:4.

@gert: We could use PathCanonicalize() which handles .\, ..\ etc. but may not help with detecting cases like \\?\C:\ and \\.\C:\ are the same as C:\ or drive described by volume GUID should match one with corresponding drive letter etc.

Anyway, I'll replace the strcmp() by something smarter to cover common cases.

Note: See TracTickets for help on using tickets.