Notepad3 icon indicating copy to clipboard operation
Notepad3 copied to clipboard

Can't open WSL2 files from WSL2 if specified with absolute path

Open Locietta opened this issue 3 years ago • 3 comments

Hi, I once used Notepad2 in WSL2 for quick changes on my config files. And recently I decide to switch to Notepad3 and run into this issue.

I can open and edit files in WSL2 with relative paths. But if provided with an absolute path, Notepad3 seems to not recognize it. With zufuliu/Notepad2, however, it works well. Any idea about it? It looks like a UNC related issue.

Version info:

Notepad3 (x64) v5.21.1129.1 (ba6de2c2)
Compiler: MS Visual C++ 2022 v17.0.(0-1) (VC v1930)
OS Version: Windows 11  Version 21H2 (Build 22598)
Windows Colors 'Dark-Mode' Theme is NO SUPPORTED.
Scintilla v511
Lexilla v511
Oniguruma v7.0.0
- Process is not elevated
- User is in Admin-Group.
- Locale -> en-US (CP:'ANSI (CP-936)')
- Current Encoding -> 'Unicode (UTF-8)'
- Screen-Resolution -> 1920 x 1080 [pix]
- Display-DPI -> 120 x 120  (Scale: 125%).
- Rendering-Technology -> 'DIRECT-WRITE'
- Zoom -> 100%.
- Current Lexer -> 'Text Files'

Some examples (notepad is an alias to Notepad3):

relative path: image same file, but with absolute path: image

Locietta avatar Apr 22 '22 15:04 Locietta

Hello @Locietta , as some bugs have been fixed since v5.21.1129, could you try with the latest beta file please? 🤔

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_5.22.418.1_beta.paf" or newer, see 1st list in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_5.22.418.1_beta_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... 😃

hpwamr avatar Apr 23 '22 15:04 hpwamr

@hpwamr Thanks for the information, I tried 5.22.418.1 beta version just now and can reproduce this issue on both portable and setup edition.

Locietta avatar Apr 23 '22 17:04 Locietta

Found related code in zufuliu/notepad2 to handle WSL2 UNC path, I think it would be useful. https://github.com/zufuliu/notepad2/blob/c92d353838a7eff7f259c89c2dd80695d978bb6d/src/Notepad2.c#L6663-L6669

Locietta avatar Apr 24 '22 08:04 Locietta

The problem in Notepad3 is the old command line parsing, cause the WSL2 home path ("~/") expands to "/HOME/..." and the old parser interprets it as an option start ( Windows program options starting with forward slash : /H ). This will need a refactoring of good old command line parser in NP3 ...

RaiKoHoff avatar Nov 18 '22 14:11 RaiKoHoff

Hello @Locietta ,

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_5.23.105.1_rc2.paf" or newer, see in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_5.23.105.1_rc2_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... 😃

hpwamr avatar Jan 05 '23 19:01 hpwamr

I've found an odd edge case involving the changed command line parser.

I typically test beta versions in a folder such that the executable path looks like this:

C:\Programs\Notepad3\5.23.105.1_rc2\Notepad3Portable.exe

And I exercise the beta by passing the executable name to an AutoIt script. However, AutoIt receives the path and file name in 8.3 truncated form, i.e.:

C:\Programs\Notepad3\523105~1.1_R\NOTEPA~1.EXE

When version 5.23.105.1 RC2 is launched in this way, it does not appear to see or parse its settings file. When launched normally, previous settings are present, but when launched by the 8.3 truncated path it launches as if with no settings customisations. Also, the "Save Settings on Exit" option is greyed out:

image

...and when I select "Save Settings Now", I get this:

image

(I will also point out the misspelt "FAILD" 😄 )

If I use a less complex path, e.g. C:\Programs\Notepad3\latest\NOTEPA~1.EXE, I do not see this problem.

Previous beta versions (e.g. 5.23.104.1 rc2) do not exhibit this behaviour.

craigo- avatar Jan 05 '23 21:01 craigo-

However, AutoIt receives the path and file name in 8.3 truncated form, i.e.: I will also point out the misspelt "FAILD"

Hello @craigo- ,

If your tests are successful, could you please valid this NP3 version and this minor correction; FAILED TO CREATE INITIAL INI FILE!


Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_5.23.106.1_rc2.paf" or newer, see in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_5.23.106.1_rc2_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... 😃

hpwamr avatar Jan 06 '23 08:01 hpwamr

I've tested version 5.23.106.1 RC2. I see none of my aforementioned problems.

As I can no longer generate the problem I cannot verify that you've changed the error text, but I trust you 😄

Thanks.

craigo- avatar Jan 07 '23 01:01 craigo-